orbbec / pyorbbecsdk

OrbbecSDK python binding
https://orbbec.github.io/pyorbbecsdk/
Apache License 2.0
67 stars 20 forks source link

Error compiling with MinGW64 on Windows10 #16

Open TDA-2030 opened 9 months ago

TDA-2030 commented 9 months ago

I used cmake to generate the MinGW Makefiles and then compile it, but there were many undefined symbols errors when linking the program, as shown in the log message below. Additionally, the provision of compiled .pyd file for testing purposes would be greatly appreciated.

cmake -G "MinGW Makefiles" -DCMAKE_PREFIX_PATH="D:\work\HNU-learning\py38env\Lib\site-packages\pybind11\share\cmake\pybind11" ..

-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: E:/SoftwarePackage/w64devkit/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: E:/SoftwarePackage/w64devkit/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python3: D:/work/HNU-learning/py38env/Scripts/python.exe (found version "3.8.9") found components: Interpreter Development Development.Module Development.Embed 
-- pybind11::lto disabled (problems with undefined symbols for MinGW for now)
-- pybind11::thin_lto disabled (problems with undefined symbols for MinGW for now)
-- Found pybind11: D:/work/HNU-learning/py38env/Lib/site-packages/pybind11/include (found version "2.11.1")
-- Configuring done (4.6s)
-- Generating done (0.0s)
-- Build files have been written to: D:/work/HNU-learning/pyorbbecsdk/build

make -j8
[  7%] Building CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/pyorbbecsdk.cpp.obj
[ 14%] Building CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/context.cpp.obj
[ 21%] Building CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/device.cpp.obj
[ 28%] Building CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/error.cpp.obj
[ 35%] Building CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/filter.cpp.obj
[ 42%] Building CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/frame.cpp.obj
[ 50%] Building CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/pipeline.cpp.obj
[ 57%] Building CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/properties.cpp.obj
[ 64%] Building CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/record_playback.cpp.obj
[ 71%] Building CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/sensor.cpp.obj
[ 78%] [ 85%] Building CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/stream_profile.cpp.objBuilding CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/types.cpp.obj

