liniking in macOS to precompiled libraries ERROR
Solved
General and Desktop
-
Hi everyone.
The thing is I have a Qt library that links to precompiled OpenCV libraries in macOS.
But the linker returns the error
FAILED: QrDec/libQrDec.dylib : && /usr/bin/clang++ -O3 -DNDEBUG -isysroot /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -mmacosx-version-min=11.0 -dynamiclib -Wl,-headerpad_max_install_names -o QrDec/libQrDec.dylib -install_name @rpath/libQrDec.dylib QrDec/CMakeFiles/QrDec.dir/qrcodedec.cpp.o _deps/opencv-src/lib/libopencv_gapi.so.4.8.0 _deps/opencv-src/lib/libopencv_highgui.so.4.8.0 _deps/opencv-src/lib/libopencv_ml.so.4.8.0 _deps/opencv-src/lib/libopencv_objdetect.so.4.8.0 _deps/opencv-src/lib/libopencv_photo.so.4.8.0 _deps/opencv-src/lib/libopencv_stitching.so.4.8.0 _deps/opencv-src/lib/libopencv_video.so.4.8.0 _deps/opencv-src/lib/libopencv_videoio.so.4.8.0 _deps/opencv-src/lib/libopencv_imgcodecs.so.4.8.0 _deps/opencv-src/lib/libopencv_dnn.so.4.8.0 _deps/opencv-src/lib/libopencv_calib3d.so.4.8.0 _deps/opencv-src/lib/libopencv_features2d.so.4.8.0 _deps/opencv-src/lib/libopencv_flann.so.4.8.0 _deps/opencv-src/lib/libopencv_imgproc.so.4.8.0 _deps/opencv-src/lib/libopencv_core.so.4.8.0 && : ld: warning: ignoring file _deps/opencv-src/lib/libopencv_highgui.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_gapi.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_ml.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_objdetect.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_photo.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_stitching.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_video.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_videoio.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_imgcodecs.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_calib3d.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_features2d.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_dnn.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_flann.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_core.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file _deps/opencv-src/lib/libopencv_imgproc.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) Undefined symbols for architecture x86_64: "cv::QRCodeDetector::QRCodeDetector()", referenced from: qrcodedec::decode_grey(unsigned char*, int, int) in qrcodedec.cpp.o "cv::Mat::Mat(int, int, int, void*, unsigned long)", referenced from: qrcodedec::decode_grey(unsigned char*, int, int) in qrcodedec.cpp.o "cv::Mat::~Mat()", referenced from: qrcodedec::decode_grey(unsigned char*, int, int) in qrcodedec.cpp.o "cv::noArray()", referenced from: qrcodedec::decode_grey(unsigned char*, int, int) in qrcodedec.cpp.o "cv::GraphicalCodeDetector::detectAndDecode(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&) const", referenced from: qrcodedec::decode_grey(unsigned char*, int, int) in qrcodedec.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) [64/119] Building CXX object QrGen/CMakeFiles/QrGen.dir/src/qrcodegen.cpp.o [65/119] Building CXX object _deps/mydesigns-build/CMakeFiles/MyDesigns.dir/MyDesigns_autogen/mocs_compilation.cpp.o [66/119] Building CXX object _deps/mydesigns-build/CMakeFiles/MyDesigns.dir/src/mydesigns.cpp.o [67/119] Building CXX object _deps/mydesigns-build/CMakeFiles/MyDesigns.dir/mydesigns_qmltyperegistrations.cpp.o ninja: build stopped: subcommand failed. Error: Process completed with exit code 1.
I really do not know what is Xcode or the compiler used in MacOS.
However, it seems I am not using the same compilers or SDK when building OpenCV as when building my Qt library.
When configuring my Qt library I use qt-cmake tool, but maybe this sets some toolchain that is not set when using the normal cmake command to build OpenCV.Do you know what CMake variable I have to change to use the same SDK Qt uses when building OpenCV?
Many thanks for your time.
-
M Mesrine has marked this topic as solved on