-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Description
🐛 Bug
Large number of link errors when trying rebuild an existing program with the new 1.5 version of Libtorch on Windows
To Reproduce
Steps to reproduce the behavior:
- Create a following program
#include <torch/torch.h>
int main(int argc, char** argv) {
torch::Tensor x_t;
}
- Try to build it. The compilation is successful, the link fails with messages like
LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl at::Tensor::Tensor(void)" (_imp??0Tensor@at@@qeaa@XZ) referenced in function main Pytorch15 C:\progs\c++\CTorch\Pytorch15\test.obj 1
Environment
Windows 10, Visual Studio 2019, toolset either v141 or v142, the linker options:
/OUT:"C:\progs\c++\CTorch\x64\Debug\Pytorch15.exe" /MANIFEST /NXCOMPAT /PDB:"C:\progs\c++\CTorch\x64\Debug\Pytorch15.pdb" /DYNAMICBASE "torch.lib" "c10.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X64 /INCREMENTAL /PGD:"C:\progs\c++\CTorch\x64\Debug\Pytorch15.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Debug\Pytorch15.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"C:\progs2\libtorch_debug\lib" /TLBID:1
The program builds and works when liked with libtorch 1.4.