1

I am getting this error when I try to link my application with ImageMagick++.

Undefined symbols for architecture x86_64:
"Magick::Image::read(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
...

I am using the latest OSX SDK (10.8)... and compiling to x86_64

My library was compiled this way:

./configure --disable-osx-universal-binary --without-perl --enable-shared --disable-static --without-pango --with-magick-plus-plus --with-quantum-depth=8

I added the library to the linker, but it's kind of ignoring the "-lMagick++-Q8"

I used "lipo -info" to double-check the architeture and it matched x86_64... so what else could it be?

here is the full linker command:

Ld /Users/MyUser/Library/Developer/Xcode/DerivedData/MyProject-cxtelbltlfqoftfcngpqxhiczxqs/Build/Products/Debug/libMyLib1.dylib normal x86_64
cd /Users/MyUser/Desktop/AllProject/Project1/MyLib1
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/MyUser/Library/Developer/Xcode/DerivedData/MyProject-cxtelbltlfqoftfcngpqxhiczxqs/Build/Products/Debug -L/usr/local/lib -L/opt/local/lib -L/Users/MyUser/Desktop/AllProject/Project1/MyLib1/../../../../Library/Developer/Xcode/DerivedData/MyProject-cxtelbltlfqoftfcngpqxhiczxqs/Build/Products/Debug -L/usr/local/Cellar/glfw/2.7.7/lib -L/usr/local/Cellar/glew/1.9.0/lib -L/usr/local/Cellar/freetype/2.4.11/lib -L/usr/local/Cellar/imagemagick/6.8.4/lib -L/usr/local/Cellar/jpeg/8d/lib -L/usr/local/Cellar/libpng/1.5.14/lib -L/usr/local/Cellar/libtool/2.4.2/lib -F/Users/MyUser/Library/Developer/Xcode/DerivedData/MyProject-cxtelbltlfqoftfcngpqxhiczxqs/Build/Products/Debug -filelist /Users/MyUser/Library/Developer/Xcode/DerivedData/MyProject-cxtelbltlfqoftfcngpqxhiczxqs/Build/Intermediates/MyLib1.build/Debug/MyLib1.build/Objects-normal/x86_64/MyLib1.LinkFileList -install_name /usr/local/lib/libMyLib1.dylib -mmacosx-version-min=10.8 -stdlib=libc++ -lstdc++ -liconv -lbz2 -lz -framework OpenGL -llib_json -lSFTools -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lpostproc -lGLEW.1.9 -lGLEW -lx264 -lGLEWmx.1.9 -lGLEWmx -lglfw -lpng15 -lpng15 -lfreetype -lfreetype -lltdl -ljpeg -lltdl -lMagick++-6.Q8 -lMagickCore-6.Q8 -lMagickWand-6.Q8 -lglfw -lswresample -lswscale -single_module -compatibility_version 1 -current_version 1 -o /Users/MyUser/Library/Developer/Xcode/DerivedData/MyProject-cxtelbltlfqoftfcngpqxhiczxqs/Build/Products/Debug/libMyLib1.dylib
Wagner Patriota
  • 5,494
  • 26
  • 49
  • What is the line you are linking with? – mmmmmm Apr 10 '13 at 13:32
  • 1
    clang++ -arch x86_64 -dynamiclib ... -L/folder/to/libs ... -stdlib=libc++ -lstdc++ -liconv ... -lMagick++-6.Q8 -lMagickCore-6.Q8 -lMagickWand-6.Q8 – Wagner Patriota Apr 10 '13 at 15:14
  • Please provide the *full* linker command, preferably in your question. – nwellnhof Apr 11 '13 at 16:43
  • done... I am also getting other link errors... with OpenMP [GOMP_xxx functions] and some STL functions... maybe I will open another post for these... it seems to be related to mix of C++11 with old C++ – Wagner Patriota Apr 12 '13 at 11:47
  • 1
    Any mixing of `libstdc++` and `libc++` in builds will cause trouble. All C++[11] code built with clang should set an environment variable: `CXX=clang++ -std=c++11 -stdlib=libc++`, or add `CXX="clang++ -std=c++11 -stdlib=libc++"` as an argument to `configure`. – Brett Hale Apr 12 '13 at 11:53
  • nice, it worked... I am only having probles like Undefined symbols for architecture x86_64: "_GOMP_barrier", referenced from: _SetResampleFilter in libMagickCore-6.Q8.a (magick_libMagickCore_6_Q8_la-resample.o) – Wagner Patriota Apr 12 '13 at 18:18

0 Answers0