Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link error with roi_align and nms with Visual Studio 2017 #51

Open
hubtub2 opened this issue Jun 25, 2019 · 6 comments
Open

Link error with roi_align and nms with Visual Studio 2017 #51

hubtub2 opened this issue Jun 25, 2019 · 6 comments

Comments

@hubtub2
Copy link

hubtub2 commented Jun 25, 2019

When calling build.py for "roi_align", I am getting the following link error with Visual Studio 2017.
I am not sure why, TH.h contains only template definitions, so there shouldn't be any library dependency right? Same problem with nms.

Creating library .\Release\_crop_and_resize.lib and object .\Release\_crop_and_resize.exp LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library crop_and_resize.obj : error LNK2001: unresolved external symbol __imp_THFloatTensor_zero crop_and_resize.obj : error LNK2001: unresolved external symbol __imp_THFloatTensor_data crop_and_resize.obj : error LNK2001: unresolved external symbol __imp_THFloatTensor_resize4d crop_and_resize.obj : error LNK2001: unresolved external symbol __imp_THFloatTensor_size [....]

The linker call is:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/lib/x64" "/LIBPATH:C:\Program Files\NVIDIA Corporation\NvToolsExt\/lib/x64" /LIBPATH:D:\stewun\mdf\medicaldetectiontoolkit\venv\lib\site-packages\torch\utils\ffi\..\..\lib /LIBPATH:D:\stewun\mdf\medicaldetectiontoolkit\venv\libs /LIBPATH:D:\stewun\WinPython3.6.5\python-3.6.5.amd64\libs /LIBPATH:D:\stewun\WinPython3.6.5\python-3.6.5.amd64 /LIBPATH:D:\stewun\mdf\medicaldetectiontoolkit\venv\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" /EXPORT:PyInit__crop_and_resize .\Release\_crop_and_resize.obj .\Release\stewun\mdf\medicaldetectiontoolkit\cuda_functions\roi_align_3D\roi_align\src\crop_and_resize.obj .\Release\stewun\mdf\medicaldetectiontoolkit\cuda_functions\roi_align_3D\roi_align\src\crop_and_resize_gpu.obj D:\stewun\mdf\medicaldetectiontoolkit\cuda_functions\roi_align_3D\roi_align\src/cuda/crop_and_resize_kernel.cu.o /OUT:.\_crop_and_resize.pyd /IMPLIB:.\Release\_crop_and_resize.lib

@hubtub2
Copy link
Author

hubtub2 commented Jun 27, 2019

Also tried with MSVC tools 14.10.25017. Same result.

@hubtub2
Copy link
Author

hubtub2 commented Jun 28, 2019

I think the problem is, that the linker does not link the torch core libraries: libTHC.lib & libTH.lib (see https://pytorch.org/blog/a-tour-of-pytorch-internals-2/)

For some reason, those libraries are not installed in venv\Lib\site-packages\torch\lib and I am not sure why.

I used:
pip install http:https://download.pytorch.org/whl/cu90/torch-0.4.1-cp36-cp36m-win_amd64.whl
So nothing special here.

@hubtub2
Copy link
Author

hubtub2 commented Jun 28, 2019

It looks like extension support for Windows is generally experimental:
https://pytorch.org/docs/stable/notes/windows.html#extension

I also see a lot of 'cp' in exp_utils.py.
Has anybody used MDF on Windows yet? ;-)

@welkiny
Copy link

welkiny commented Jul 27, 2019

I have the same problem with you. How did you solve this link error?

@hubtub2
Copy link
Author

hubtub2 commented Jul 27, 2019

I switched to Linux, there it runs without major problems.
The real solution would be to port the code to the newest torch version., rewriting the C parts.

@hubtub2 hubtub2 changed the title Link error with roi_align and nms Link error with roi_align and nms with Visual Studio 2017 Jul 27, 2019
@WENJIANHUANG
Copy link

Yes, it did not work in windows. In Linux, it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants