How to install pkg config in windows?
Asked Answered
T

10

92

I am trying to do it, but all I can get is some source code that I don't know how to do deal with I downloaded from http://pkgconfig.freedesktop.org/releases/.

Thar answered 10/11, 2009 at 20:21 Comment(0)
S
65

Get the precompiled binaries from http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/

Download pkg-config and its depend libraries :

Stotts answered 10/11, 2009 at 21:28 Comment(7)
I found the needed gtk binaries there too; for pkg-config_0.26-1_win32.zip you need the file libglib-2.0-0.dll from ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/… and intl.dll from ftp.gnome.org/pub/gnome/binaries/win32/dependencies/…Luthern
Where do I put these files so that they will be found by cmake?Boxfish
Place them in the directory /bin where pkg-config is located.Rriocard
But where does pkg-config on Windows look for installed libs?? Where does it go to search for pc files? This is SO confusing and a shame for everybody involved in such garbage software... :)Thermae
You didn't mention where to put them.Petiole
Put the pkg-config executables and dependent DLLs in any folder on the path, e.g. C:\WINDOWSOeo
@Thermae by default, it searches 'C:/windows/system32/lib/pkgconfig' and 'C:/windows/system32/share/pkgconfig' if pkg-config.exe is saved in C:/windows/system32. You can also set PKG_CONFIG_PATH env variable.Difficulty
C
114

This is a step-by-step procedure to get pkg-config working on Windows, based on my experience, using the info from Oliver Zendel's comment.

I assume here that MinGW was installed to C:\MinGW. There were multiple versions of the packages available, and in each case I just downloaded the latest version.

  1. go to http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/
  2. download the file pkg-config_0.26-1_win32.zip
  3. extract the file bin/pkg-config.exe to C:\MinGW\bin
  4. download the file gettext-runtime_0.18.1.1-2_win32.zip
  5. extract the file bin/intl.dll to C:\MinGW\bin
  6. go to http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28
  7. download the file glib_2.28.8-1_win32.zip
  8. extract the file bin/libglib-2.0-0.dll to C:\MinGW\bin

Now CMake will be able to use pkg-config if it is configured to use MinGW.

Checkerboard answered 12/3, 2014 at 21:6 Comment(5)
how to change cmake to configure to use MinGW?Crumpton
@cindywmiao: choose a CMake generator with MinGW in its name, like "MinGW Makefiles", from the list of generators. I personally use "CodeBlocks - MinGW Makefiles" which additionally generates a project file for the CodeBlocks IDE.Checkerboard
You don't have to use MinGW - you can follow these steps but extract pk-config.exe and the required DLL's to any folder of your choosing (including a new folder), just be sure the folder is in your PATH.Erythropoiesis
it's complicated. is there any newer answer for 2021? it's different now.Physiotherapy
If anyone needs it as a GitHub action. gist.github.com/geoffreygarrett/…Rosanne
S
65

Get the precompiled binaries from http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/

Download pkg-config and its depend libraries :

Stotts answered 10/11, 2009 at 21:28 Comment(7)
I found the needed gtk binaries there too; for pkg-config_0.26-1_win32.zip you need the file libglib-2.0-0.dll from ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/… and intl.dll from ftp.gnome.org/pub/gnome/binaries/win32/dependencies/…Luthern
Where do I put these files so that they will be found by cmake?Boxfish
Place them in the directory /bin where pkg-config is located.Rriocard
But where does pkg-config on Windows look for installed libs?? Where does it go to search for pc files? This is SO confusing and a shame for everybody involved in such garbage software... :)Thermae
You didn't mention where to put them.Petiole
Put the pkg-config executables and dependent DLLs in any folder on the path, e.g. C:\WINDOWSOeo
@Thermae by default, it searches 'C:/windows/system32/lib/pkgconfig' and 'C:/windows/system32/share/pkgconfig' if pkg-config.exe is saved in C:/windows/system32. You can also set PKG_CONFIG_PATH env variable.Difficulty
R
62

A alternative without glib dependency is pkg-config-lite.

Extract pkg-config.exe from the archive and put it in your path.

Nowdays this package is available using chocolatey, then it could be installed with

