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

Ryan Scott ryan.gl.scott at gmail.com
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
-IC:/msys64/mingw64/include/harfbuzz
-IC:/msys64/mingw64/include/glib-2.0
-IC:/msys64/mingw64/lib/glib-2.0/include
-IC:/msys64/mingw64/include/libpng16

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.
-----
[1] http://hackage.haskell.org/package/cairo
[2] https://github.com/gtk2hs/gtk2hs/issues/139
[3] https://github.com/Alexpux/MINGW-packages/issues/872


More information about the pkg-config mailing list