Undefined symbols for architecture armv7 but lipo -info shows ok - c++

I think you guys have seen this kind of errors before, but mine is special.
I have a few static libs in my Xcode project, when I tried to build it I got this error. But I have checked all my libs with command xcrun -sdk iphoneos lipo -info $libname, it gave me Architectures in the fat file: /Users/kiwi/Documents/Development/SourceCode/prj/lib.a are: armv7 i386 x86_64 arm64.
Undefined symbols for architecture armv7: "_SSLv2_server_method",
referenced from:
CSSLctx::Create(bool, CSSLctx::sslProtocol) in libudp.a(SSLStream.o) "_SSLv2_client_method", referenced from:
CSSLctx::Create(bool, CSSLctx::sslProtocol) in libudp.a(SSLStream.o) ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

Related

gnu ld (mac) not working, linker command fail with error code 1

I have the following problem with my ld.
$ ld
ld: warning: -arch not specified
ld: warning: -macosx_version_min not specified, assuming 10.9
ld: no object files specified for inferred architecture x86_64
What shall I do?
I got the following errors when I compile CUDD:
libmtr.a ../st/libst.a ../util/libutil.a ../epd/libepd.a -lm
Undefined symbols for architecture x86_64:
"_edata", referenced from:
_util_print_cpu_stats in libutil.a(cpu_stats.o)
"_end", referenced from:
_util_print_cpu_stats in libutil.a(cpu_stats.o)
"_etext", referenced from:
_util_print_cpu_stats in libutil.a(cpu_stats.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [nanotrav] Error 1
make: *** [build] Error 2
PS: I am using
$ xcodebuild -version
Xcode 7.1
Build version 7B91b
my ld is /usr/bin/ld.

Apple Mach-O linker error: Undefined symbols for architecture i386 Google Protobuf

I am trying to use Protobuf 2.6 with Xcode version 6.3. I've added the libprotobuf-lite.a to my Demo application and added the path to the Header files in the Header Search Paths., but I am getting this error.
Undefined symbols for architecture i386:
"google::protobuf::io::StringOutputStream::StringOutputStream(std::string*)",
referenced from:
attributes::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)
in attributes.pb.o ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

Installing Boost On Mac Issues

Has anyone had this issue on mac while installing boost or know how to fix? I seem to have everything together but this error. I am using OS X 10.10 & and Xcode 6.1.1.
This is what I used for the install and to make the framework.
http://freddy.cellcore.org/post/79587278354/boost-c-libraries-on-osx-xcode-5
https://gist.github.com/faithfracture/c629ae4c7168216a9856
-------------ERROR BELOW---------------
Undefined symbols for architecture x86_64:
"boost::unit_test::unit_test_main(bool (*)(), int, char**)", referenced from:
_main in test.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Linking OpenCV to XCode

