On Mac Lion I have done a configure, make and install a static version of ImageMagick. All went fine and as result of configure I get
configuring ImageMagick 6.7.2-4 checking build system type... x86_64-apple-darwin11.1.0 checking host system type... x86_64-apple-darwin11.1.0 checking target system type... x86_64-apple-darwin11.1.0 ....
But when I am trying to use the static library in my own application, the linker send me hundreds of link error such as...
Undefined symbols for architecture x86_64: "_XOpenDisplay", referenced from: _RenderType in libMagickCore.a(magick_libMagickCore_la-annotate.o) _DisplayImages in libMagickCore.a(magick_libMagickCore_la-display.o) ... "_XInitImage", referenced from: _ReadXWDImage in libMagickCore.a(magic开发者_开发百科k_libMagickCore_la-xwd.o) ld: symbol(s) not found for architecture x86_64
Here is my LIBS declaration
LIBS += -L/Library/ImageMagick-6.7.2-4/magick/.libs \ -L/Library/ImageMagick-6.7.2-4/magick \ -L/Library/ImageMagick-6.7.2-4/wand/.libs \ -L/Library/ImageMagick-6.7.2-4/wand \ -L/usr/X11/lib \ -R/usr/X11/lib \ -L/opt/local/lib \ -L/opt/lib \ -lMagick++ \ -lMagickCore \ -lMagickWand \ -ltiff \ -lfreetype \ -ljpeg \ -ljasper -lpng14 -lbz2 -lz -lm -lpthread
I am not really sure what is going wrong or what is missing.
This is a compile problem as XOpenDisplay
is apart of X
. Simply include the library -lX11
in your LIBS declaration.
LIBS += -L/Library/ImageMagick-6.7.2-4/magick/.libs \
-L/Library/ImageMagick-6.7.2-4/magick \
-L/Library/ImageMagick-6.7.2-4/wand/.libs \
-L/Library/ImageMagick-6.7.2-4/wand \
-L/usr/X11/lib \
-R/usr/X11/lib \
-L/opt/local/lib \
-L/opt/lib \
-lX11 \
-lMagick++ \
-lMagickCore \
-lMagickWand \
-ltiff \
-lfreetype \
-ljpeg \
-ljasper -lpng14 -lbz2 -lz -lm -lpthread
精彩评论