gocv
gocv copied to clipboard
Static build error on Windows
Description
Getting wechat qrcode error when using "go build -tags static", even though I am not using wechat qrcode in my project
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(wechat_qrcode.cpp.obj):wechat_qrcode.cpp:(.text$_ZNSt23_Sp_counted_ptr_inplaceIN2cv13wechat_qrcode10SuperScaleESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt23_Sp_counted_ptr_inplaceIN2cv13wechat_qrcode10SuperScaleESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x5): undefined reference to `cv::dnn::dnn4_v20220524::Net::~Net()'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(wechat_qrcode.cpp.obj):wechat_qrcode.cpp:(.text$_ZNSt23_Sp_counted_ptr_inplaceIN2cv13wechat_qrcode11SSDDetectorESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt23_Sp_counted_ptr_inplaceIN2cv13wechat_qrcode11SSDDetectorESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x5): undefined reference to `cv::dnn::dnn4_v20220524::Net::~Net()'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(wechat_qrcode.cpp.obj):wechat_qrcode.cpp:(.text$_ZN2cv13wechat_qrcode12WeChatQRCodeC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_S9_S9_+0xf6): undefined reference to `cv::dnn::dnn4_v20220524::Net::Net()'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(wechat_qrcode.cpp.obj):wechat_qrcode.cpp:(.text$_ZN2cv13wechat_qrcode12WeChatQRCodeC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_S9_S9_+0x2a2): undefined reference to `cv::dnn::dnn4_v20220524::Net::Net()'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(ssd_detector.cpp.obj):ssd_detector.cpp:(.text$_ZN2cv13wechat_qrcode11SSDDetector4initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_+0x14): undefined reference to `cv::dnn::dnn4_v20220524::readNetFromCaffe(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(ssd_detector.cpp.obj):ssd_detector.cpp:(.text$_ZN2cv13wechat_qrcode11SSDDetector4initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_+0x50): undefined reference to `cv::dnn::dnn4_v20220524::Net::~Net()'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(ssd_detector.cpp.obj):ssd_detector.cpp:(.text$_ZN2cv13wechat_qrcode11SSDDetector7forwardENS_3MatEii+0x173): undefined reference to `cv::dnn::dnn4_v20220524::blobFromImage(cv::_InputArray const&, cv::_OutputArray const&, double, cv::Size_<int> const&, cv::Scalar_<double> const&, bool, bool, int)'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(ssd_detector.cpp.obj):ssd_detector.cpp:(.text$_ZN2cv13wechat_qrcode11SSDDetector7forwardENS_3MatEii+0x1e4): undefined reference to `cv::dnn::dnn4_v20220524::Net::setInput(cv::_InputArray const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double, cv::Scalar_<double> const&)'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(ssd_detector.cpp.obj):ssd_detector.cpp:(.text$_ZN2cv13wechat_qrcode11SSDDetector7forwardENS_3MatEii+0x275): undefined reference to `cv::dnn::dnn4_v20220524::Net::forward(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(super_scale.cpp.obj):super_scale.cpp:(.text$_ZN2cv13wechat_qrcode10SuperScale4initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_+0x14): undefined reference to `cv::dnn::dnn4_v20220524::readNetFromCaffe(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(super_scale.cpp.obj):super_scale.cpp:(.text$_ZN2cv13wechat_qrcode10SuperScale4initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_+0x50): undefined reference to `cv::dnn::dnn4_v20220524::Net::~Net()'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(super_scale.cpp.obj):super_scale.cpp:(.text$_ZN2cv13wechat_qrcode10SuperScale19superResoutionScaleERKNS_3MatERS2_+0xc2): undefined reference to `cv::dnn::dnn4_v20220524::blobFromImage(cv::_InputArray const&, cv::_OutputArray const&, double, cv::Size_<int> const&, cv::Scalar_<double> const&, bool, bool, int)'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(super_scale.cpp.obj):super_scale.cpp:(.text$_ZN2cv13wechat_qrcode10SuperScale19superResoutionScaleERKNS_3MatERS2_+0x127): undefined reference to `cv::dnn::dnn4_v20220524::Net::setInput(cv::_InputArray const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double, cv::Scalar_<double> const&)'
C:/opencv/build/install/x64/mingw/staticlib/libopencv_wechat_qrcode460.a(super_scale.cpp.obj):super_scale.cpp:(.text$_ZN2cv13wechat_qrcode10SuperScale19superResoutionScaleERKNS_3MatERS2_+0x16b): undefined reference to `cv::dnn::dnn4_v20220524::Net::forward(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2.exe: error: ld returned 1 exit status
Steps to Reproduce
- fresh openCV 4.6.0 build with "win_build_opencv.cmd static"
- run "go build -tags static" to create static go binary
- the above error occurs and build fails
If I remove wechat_qrcode* files in the contrib folder, then it can build successfully.
Your Environment
- Operating System and version: Windows 10 21H1
- OpenCV version used: 4.6.0
- How did you install OpenCV? win_build_opencv.cmd static
- GoCV version used: 0.31.0
- Go version: 1.18.3
- Did you run the
env.sh
orenv.cmd
script before trying togo run
orgo build
? No, as it has been deprecated