How to handle pkg-config emitting Unix-style paths on Windows?

Ryan Scott at
Mon Nov 9 12:19:16 PST 2015

I'm a Windows user attempting to build a Haskell package [1] that
depends on cairo by using pkg-config to detect it. This fails, though,
because pkg-config gives a Windows tool (ghc-pkg) some Unix-style
paths, which it fails to recognize (see [2] for the full error log).

The Unix-style paths come from fontconfig, a dependency of cairo:

    $ pkg-config --cflags fontconfig
    -mms-bitfields -IC:/msys64/mingw64/include/cairo
-IC:/msys64/mingw64/include/pixman-1 -IC:/msys64/mingw64/include
-I/mingw64/include/freetype2 -I/mingw64/include/libpng16
-I/mingw64/include/harfbuzz -I/mingw64/include/glib-2.0
-I/mingw64/lib/glib-2.0/include -IC:/msys64/mingw64/include
-IC:/msys64/mingw64/include/freetype2 -IC:/msys64/mingw64/include

Indeed, there are several paths of the form "-I/msys64/...", which
make sense to tools that are MSYS2-aware, but does not to general
Windows software (e.g., ghc-pkg). What's more, these particular paths
are all duplicates of other paths that have an
"-IC:/msys64/mingw64/..." prefix.

I've talked to an MSYS2 dev [3], and he believes that pkg-config
should be changed so that it does not output Unix-style paths. Can
this be done already by configuring pkg-config a certain way, or would
pkg-config need to be patched to do this?

Ryan S.

More information about the pkg-config mailing list