I’m trying to submit an app that uses OpenCV. I’ve been trying with OF 0.9 Apothecary from GitHub and i can compile an emptyExample just fine but i get a bunch of linker errors when i add OpenCV.
I’ve added the libs in the "Build Phases -> Link Binary With Libraries” and the paths in “Linking -> Other Linker Paths”, but it makes no difference. Am i missing something? Is there another step i should be making? Or is it an issue with the OpenCV libraries not being compatible with 64bits?
ld: 64-bit LDR/STR not 8-byte aligned: from __ZN2cv7compareERKNS_11_InputArrayES2_RKNS_12_OutputArrayEi (0x100661428) to l173@0x0001E3D8 (0x100D3625C) in ‘__ZN2cv7compareERKNS_11_InputArrayES2_RKNS_12_OutputArrayEi’ from addons/ofxOpenCv/libs/opencv/lib/ios/opencv_core.a(arithm.cpp.o) for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This actually seems to hide the actual problem: the fact that your LLVM compiler may not choose a proper standard C++ library for compiling by default. You should go to
Project (or your Target) -> Build Settings -> Apple LLVM 6.0 - Language - C++ -> C++ Standard Library
and make sure that you pick libc++ as your choice, not just Compiler Default, since modern OpenCV library is linked against libc++. This will solve your problem without having to add the extra libc++.dylib. Including libc++.dylib framework as a workaround will not always work out if your Compiler Default actually does not choose libc++ library!
Hi. Just letting you know that everything is working with the version @danoli3 recommended (both the apothecary one and the new master branch).
I just added the ofxOpenCV source to my project, added the opencv include file to the header search path and then added all opencv libraries (the .a files) to the “link binary with libraries” in the build phases.
The template iOS project has the new settings by default. I think this is being an issue for those that created the project pre-merge from the older template and trying to apply it to the new updates.
Hey @danoli3 thanks so much for the hard work on getting a lot of the issues fixed for ios 64 bit compatibility. I’m having one issue when trying to compile an empty app generated from the project generator. I compiled all the libraries with apothecary as instructed here:
Undefined symbols for architecture armv7:
“OBJC_CLASS$_ALAssetsLibrary”, referenced from:
objc-class-ref in opencv_highgui.a(cap_ios_video_camera.mm.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
undefined symbols are usually a sign that you are using some library or framework but not linking to it, and in your case, it would appear to be the AssetsLibrary framework is used by Open CV. Searching the web with the error text: Undefined symbols for architecture armv7: "OBJCCLASS_$_ALAssetsLibrary"
offers more detail .