Page 1 of 1

problem with pkg-config

Posted: 2012-03-15T00:52:15-07:00
by wsq003
I was trying to upgrade from 6.6.1 to ImageMagick-6.7.6-0
CFLAGS=-g -O2 -Wall -fPIC
./configure --prefix=`pwd`/imagemagick-6.7.6-0 --disable-shared --with-quantum-depth=8 --disable-openmp
make -j 10
make install

It compiles ok. Then I encounter problem:
./Magick++-config --libs
Package Magick++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `Magick++.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Magick++' found

It is ok with my previous 6.6.1 version.

What should I do? Is this a bug?



Then I try to manually add g++ parameters:
-pthread -L$PWD_PATH/imagemagick-6.7.6-0/lib -lMagickCore -ltiff -lfreetype -ljpeg -lpng12 -lfontconfig -lXext -lXt -lSM -lICE -lX11 -lbz2 -lz -lm -lpthread -lMagick++ -lMagickWand

It reports "undefined symbol: MagickCoreTerminus" when running.

Re: problem with pkg-config

Posted: 2012-03-15T04:30:14-07:00
by magick
Try setting the PKG_CONFIG_PATH to /usr/local/lib/pkgconfig.

Re: problem with pkg-config

Posted: 2012-03-16T04:33:23-07:00
by wsq003
Thank you, the pkg-config problem was solved after I add following to my build.sh:
PKG_CONFIG_PATH=`pwd`/libs/imagemagick-$IMK_VER/lib/pkgconfig
export PKG_CONFIG_PATH


It compiles ok now. But when I ran it, it reported:
undefined symbol: BZ2_bzDecompress

Then I tried to rebuild the imagemagick with --without-bzlib, then it reported:
undefined symbol: XConvertSelection

I am trying to build a apache_module.so that statically link with imagemagick. What should I do?
I found that someone said that I should recompile bzlib with -fPIC. This cann't be done, because I don't want to modify the system.
And I did not encounter this problem when I use v6.6.1. (v6.6.1 CAN statically link to apache_module.so, and runs well)

Re: problem with pkg-config

Posted: 2012-03-16T04:42:01-07:00
by magick
XConvertSelection() is defined in the X11 delegate library. Add --without-x to your configure command line and rebuild ImageMagick. You might type 'make clean' before your build.

Re: problem with pkg-config

Posted: 2012-03-16T05:04:08-07:00
by wsq003
magick wrote:XConvertSelection() is defined in the X11 delegate library. Add --without-x to your configure command line and rebuild ImageMagick. You might type 'make clean' before your build.
Thanks for your quick reply.

I recompile the imagemagick with "--without-bzlib --without-x", my module.so compiles ok. Now it reported running error:
undefined symbol: DrawPathStart

my gcc comand is:
g++ $CFLAGS --shared -o ./ap_module.so ./a.o ./b.o ./c.o -lml -ljson `$PWD_PATH/imagemagick-$IMK_VER/bin/Magick++-config --cppflags --cxxflags --ldflags --libs`

Then I added "-lMagickWand -lfreetype -lfontconfig" to my gcc command, and try argain, it reported:
undefined symbol: AnimateImages

Re: problem with pkg-config

Posted: 2012-03-16T05:35:56-07:00
by magick
AnimateImages() is defined in the X11 delegate library. You will need to remove the '--without-x' configure script option and perhaps add -lX11 to your linker command line.

Re: problem with pkg-config

Posted: 2012-03-16T05:50:18-07:00
by wsq003
magick wrote:AnimateImages() is defined in the X11 delegate library. You will need to remove the '--without-x' configure script option and perhaps add -lX11 to your linker command line.
I configured imagemagick with "--disable-shared --with-quantum-depth=8 --disable-openmp --without-bzlib"
Set CFLAGS="-g -O2 -Wall -fPIC" before make imagemagick.

The result of "Magick++-config --cppflags --cxxflags --ldflags --libs" is:
-I/home/om/trunk/libs/imagemagick-6.7.6-0/include/ImageMagick
-I/home/om/trunk/libs/imagemagick-6.7.6-0/include/ImageMagick
-L/home/om/trunk/libs/imagemagick-6.7.6-0/lib -lMagick++ -lMagickCore
-L/home/om/trunk/libs/imagemagick-6.7.6-0/lib -lMagick++ -lMagickCore

I compiled my ap_module.so with:
g++ $CFLAGS --shared -o ./ap_module.so ./a.o ./b.o ./c.o -lml -ljson `$PWD_PATH/imagemagick-$IMK_VER/bin/Magick++-config --cppflags --cxxflags --ldflags --libs` -ltiff -lfreetype -ljpeg -lpng12 -lfontconfig -lXext -lXt -lSM -lICE -lX11 -lbz2 -lz -lm -lpthread -lMagickWand

It reported running error:
undefined symbol: AnimateImages

Re: problem with pkg-config

Posted: 2012-03-16T06:07:15-07:00
by magick
AnimateImages() is part of the X11 code within ImageMagick. Did you type 'make clean' before you rebuild ImageMagick? Try again. AnimateImages() is part of MagickCore if it is built with X11 support.

Re: problem with pkg-config

Posted: 2012-03-16T06:10:01-07:00
by wsq003
magick wrote:AnimateImages() is part of the X11 code within ImageMagick. Did you type 'make clean' before you rebuild ImageMagick? Try again. AnimateImages() is part of MagickCore if it is built with X11 support.
More than that, I "rm -rf" the whole directory, "tar xjvf ImageMagick-$IMK_VER.tar.bz2" again, before recompile.

Can I directly add some xxx.o to my ap_module.so?