choco install pkgconfiglite
Reluctance answered 1/9, 2014 at 12:14 Comment(3)
Works well, also the other pkg-config listed in the FAQ here crashes for me on Windows 10 Home as well as Pro.Gert
what do you mean your path?Physiotherapy
@Physiotherapy like "C:\Windows\System32"Difficulty
D
6

I did this by installing Cygwin64 from this link https://www.cygwin.com/ Then - View Full, Search gcc and scroll down to find pkg-config. Click on icon to select latest version. This worked for me well.

Darees answered 4/9, 2018 at 11:5 Comment(0)
M
5

I would like to extend the answer of @dzintars about the Cygwin version of pkg-config in that focus how should one use it properly with CMake, because I see various comments about CMake in this topic.

I have experienced many troubles with CMake + Cygwin's pkg-config and I want to share my experience how to avoid them.

1. The symlink C:/Cygwin64/bin/pkg-config -> pkgconf.exe does not work in Windows console.

It is not a native Windows .lnk symlink and it won't be callable in Windows console cmd.exe even if you add ".;" to your %PATHEXT% (see https://www.mail-archive.com/[email protected]/msg104088.html).

It won't work from CMake, because CMake calls pkg-config with the method execute_process() (FindPkgConfig.cmake) which opens a new cmd.exe.

Solution: Add -DPKG_CONFIG_EXECUTABLE=C:/Cygwin64/bin/pkgconf.exe to the CMake command line (or set it in CMakeLists.txt).

2. Cygwin's pkg-config recognizes only Cygwin paths in PKG_CONFIG_PATH (no Windows paths).

For example, on my system the .pc files are located in C:\Cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\lib\pkgconfig. The following three paths are valid, but only path C works in PKG_CONFIG_PATH:

  • A) c:/Cygwin64/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig - does not work.
  • B) /c/cygdrive/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig - does not work.
  • C) /usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig - works.

Solution: add .pc files location always as a Cygwin path into PKG_CONFIG_PATH.

3) CMake converts forward slashes to backslashes in PKG_CONFIG_PATH on Cygwin.

It happens due to the bug https://gitlab.kitware.com/cmake/cmake/-/issues/21629. It prevents using the workaround described in [2].

Solution: manually update the function _pkg_set_path_internal() in the file C:/Program Files/CMake/share/cmake-3.x/Modules/FindPkgConfig.cmake. Comment/remove the line:

file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)

4) CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, CMAKE_APPBUNDLE_PATH have no effect on pkg-config in Cygwin.

Reason: the bug https://gitlab.kitware.com/cmake/cmake/-/issues/21775.

Solution: Use only PKG_CONFIG_PATH as an environment variable if you run CMake builds on Cygwin. Forget about CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, CMAKE_APPBUNDLE_PATH.

Mosqueda answered 4/2, 2021 at 0:45 Comment(0)
M
3
  1. Install mingw64 from https://sourceforge.net/projects/mingw-w64/. Avoid program files/(x86) folder for installation. Ex. c:/mingw-w64
  2. Download pkg-config__win64.zip from here
  3. Extract above zip file and copy paste all the files from pkg-config/bin folder to mingw-w64. In my case its 'C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin'
  4. Now set path = C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin taddaaa you are done.

If you find any security issue then follow steps as well

  1. Search for windows defender security center in system
  2. Navigate to apps & browser control> Exploit protection settings> Program setting> Click on '+add program customize'
  3. Select add program by name
  4. Enter program name: pkgconf.exe
  5. OK
  6. Now check all the settings and set it all the settings to off and apply.

Thats DONE!

Mood answered 27/7, 2020 at 18:29 Comment(1)
I liked taddaaa thing!Gamecock
P
1

In 2022 VS Code works with CMake & pkgconfig out of the box (add pkgconf && vcpkg-pkgconfig-get-modules to your vcpkg.json)

Polyglot answered 1/10, 2022 at 23:31 Comment(2)
which version of pkgconf do you have? could you post the structure of the .json file?Dorolice
You could check out VSCode vcpkg plugin page, also I can achieve the above just by calling vcpkg install to install each mentioned packages.Procrustes
F
0

