What is the best way to install pkg-config on Mingw in 2014?

Felix Rabe picture Felix Rabe · Oct 19, 2014 · Viewed 22.3k times · Source

What is a good way at this moment (October 2014) to install pkg-config on Windows in a (no HTTPS) MinGW / MinGW-w64 environment? (See also this question from 2009.)

If there is a binary package that does not pull in GTK+, that would be great, but I haven't found one. Building from source is fine if that's the way to go.

On the Mingw FAQ it says: (This is from 2009 the latest, judging from a comment at the bottom of the page.)

How do I get pkg-config installed?

The difficulty in getting pkg-config installed is due its circular depency on glib. To install pkg-config, you should first install the GTK-runtime, the installer is found at (dead link) https://sourceforge.net/project/showfiles.php?group_id=121075. The pkg-config binary can be obtained from (new link, but does not mention pkg-config) https://www.gtk.org/download/windows.php. Place pkg-config.exe in your MinGW bin directory.

There are other pkg-config projects that don't have the circular dependency issue. They include:

I've quickly looked at pkg-config-lite, but it looks like it was last updated in 2012. Also, I think pkg-config now includes its own version of Glib to break the circular dependency, so it should be possible to build without Glib.

I've done searches for "mingw pkg-config". Any suggestions welcome.

Answer

Felix Rabe picture Felix Rabe · Oct 21, 2014

The way to go seems to be MSYS2 and MinGW-w64. Download MSYS2, on 32-bit Windows run msys32\autorebase.bat (this should not be needed much longer), then:

pacman -Syu  # to update the system packages

(these errors are not fatal), then

pacman -Ssq pkg-config  # to list pkg-config packages

#  for 64 bit:      ------
pacman -S mingw-w64-x86_64-pkg-config

#  for 32 bit:      ----
pacman -S mingw-w64-i686-pkg-config