15

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.

1

3 Answers 3

16

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
3
  • 3
    Thank you! I've been trying to compile this package for days and it turns out all I needed was MSYS2 and pacman -S mingw-w64-x86_64-pkg-config !
    – Lightbeard
    Feb 24, 2017 at 22:30
  • 1
    This answer is not about enabling pkg-config tool on a MinGW compiler setup but rather to have a MSYS2 based environment which provides both the compiler and tool in its own way. Good one however.
    – legends2k
    Jul 18, 2017 at 20:52
  • 1
    Keep in mind that the mingw-w64- versions of pkg-config use ; as separator in the PKG_CONFIG_PATH environment variable, while the MSYS2 version (pacman -S pkg-config) uses :.
    – bit2shift
    Jun 4, 2018 at 20:56
5

On https://sourceforge.net/p/mingw/mailman/message/31908633/ there are some instructions from earlier this year:

The FAQ pkg-config information did not work for me: these did: https://github.com/texane/stlink/issues/169

Download these three glib, pkg-config, pkg-config-dev archives and extract contents to C:\MinGW

(These are all dead links – see also another SO question regarding win32builder.gnome.org:)

http://win32builder.gnome.org/packages/3.6/glib_2.34.3-1_win32.zip

http://win32builder.gnome.org/packages/3.6/pkg-config_0.28-1_win32.zip

http://win32builder.gnome.org/packages/3.6/pkg-config-dev_0.28-1_win32.zip

I keep this unaccepted in case someone has a better answer.

3

There is also pkg-config-lite:

  1. Install mingw-w64
  2. Install pkg-config-lite
  3. Set PKG_CONFIG_PATH to the directory containing your *.pc files (i.e. c:\mingw64\mingw64\lib\pkgconfig)
1
  • The value of PKG_CONFIG_PATH is the info I was missing, thanks.
    – Jocelyn
    Sep 25, 2022 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.