Hi, all!
I’m trying to install pytorch c++ frontend with cuda on Win10.
I followed the instruction in vs2019 installation guide 7
I read that GPU installation requires torch_cuda.lib, c10_cuda.lib, torch.lib, cudnn64_7.dll, cudart64_102.dll, cublas64_10.dll (for cuda 10.2), but the last three have no .lib files.
So I build lib files from the three dlls using dumpbin.exe & lib.exe.
The final build shows linking errors.
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class at::Tensor __cdecl at::Tensor::to(struct c10::TensorOptions const &,bool,bool,class c10::optional<enum c10::MemoryFormat>)const " (__imp_?to@Tensor@at@@QEBA?AV12@AEBUTensorOptions@c10@@_N1V?$optional@W4MemoryFormat@c10@@@4@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class at::Tensor __cdecl at::Tensor::add(class at::Tensor const &,class c10::Scalar)const " (__imp_?add@Tensor@at@@QEBA?AV12@AEBV12@VScalar@c10@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class at::Tensor __cdecl at::randn(class c10::ArrayRef<__int64>,struct c10::TensorOptions const &)" (__imp_?randn@at@@YA?AVTensor@1@V?$ArrayRef@_J@c10@@AEBUTensorOptions@4@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class at::Tensor __cdecl at::ones(class c10::ArrayRef<__int64>,struct c10::TensorOptions const &)" (__imp_?ones@at@@YA?AVTensor@1@V?$ArrayRef@_J@c10@@AEBUTensorOptions@4@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl c10::TensorImpl::set_autograd_meta(class std::unique_ptr<struct c10::AutogradMetaInterface,struct std::default_delete<struct c10::AutogradMetaInterface> >)" (__imp_?set_autograd_meta@TensorImpl@c10@@QEAAXV?$unique_ptr@UAutogradMetaInterface@c10@@U?$default_delete@UAutogradMetaInterface@c10@@@std@@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::MessageLogger::~MessageLogger(void)" (__imp_??1MessageLogger@c10@@QEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::MessageLogger::MessageLogger(char const *,int,int)" (__imp_??0MessageLogger@c10@@QEAA@PEBDHH@Z)
1>Source.obj : error LNK2001: unresolved external symbol "private: void __cdecl c10::ivalue::Object::resizeObject(unsigned __int64)" (?resizeObject@Object@ivalue@c10@@AEAAX_K@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: static struct c10::UndefinedTensorImpl c10::UndefinedTensorImpl::_singleton" (__imp_?_singleton@UndefinedTensorImpl@c10@@0U12@A)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::Error::Error(struct c10::SourceLocation,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (__imp_??0Error@c10@@QEAA@USourceLocation@1@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl torch::autograd::AutogradMeta::~AutogradMeta(void)" (__imp_??1AutogradMeta@autograd@torch@@UEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl torch::autograd::AutogradMeta::AutogradMeta(struct c10::TensorImpl *,bool,struct torch::autograd::Edge)" (__imp_??0AutogradMeta@autograd@torch@@QEAA@PEAUTensorImpl@c10@@_NUEdge@12@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual class at::Tensor const & __cdecl torch::autograd::AutogradMeta::grad(void)const " (__imp_?grad@AutogradMeta@autograd@torch@@UEBAAEBVTensor@at@@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual class at::Tensor & __cdecl torch::autograd::AutogradMeta::mutable_grad(void)" (__imp_?mutable_grad@AutogradMeta@autograd@torch@@UEAAAEAVTensor@at@@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual bool __cdecl torch::autograd::AutogradMeta::requires_grad(void)const " (__imp_?requires_grad@AutogradMeta@autograd@torch@@UEBA_NXZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void __cdecl torch::autograd::AutogradMeta::set_requires_grad(bool,struct c10::TensorImpl *)" (__imp_?set_requires_grad@AutogradMeta@autograd@torch@@UEAAX_NPEAUTensorImpl@c10@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct c10::StrongTypePtr & __cdecl c10::StrongTypePtr::operator=(struct c10::StrongTypePtr &&)" (__imp_??4StrongTypePtr@c10@@QEAAAEAU01@$$QEAU01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct c10::StrongTypePtr & __cdecl c10::StrongTypePtr::operator=(struct c10::StrongTypePtr const &)" (__imp_??4StrongTypePtr@c10@@QEAAAEAU01@AEBU01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::StrongTypePtr::~StrongTypePtr(void)" (__imp_??1StrongTypePtr@c10@@QEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::StrongTypePtr::StrongTypePtr(struct c10::StrongTypePtr &&)" (__imp_??0StrongTypePtr@c10@@QEAA@$$QEAU01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::StrongTypePtr::StrongTypePtr(struct c10::StrongTypePtr const &)" (__imp_??0StrongTypePtr@c10@@QEAA@AEBU01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::IValue::IValue(void)" (__imp_??0IValue@c10@@QEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct c10::IValue & __cdecl c10::IValue::operator=(struct c10::IValue const &)& " (__imp_??4IValue@c10@@QEGAAAEAU01@AEBU01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct c10::IValue & __cdecl c10::IValue::operator=(struct c10::IValue &&)& " (__imp_??4IValue@c10@@QEGAAAEAU01@$$QEAU01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::IValue::~IValue(void)" (__imp_??1IValue@c10@@QEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::IValue::IValue(struct c10::IValue &&)" (__imp_??0IValue@c10@@QEAA@$$QEAU01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::IValue::IValue(struct c10::IValue const &)" (__imp_??0IValue@c10@@QEAA@AEBU01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl at::AutoNonVariableTypeMode::~AutoNonVariableTypeMode(void)" (__imp_??1AutoNonVariableTypeMode@at@@QEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl at::AutoNonVariableTypeMode::AutoNonVariableTypeMode(bool)" (__imp_??0AutoNonVariableTypeMode@at@@QEAA@_N@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl at::Tensor::Tensor(class at::Tensor &&)" (__imp_??0Tensor@at@@QEAA@$$QEAV01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl at::Tensor::~Tensor(void)" (__imp_??1Tensor@at@@QEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __cdecl at::Tensor::defined(void)const " (__imp_?defined@Tensor@at@@QEBA_NXZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class c10::intrusive_ptr<struct c10::TensorImpl,struct c10::UndefinedTensorImpl> const & __cdecl at::Tensor::getIntrusivePtr(void)const " (__imp_?getIntrusivePtr@Tensor@at@@QEBAAEBV?$intrusive_ptr@UTensorImpl@c10@@UUndefinedTensorImpl@2@@c10@@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl at::Tensor::Tensor(class c10::intrusive_ptr<struct c10::TensorImpl,struct c10::UndefinedTensorImpl>)" (__imp_??0Tensor@at@@QEAA@V?$intrusive_ptr@UTensorImpl@c10@@UUndefinedTensorImpl@2@@c10@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl at::Tensor::Tensor(void)" (__imp_??0Tensor@at@@QEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static struct c10::TensorImpl * __cdecl c10::UndefinedTensorImpl::singleton(void)" (__imp_?singleton@UndefinedTensorImpl@c10@@SAPEAUTensorImpl@2@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::VariableVersion::~VariableVersion(void)" (__imp_??1VariableVersion@c10@@QEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl c10::TensorImpl::set_allow_tensor_metadata_change(bool)" (__imp_?set_allow_tensor_metadata_change@TensorImpl@c10@@QEAAX_N@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __cdecl c10::TensorImpl::unique_version(void)const " (__imp_?unique_version@TensorImpl@c10@@QEBA_NXZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::VariableVersion::VariableVersion(unsigned int)" (__imp_??0VariableVersion@c10@@QEAA@I@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > & __cdecl c10::MessageLogger::stream(void)" (__imp_?stream@MessageLogger@c10@@QEAAAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: void __cdecl c10::TensorOptions::set_device(class c10::optional<struct c10::Device>)& " (__imp_?set_device@TensorOptions@c10@@AEGAAXV?$optional@UDevice@c10@@@2@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __cdecl c10::TensorOptions::requires_grad(void)const " (__imp_?requires_grad@TensorOptions@c10@@QEBA_NXZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct c10::TensorOptions __cdecl c10::TensorOptions::requires_grad(class c10::optional<bool>)const " (__imp_?requires_grad@TensorOptions@c10@@QEBA?AU12@V?$optional@_N@2@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::TensorOptions::TensorOptions(void)" (__imp_??0TensorOptions@c10@@QEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: virtual void __cdecl c10::intrusive_ptr_target::release_resources(void)" (__imp_?release_resources@intrusive_ptr_target@c10@@EEAAXXZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: class c10::intrusive_ptr_target & __cdecl c10::intrusive_ptr_target::operator=(class c10::intrusive_ptr_target const &)" (__imp_??4intrusive_ptr_target@c10@@IEAAAEAV01@AEBV01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: __cdecl c10::intrusive_ptr_target::intrusive_ptr_target(class c10::intrusive_ptr_target const &)" (__imp_??0intrusive_ptr_target@c10@@IEAA@AEBV01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: class c10::intrusive_ptr_target & __cdecl c10::intrusive_ptr_target::operator=(class c10::intrusive_ptr_target &&)" (__imp_??4intrusive_ptr_target@c10@@IEAAAEAV01@$$QEAV01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: __cdecl c10::intrusive_ptr_target::intrusive_ptr_target(class c10::intrusive_ptr_target &&)" (__imp_??0intrusive_ptr_target@c10@@IEAA@$$QEAV01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: __cdecl c10::intrusive_ptr_target::intrusive_ptr_target(void)" (__imp_??0intrusive_ptr_target@c10@@IEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: virtual __cdecl c10::intrusive_ptr_target::~intrusive_ptr_target(void)" (__imp_??1intrusive_ptr_target@c10@@MEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::Scalar::Scalar(int)" (__imp_??0Scalar@c10@@QEAA@H@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::Error::Error(class c10::Error const &)" (__imp_??0Error@c10@@QEAA@AEBV01@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl c10::Error::~Error(void)" (__imp_??1Error@c10@@UEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl c10::Device::Device(enum c10::DeviceType,short)" (__imp_??0Device@c10@@QEAA@W4DeviceType@1@F@Z)
1>D:\OneDrive\Work\Development\TorchTest\x64\Release\TorchTest.exe : fatal error LNK1120: 56 unresolved externals

My environment is
Win10
Visual Studio 2019 Community (x64 Release)
Pytorch 1.7
CUDA 10.2
Thanks