[ 92%] Building CXX object CMakeFiles/pyorbbecsdk.dir/src/pyorbbecsdk/utils.cpp.obj
[100%] Linking CXX shared library pyorbbecsdk.cp38-win_amd64.pyd
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(pyorbbecsdk.cpp.obj):pyorbbecsdk.cp:(.text+0xab8): undefined reference to `__imp__ZN2ob7Version8getMajorEv'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(pyorbbecsdk.cpp.obj):pyorbbecsdk.cp:(.text+0xac1): undefined reference to `__imp__ZN2ob7Version8getMinorEv'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(pyorbbecsdk.cpp.obj):pyorbbecsdk.cp:(.text+0xac9): undefined reference to `__imp__ZN2ob7Version8getPatchEv'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(pyorbbecsdk.cpp.obj):pyorbbecsdk.cp:(.text+0x1813): undefined reference to `__imp__ZN2ob7Version15getStageVersionEv'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(pyorbbecsdk.cpp.obj):pyorbbecsdk.cp:(.text+0x1832): undefined reference to `__imp__ZN2ob7Version15getStageVersionEv'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(context.cpp.obj):context.cpp:(.text+0xe98): undefined reference to `__imp__ZN2ob7Context17setLoggerSeverityE13OBLogSeverity'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(context.cpp.obj):context.cpp:(.text+0xf08): undefined reference to `__imp__ZN2ob7Context18setLoggerToConsoleE13OBLogSeverity'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(context.cpp.obj):context.cpp:(.text+0xf7b): undefined reference to `__imp__ZN2ob7Context15setLoggerToFileE13OBLogSeverityPKc'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(context.cpp.obj):context.cpp:(.text+0x1033): undefined reference to `__imp__ZN2ob7ContextC1EPKc'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(context.cpp.obj):context.cpp:(.text+0x1103): undefined reference to `__imp__ZN2ob7ContextC1EPKc'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(context.cpp.obj):context.cpp:(.text+0x11c4): undefined reference to `__imp__ZN2ob7Context15queryDeviceListEv'
......
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(stream_profile.cpp.obj):stream_profile:(.text$_ZZN8pybind1112cpp_function10initializeIZNS_6detail8initimpl11constructorIJRN2ob13StreamProfileEEE7executeINS_6class_INS5_17GyroStreamProfileEJS6_St10shared_ptrISB_EEEEJELi0EEEvRT_DpRKT0_EUlRNS2_16value_and_holderES7_E_vJSM_S7_EJNS_4nameENS_9is_methodENS_7siblingENS2_24is_new_style_constructorEEEEvOSF_PFT0_DpT1_EDpRKT2_ENUlRNS2_13function_callEE1_4_FUNES13_[_ZZN8pybind1112cpp_function10initializeIZNS_6detail8initimpl11constructorIJRN2ob13StreamProfileEEE7executeINS_6class_INS5_17GyroStreamProfileEJS6_St10shared_ptrISB_EEEEJELi0EEEvRT_DpRKT0_EUlRNS2_16value_and_holderES7_E_vJSM_S7_EJNS_4nameENS_9is_methodENS_7siblingENS2_24is_new_style_constructorEEEEvOSF_PFT0_DpT1_EDpRKT2_ENUlRNS2_13function_callEE1_4_FUNES13_]+0xb7): undefined reference to `__imp__ZN2ob17GyroStreamProfileC1ERNS_13StreamProfileE'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(stream_profile.cpp.obj):stream_profile:(.text$_ZZN8pybind1112cpp_function10initializeIZNS_6detail8initimpl11constructorIJRN2ob13StreamProfileEEE7executeINS_6class_INS5_18VideoStreamProfileEJS6_St10shared_ptrISB_EEEEJELi0EEEvRT_DpRKT0_EUlRNS2_16value_and_holderES7_E_vJSM_S7_EJNS_4nameENS_9is_methodENS_7siblingENS2_24is_new_style_constructorEEEEvOSF_PFT0_DpT1_EDpRKT2_ENUlRNS2_13function_callEE1_4_FUNES13_[_ZZN8pybind1112cpp_function10initializeIZNS_6detail8initimpl11constructorIJRN2ob13StreamProfileEEE7executeINS_6class_INS5_18VideoStreamProfileEJS6_St10shared_ptrISB_EEEEJELi0EEEvRT_DpRKT0_EUlRNS2_16value_and_holderES7_E_vJSM_S7_EJNS_4nameENS_9is_methodENS_7siblingENS2_24is_new_style_constructorEEEEvOSF_PFT0_DpT1_EDpRKT2_ENUlRNS2_13function_callEE1_4_FUNES13_]+0x76): undefined reference to `__imp__ZN2ob18VideoStreamProfileC1ERNS_13StreamProfileE'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(stream_profile.cpp.obj):stream_profile:(.text$_ZZN8pybind1112cpp_function10initializeIZNS_6detail8initimpl11constructorIJRN2ob13StreamProfileEEE7executeINS_6class_INS5_18VideoStreamProfileEJS6_St10shared_ptrISB_EEEEJELi0EEEvRT_DpRKT0_EUlRNS2_16value_and_holderES7_E_vJSM_S7_EJNS_4nameENS_9is_methodENS_7siblingENS2_24is_new_style_constructorEEEEvOSF_PFT0_DpT1_EDpRKT2_ENUlRNS2_13function_callEE1_4_FUNES13_[_ZZN8pybind1112cpp_function10initializeIZNS_6detail8initimpl11constructorIJRN2ob13StreamProfileEEE7executeINS_6class_INS5_18VideoStreamProfileEJS6_St10shared_ptrISB_EEEEJELi0EEEvRT_DpRKT0_EUlRNS2_16value_and_holderES7_E_vJSM_S7_EJNS_4nameENS_9is_methodENS_7siblingENS2_24is_new_style_constructorEEEEvOSF_PFT0_DpT1_EDpRKT2_ENUlRNS2_13function_callEE1_4_FUNES13_]+0xb7): undefined reference to `__imp__ZN2ob18VideoStreamProfileC1ERNS_13StreamProfileE'
E:\SoftwarePackage\w64devkit\bin/ld.exe: CMakeFiles\pyorbbecsdk.dir/objects.a(stream_profile.cpp.obj):stream_profile:(.text$_ZN8pybind116class_IN2ob17StreamProfileListEJSt10shared_ptrIS2_EEE13init_instanceEPNS_6detail8instanceEPKv[_ZN8pybind116class_IN2ob17StreamProfileListEJSt10shared_ptrIS2_EEE13init_instanceEPNS_6detail8instanceEPKv]+0x54d): undefined reference to `__imp__ZN2ob17StreamProfileListD1Ev'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [CMakeFiles\pyorbbecsdk.dir\build.make:304: pyorbbecsdk.cp38-win_amd64.pyd] Error 1
make[1]: *** [CMakeFiles\Makefile2:83: CMakeFiles/pyorbbecsdk.dir/all] Error 2
make: *** [Makefile:145: all] Error 2
woxuankai commented 5 months ago

Suffering from the same issue. Any updates?