pkg-config and cross compiling

Erik de Castro Lopo mle+tools at
Sun Mar 23 18:28:30 PDT 2008

Tollef Fog Heen wrote:

> Two options:
> - Set PKG_CONFIG_SYSROOT_DIR to /usr/i586-mingw32msvc  (you need to
>   pull pkg-config from bzr for this to work correctly; there is a bug
>   in 0.23 and I haven't yet gotten around to releasing 0.24).
> - Compile a pkg-config where you pass --with-pc-path to configure
>   pointing that to /usr/i586-mingw32msvc/lib and set PKG_CONFIG in
>   your build environment.

This would just replace my wrapper script with a binary which is not
really a better solution :-).
> Another option would be to have --host/--target support added to
> pkg.m4 and the have a pkg-config with your paths compiled in located
> in /usr/i586-mingw32msvc/bin.

Hmm, I'm not sure this is really the solution either.

What I am suggesting is a single pkg-config binary which works
for both native compiles like it does now, but also work for
cross compiling using a --host argument (in my current case

Give the --host argument, pkg-config would then override both
PKG_CONFIG_LIBDIR and the users own PKG_CONFIG_PATH variable.

I've also just found this:

However, thinking about this some more, I'm beginning to think
that my wrapper script is actually a better solution.

Erik de Castro Lopo
"Every time you get a windows programmer asking you to write some
ass-backward workaround, think of it as a crack junkie asking you
to help stuff his pipe because his hands are too shaky."
-- Conrad Parker

More information about the pkg-config mailing list