problem with pkg-config

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
wsq003
Posts: 7
Joined: 2012-02-16T00:29:20-07:00
Authentication code: 8675308

problem with pkg-config

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: problem with pkg-config

Post by magick »

Try setting the PKG_CONFIG_PATH to /usr/local/lib/pkgconfig.
wsq003
Posts: 7
Joined: 2012-02-16T00:29:20-07:00
Authentication code: 8675308

Re: problem with pkg-config

Post 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)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: problem with pkg-config

Post 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.
wsq003
Posts: 7
Joined: 2012-02-16T00:29:20-07:00
Authentication code: 8675308

Re: problem with pkg-config

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: problem with pkg-config

Post 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.
wsq003
Posts: 7
Joined: 2012-02-16T00:29:20-07:00
Authentication code: 8675308

Re: problem with pkg-config

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: problem with pkg-config

Post 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.
wsq003
Posts: 7
Joined: 2012-02-16T00:29:20-07:00
Authentication code: 8675308

Re: problem with pkg-config

Post 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?
Post Reply