pkg-config and cross compiling

Erik de Castro Lopo mle+tools at
Sun Mar 23 03:54:31 PDT 2008

Hi all,

I'm currently using the mingw32 tools (Linux to win32 cross compiler)
that are available on Debian. A lot of the stuff I'm compiling uses

As you know, when cross compiler, the autoconf generated configure
script looks for i586-mingw32msvc-pkg-config before trying pkg-config
so I have a bash script named i586-mingw32msvc-pkg-config which
contains the following:


    # This file has no copyright assigned and is placed in the Public Domain.
    # This file is a part of the mingw-runtime package.
    # No warranty is given.

    # When using the mingw32msvc cross compiler tools, the native Linux
    # pkg-config executable works fine as long as the default
    # PKG_CONFIG_LIBDIR is overridden.
    export PKG_CONFIG_LIBDIR=/usr/i586-mingw32msvc/lib/pkgconfig

    # Also want to override the standard user defined PKG_CONFIG_PATH with
    # a mingw defined one.

    # Now just execute pkg-config with give command line args.
    pkg-config $@

so that PKG_CONFIG_LIBDIR and PKG_CONFIG_PATH get set to MinGW specific
values. AFAIAC this works well.

The problem is that anyone who uses a lot of cross compilers will end
up with a bunch of XXXXX-pkg-config scripts which is just like the
problem the pkg-config was originally created to avoid.

Is there a better solution?

Erik de Castro Lopo
I have now spent two days debugging C# on dotnot and all I can say
is OMFG!!!! The MS tools are completely fucking abysmal. Its the
most developer hostile environment I've ever worked on. The fact
that people are actually able to release software that sort of
works using these tools completely boggles my mind.

More information about the pkg-config mailing list