I'm following this:
http://sadeepj.blogspot.com.br/2012/03/installing-and-configuring-opencv-to.html
I had a problem, compiling. But I already fixed it, modifying 2 files...
Now I'm trying to run that example.
And I get this error message:
Ld
/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug/DemoOpenCV2
normal x86_64
cd /Users/eduardoreis/Documents/XCodeDevelopment/DemoOpenCV2
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/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.8.sdk
-L/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug
-F/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug
-filelist /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Intermediates/DemoOpenCV2.build/Debug/DemoOpenCV2.build/Objects-normal/x86_64/DemoOpenCV2.LinkFileList
-mmacosx-version-min=10.8 -stdlib=libc++ -lopencv_core.2.4.6 -lopencv_highgui.2.4.6 -Xlinker -dependency_info -Xlinker /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Intermediates/DemoOpenCV2.build/Debug/DemoOpenCV2.build/Objects-normal/x86_64/DemoOpenCV2_dependency_info.dat
-o /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug/DemoOpenCV2
ld: library not found for -lopencv_core.2.4.6 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
I follows all steps already. And I can't even build it.
Please, help me.
[Before someone says that it is a duplicated post, I know it, here is the original one:
C++ linker errors with OpenCV.
I'm sorry. But I can't even comment on that one :/ ]
Wow, Finally solved:
Some considerations:
Realize that even it is looking for -l opencv_core.2.4.6, the
compiler will get the right file, if it is added correctly with other
name, in this case libopencv_core.2.4.dylib
I was adding the files with Project>Add files to... and then creating a group and dragging the files into the group. This was messing up the linkings in Project>Link Binary with Libraries. So I had to do it again by dragging the files in the group into that spot.
After theses things I had the situation where I had the two files (core and highgui) and 4 errors:
Ld
/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug/DemoOpenCV2
normal x86_64
cd /Users/eduardoreis/Documents/XCodeDevelopment/DemoOpenCV2
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/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.8.sdk
-L/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug
-L/Users/eduardoreis/Downloads/opencv-2.4.6.1/build/lib/Debug -L/usr/local/lib/python2.7/site-packages -L/usr/local/lib/python2.7/site-packages/PyQt4 -L/usr/local/lib/wine -L/usr/local/Cellar/wine/1.4.1/lib -L/usr/local/Cellar/qt/4.8.5/lib -L/usr/local/Cellar/qscintilla2/2.7.1/lib -L/usr/local/Cellar/libicns/0.8.1/lib -L/usr/local/Cellar/jasper/1.900.1/lib -L/usr/local/Cellar/jpeg/8d/lib -L/usr/local/Cellar/little-cms/1.19/lib -L/usr/local/Cellar/libpng/1.5.14/lib -L/usr/local/Cellar/libtiff/4.0.3/lib -F/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug
-F/usr/local/lib -filelist /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Intermediates/DemoOpenCV2.build/Debug/DemoOpenCV2.build/Objects-normal/x86_64/DemoOpenCV2.LinkFileList
-mmacosx-version-min=10.8 -stdlib=libc++ -lopencv_core.2.4 -lopencv_highgui.2.4 -Xlinker -dependency_info -Xlinker /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Intermediates/DemoOpenCV2.build/Debug/DemoOpenCV2.build/Objects-normal/x86_64/DemoOpenCV2_dependency_info.dat
-o /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug/DemoOpenCV2
Undefined symbols for architecture x86_64:
"cv::namedWindow(std::__1::basic_string, std::__1::allocator > const&,
int)", referenced from:
_main in main.o "cv::imread(std::__1::basic_string, std::__1::allocator > const&,
int)", referenced from:
_main in main.o "cv::imshow(std::__1::basic_string, std::__1::allocator > const&,
cv::_InputArray const&)", referenced from:
_main in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see
invocation)
Then (thanks God and some days of googling) I got this:
Select your project, go to the Build Settings tab, filter by c++
standard library, and set this parameter to libstdc++ (GNU C++
standard library).
from: Undefined symbols for architecture x86_64 error when linking OpenCV in Xcode
And finally it was sunny again in my code environment...

Apple Mach-O linker (ld) error using freenect library

When trying to compile the following file in xcode:
http://openkinect.org/wiki/C%2B%2BOpenCvExample
I get these errors:
Ld build/Debug/KinectOpenCV normal x86_64
cd "/Users/Scott/Dropbox/Project/KinectOpenCV/KinectOpenCV"
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Developer/usr/bin/clang++ -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk "-L/Users/Scott/Dropbox/Project/KinectOpenCV/KinectOpenCV/build/Debug" "-F/Users/Scott/Dropbox/Project/KinectOpenCV/KinectOpenCV/build/Debug" -filelist "/Users/Scott/Dropbox/Project/KinectOpenCV/KinectOpenCV/build/KinectOpenCV.build/Debug/KinectOpenCV.build/Objects-normal/x86_64/KinectOpenCV.LinkFileList" -mmacosx-version-min=10.7 -lopencv_core.2.3.2 -lopencv_highgui.2.3.2 -lfreenect.0.0.1 -framework GLUT -framework OpenGL -o "/Users/Scott/Dropbox/Project/KinectOpenCV/KinectOpenCV/build/Debug/KinectOpenCV"
Undefined symbols for architecture x86_64:
"_freenect_find_video_mode", referenced from:
freenect_threadfunc(void*) in main.o
"_freenect_set_video_mode", referenced from:
freenect_threadfunc(void*) in main.o
"_freenect_find_depth_mode", referenced from:
freenect_threadfunc(void*) in main.o
"_freenect_set_depth_mode", referenced from:
freenect_threadfunc(void*) in main.o
"_freenect_select_subdevices", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've been trying everything I can think off to resolve the issue but no joy. I've tried compiling for specific architectures (32 bit or 64), I've tried relinking all the libraries and other such measures like starting a new project and importing everything again.
Sounds like you need to rebuild libfreenect.
I'd suggest following the directions on this tutorial and once you have everything re-installed, run that nm test again and see if the symbols finally appear.
If they don't, grep through the library source and see if they are defined and simply conditionalized out for some reason.