mmcv icon indicating copy to clipboard operation
mmcv copied to clipboard

windows build ext_ort.pyd has some errors

Open lqyp0420 opened this issue 3 years ago • 7 comments

LINK : error LNK2001: 无法解析的外部符号 PyInit__ext_ort E:\install_package\mmcv-1.3.13\build\temp.win-amd64-3.7\Release./mmcv/ops/csrc/onnxruntime/cpu_ext_ort.cp37-win_amd64.lib : fatal error LNK1120: 1 个无法解析的外部命令 error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\link.exe' failed with exit status 1120

win10 python3.7 torch 1.9

lqyp0420 avatar Oct 07 '21 16:10 lqyp0420

Hi Could you provide more detail about how do you build the extension? You can also use tools like dumpbin.exe to search the generated libs to see if there are any symbols about _ext_ort.

grimoire avatar Oct 08 '21 03:10 grimoire

Hi Could you provide more detail about how do you build the extension? You can also use tools like dumpbin.exe to search the generated libs to see if there are any symbols about _ext_ort.

I just fllow the install doc set ONNXRUNTIME_DIR=onnxruntime-win-x64-1.8.1 MMCV_WITH_ORT = 1 then python setup.py build_ext. the lib file is not been created my env: win10 python3.7 torch1.9 vs2019 onnxruntime_cpu_1.8.1

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:J:\install_package\onnxruntime-win-x64-1.8.1\lib /LIBPATH:C:\Anaconda3\lib\site-packages\torch\lib "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\lib/x64" /LIBPATH:C:\Anaconda3\libs /LIBPATH:C:\Anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\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" "/LIBPATH:C:\Program Files\IBM\WebSphere MQ\tools\lib64" "/LIBPATH:C:\Program Files\IBM\WebSphere MQ\tools\lib" onnxruntime.lib /EXPORT:PyInit_ext_ort J:\install_package\mmcv-1.3.13\build\temp.win-amd64-3.7\Release./mmcv/ops/csrc/onnxruntime/cpu\corner_pool.obj J:\install_package\mmcv-1.3.13\build\temp.win-amd64-3.7\Release./mmcv/ops/csrc/onnxruntime/cpu\gridSample.obj J:\install_package\mmcv-1.3.13\build\temp.win-amd64-3.7\Release./mmcv/ops/csrc/onnxruntime/cpu\modulated_deform_conv.obj J:\install_package\mmcv-1.3.13\build\temp.win-amd64-3.7\Release./mmcv/ops/csrc/onnxruntime/cpu\nms.obj J:\install_package\mmcv-1.3.13\build\temp.win-amd64-3.7\Release./mmcv/ops/csrc/onnxruntime/cpu\onnxruntime_register.obj J:\install_package\mmcv-1.3.13\build\temp.win-amd64-3.7\Release./mmcv/ops/csrc/onnxruntime/cpu\reduce_ops.obj J:\install_package\mmcv-1.3.13\build\temp.win-amd64-3.7\Release./mmcv/ops/csrc/onnxruntime/cpu\roi_align.obj J:\install_package\mmcv-1.3.13\build\temp.win-amd64-3.7\Release./mmcv/ops/csrc/onnxruntime/cpu\roi_align_rotated.obj J:\install_package\mmcv-1.3.13\build\temp.win-amd64-3.7\Release./mmcv/ops/csrc/onnxruntime/cpu\soft_nms.obj /OUT:build\lib.win-amd64-3.7\mmcv\ext_ort.cp37-win_amd64.pyd /IMPLIB:J:\install_package\mmcv-1.3.13\build\temp.win-amd64-3.7\Release./mmcv/ops/csrc/onnxruntime/cpu\ext_ort.cp37-win_amd64.lib LINK : error LNK2001: 无法解析的外部符号 PyInit_ext_ort J:\install_package\mmcv-1.3.13\build\temp.win-amd64-3.7\Release./mmcv/ops/csrc/onnxruntime/cpu\ext_ort.cp37-win_amd64.lib : fatal error LNK1120: 1 个无法解析的外部命令 error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\link.exe' failed with exit status 1120

lqyp0420 avatar Oct 08 '21 04:10 lqyp0420

Errr, as the missing symbol is related to python, you can try compiling the extension by yourself (not the python setuputil). The code is in mmcv/ops/csrc/onnxruntime.

grimoire avatar Oct 08 '21 12:10 grimoire

Errr, as the missing symbol is related to python, you can try compiling the extension by yourself (not the python setuputil). The code is in mmcv/ops/csrc/onnxruntime.

OK. I will try use cmake to create a dll file. thank for your suggestion

lqyp0420 avatar Oct 08 '21 15:10 lqyp0420

@grimoire The same problem.

In my cases, mmcv can be compiled with MMCV_WITH_OPS = 1 successfully, and it can generate _ext.cp37-win_amd64.pyd file.

However, mmcv cannot be compiled with MMCV_WITH_ORT = 1, so it may not be a problem caused by Python. It may be caused by the setup.py which can not deal with the Windows platform well.

I am a beginner in this field. Can you provide any suggestions about how to compile this extension? I would appreciate any help.😄

gasharper avatar Dec 11 '21 13:12 gasharper

same error.

2019-GitHub-Chu avatar Jan 24 '22 08:01 2019-GitHub-Chu

same error, confused

echoodqq avatar Jun 04 '22 13:06 echoodqq