Another place where you can get more updated binaries can be found at Fedora Build System site. Direct link to mingw-pkg-config package is: http://koji.fedoraproject.org/koji/buildinfo?buildID=354619

Floranceflore answered 29/1, 2013 at 1:58 Comment(3)
That site does seem to have more recent builds, but the build you linked to is out of date. The package link is actually koji.fedoraproject.org/koji/packageinfo?packageID=13212Chiliarch
Following up to my previous comment: those downloads don't help; I extracted the file with 7-Zip and had no idea what to do next. Instead I went with the instructions on the following site, despite them calling for a less up-to-date build: gaia-gis.it/spatialite-3.0.0-BETA/mingw_how_to.html#pkg-configChiliarch
that page assumes Mingw. I run Visual Studio 2008 on my Mac from a VM. Hard disk space is scarce. I don't want to install mingw or Cygwin only to be able to run pkg-config. pkg-config missing is an error spat out by cmake. I feel lost in that messOrnis
N
0

for w64-based computers you have to install mingw64. If pkg-config.exe is missing then, you can refer to http://ftp.acc.umu.se/pub/gnome/binaries/win64/dependencies/

Unzip and copy/merge pkg-config.exe into your C:\mingw-w64 installation, eg. into on my pc into C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin

Nitramine answered 5/1, 2020 at 10:51 Comment(0)
B
-1

From: https://github.com/JoinMarket-Org/joinmarket/wiki/Installing-JoinMarket-on-Windows

This guide describes how to install JoinMarket and its dependencies (python, libsodium, secp256k1) on Windows.

Some or all of this may or may not work for all versions of Windows. Reports appreciated. It is not claimed to be in any way comprehensive. Verification of downloads are your own responsibility.

Install JoinMarket - go to https://github.com/JoinMarket-Org/joinmarket/releases and download the most recent release. Unzip it into any location you choose.

You will need to install MinGW from here or go to their website. After a few introductory screens, you will be shown a windows with some optional components that you have to choose; this basic setup is sufficient:

From "Basic Setup" in the left menu:

mingw-developer-toolkit
mingw32-base
mingw32-gcc-g++
msys-base

Once you have chosen these, choose "Update" from the main menu first item. These components will be installed into C:\MinGW\bin. Once that is complete, you should have this dll: libgcc_s_dw2-1.dll in that folder C:\MinGW\bin, along with a lot of other files; I'm mentioning this file explicitly, since it's needed specifically for libsecp256k1 to operate in this setup.

Next, you must make sure C:\MinGW\bin is added to your PATH variable. Here's one guide to how to do that; you must append ;C:\MinGW\bin to the end of the path before continuing.

Install Python from https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi. Run the executable. Choose to install the feature Add python.exe to Path (it's the last option in the installer, off by default - switch it on) on local hard drive during installation; Python should then be installed in C:\Python27 (EXTRA NOTE: the most recent 2.7 installation linked here seems to install pip automatically, which is very useful for step 4)

Check that Python runs. Open a new command prompt as administrator by typing cmd.exe into the Start menu and pressing Ctrl+Shift+Enter. Type python and you should see something like:

Python 2.7.11 (default....
....
>>>

Exit the Python console with exit() or by pressing Ctrl+C. Now, make sure your version of pip is up to date: run the command: python -m pip install --upgrade pip.

Go to the directory C:\Python27\Lib\distutils and add a new file, called distutils.cfg. Inside it, put:

[build]
compiler=mingw32

Close and save the file.

Next, you need to install the dll for libnacl. First go to https://download.libsodium.org/libsodium/releases/ and choose the file libsodium-1.0.4-msvc.zip to download. Unzip anywhere, and then copy the file libsodium.dll from the directory \Win32\Release\v120\dynamic (do not use v140), and paste it into root joinmarket directory (the same directory where README.md lives). Then you need to address the Visual C++ 2013 runtime dependency. Do so by going to www.microsoft.com/en-us/download/details.aspx?id=40784 and clicking Download. Choose x86 even on a 64-bit system, and run the executable.

Note that after doing this, you must run pip install -r requirements-windows.txt from the Joinmarket root directory (where the README.md file is) and should not get an error message (this will install/check the python packages libnacl and secp256k1(-transient)).
Billings answered 28/10, 2022 at 8:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.