[CMake] pkgconfig and cross compiling

Alexander Neundorf a.neundorf-work at gmx.net
Wed Nov 5 16:53:42 EST 2008


On Wednesday 05 November 2008, Alan W. Irwin wrote:
> On 2008-11-04 20:57+0100 Alexander Neundorf wrote:
> > On Tuesday 04 November 2008, Alan W. Irwin wrote:
> > ...
> >
> >> I don't get the behaviour you describe for my version of pkg-config
> >> (0.22-1).
> >>
> >> For that version of pkg-config, if I point PKG_CONFIG_LIBDIR to a
> >> directory then if the required *.pc file is not in that directory, then
> >> it gives an error message and quits, i.e., it finds nothing else
> >> regardless of how PKG_CONFIG_PATH is set. As you have stated that is the
> >> ideal behaviour for cross-compilation.
> >>
> >> I suspect the problem is you are using a really old version of
> >> pkg-config. There is a bug report at
> >> https://bugs.freedesktop.org/show_bug.cgi?id=3093 that describes the
> >> incorrect behaviour of PKG_CONFIG_LIBDIR that you see on your system. 
> >> That bug was fixed as of version pkg-config 0.18 (released in June
> >> 2005).
> >>
> >> So install a recent version of pkg-config, and I think your troubles
> >> with PKG_CONFIG_LIBDIR will be over.
> >
> > Hmm. Directly copied from my terminal:
> > hammer:~$ echo $PKG_CONFIG_PATH
> > /usr/local/lib/pkgconfig:/usr/lib/pkgconfig
> > hammer:~$ export PKG_CONFIG_LIBDIR=/tmp
> > hammer:~$ strace pkg-config alsa --variable=includedir 2> pkgconfig.log
> > /usr/include
> > hammer:~$ grep alsa.pc pkgconfig.log
> > open("/usr/lib/pkgconfig/alsa.pc", O_RDONLY) = 3
> > hammer:~$ pkg-config --version
> > 0.21
> > hammer:~$
> >
> > (there are no pc-files in /tmp)
>
> Thanks for that test.  I confirm your version of pkg-config is not the
> source of the problem. In fact, it turns out we got different results
> because I didn't test the case of putting /usr/lib/pkgconfig on
> PKG_CONFIG_PATH like you did.  If I do that, I confirm your result, but why
> do you need to inject a native path into pkg-config like that when
> cross-compiling?  Isn't that bound to lead to trouble?

I didn't do it, seems to be the default on Slackware 12.

Alex


More information about the CMake mailing list