Apple Mach-O Linker (ld) Error Group , found many existing question with same tag, however none did fix my issue.
I am trying to include OpenCV with my project in order to track hand position. And so far everything works fine, however when I build the project. It gives the error : Apple Mach-O Linker (ld) Error Group
.
From the log here is what I obtained :
Ld /Users/shaheenakader/Library/Developer/Xcode/DerivedData/handSeg-fiojpqxgqvrsbxadwvnbdsljpycy/Build/Products/Debug/handSeg normal x86_64 cd /Users/shaheenakader/Documents/tracking export MACOSX_DEPLOYMENT_TARGET=10.9 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -L/Users/shaheenakader/Library/Developer/Xcode/DerivedData/handSeg-fiojpqxgqvrsbxadwvnbdsljpycy/Build/Products/Debug -L/usr/local/lib -F/Users/shaheenakader/Library/Developer/Xcode/DerivedData/handSeg-fiojpqxgqvrsbxadwvnbdsljpycy/Build/Products/Debug -filelist /Users/shaheenakader/Library/Developer/Xcode/DerivedData/handSeg-fiojpqxgqvrsbxadwvnbdsljpycy/Build/Intermediates/handSeg.build/Debug/handSeg.build/Objects-normal/x86_64/handSeg.LinkFileList -mmacosx-version-min=10.9 -Xlinker -object_path_lto -Xlinker /Users/shaheenakader/Library/Developer/Xcode/DerivedData/handSeg-fiojpqxgqvrsbxadwvnbdsljpycy/Build/Intermediates/handSeg.build/Debug/handSeg.build/Objects-normal/x86_64/handSeg_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -stdlib=libc++ -lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videoio -lopencv_videostab -lopencv_core.2.4.10 -lopencv_objdetect.2.4.10 -lopencv_highgui.2.4.10 -lopencv_imgproc.2.4.10 -Xlinker -dependency_info -Xlinker /Users/shaheenakader/Library/Developer/Xcode/DerivedData/handSeg-fiojpqxgqvrsbxadwvnbdsljpycy/Build/Intermediates/handSeg.build/Debug/handSeg.build/Objects-normal/x86_64/handSeg_dependency_info.dat -o /Users/shaheenakader/Library/Developer/Xcode/DerivedData/handSeg-fiojpqxgqvrsbxadwvnbdsljpycy/Build/Products/Debug/handSeg
Also,
ld: library not found for -lopencv_imgcodecs clang: error: linker command failed with exit code 1 (use -v to see invocation)
Previously
I manually built the OpenCV
library using Cmake
.
And inside my Xcode project, I set header search path to : /usr/local/include
and library search path to : /usr/local/lib
.
Also, set other linker flags to : -lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videoio -lopencv_videostab
What could possibly be causing this issue, and how to resolve this issue? Any help would be much appreciated.
opencv_imgcodecs
is in/usr/local/lib
? β Some programmer dude/usr/local/lib
, you should change that to the path where the libraries are. A side note, you can use CMake GUI to generate an Xcode project that can be opened and compiled in Xcode. β Quang Hoang