如何在 Windows 中安装 pkg 配置?

发布于 2024-08-10 12:44:26 字数 164 浏览 6 评论 0 原文

我正在尝试这样做,但我所能得到的只是一些我不知道如何处理的源代码,我从 http://pkgconfig.freedesktop.org/releases/

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/.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

埋葬我深情 2024-08-17 12:44:26

这是一个让 pkg-config 在 Windows 上工作的分步过程,根据我的经验,使用 Oliver Zendel 评论中的信息。

我这里假设 MinGW 安装到 C:\MinGW。该软件包有多个版本可用,在每种情况下我都只下载了最新版本。

  1. 转到 http://ftp.gnome.org/pub/gnome/binaries/ win32/dependencies/
  2. 下载文件 pkg-config_0.26-1_win32.zip
  3. 将文件 bin/pkg-config.exe 解压到 C:\MinGW\bin
  4. 下载文件 gettext-runtime_0.18.1.1-2_win32.zip
  5. 提取文件 bin/intl. dll 到 C:\MinGW\bin
  6. 转到 http://ftp.gnome .org/pub/gnome/binaries/win32/glib/2.28
  7. 下载文件glib_2.28.8-1_win32.zip
  8. 将文件 bin/libglib-2.0-0.dll 解压到 C:\MinGW\bin

现在 CMake 将能够如果配置为使用 MinGW,请使用 pkg-config。

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.

流云如水 2024-08-17 12:44:26

没有 glib 依赖的替代方案是 pkg-config-lite

从存档中提取 pkg-config.exe 并将其放入您的路径中。

现在可以使用 chocolatey 获取此软件包,然后可以使用

choco install pkgconfiglite

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
反差帅 2024-08-17 12:44:26

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.

谜泪 2024-08-17 12:44:26

我想扩展@dzintars 关于 Cygwin 版本的 pkg-config 的答案,重点是如何正确地将它与 CMake 一起使用,因为我在这个主题中看到了有关 CMake 的各种评论。

我在使用 CMake + Cygwin 的 pkg-config 时遇到了很多麻烦,我想分享我的经验如何避免它们。

1.符号链接 C:/Cygwin64/bin/pkg-config -> pkgconf.exe 在 Windows 控制台中不起作用。

它不是本机 Windows .lnk 符号链接,即使添加“.;”,也无法在 Windows 控制台 cmd.exe 中调用它。到您的 %PATHEXT% (请参阅 https://www.mail-archive。 com/[电子邮件受保护]/msg104088.html)。

它在 CMake 中不起作用,因为 CMake 使用方法execute_process() (FindPkgConfig.cmake) 调用 pkg-config,该方法会打开一个新的 cmd.exe。

解决方案:将 -DPKG_CONFIG_EXECUTABLE=C:/Cygwin64/bin/pkgconf.exe 添加到 CMake 命令行(或在 CMakeLists.txt 中设置)。

2. Cygwin 的 pkg-config 仅识别 PKG_CONFIG_PATH 中的 Cygwin 路径(无 Windows 路径)。

例如,在我的系统上,.pc 文件位于 C:\Cygwin64\usr\x86_64-w64-mingw32\sys-root\ mingw\lib\pkgconfig.conf以下三个路径有效,但只有路径 C 在 PKG_CONFIG_PATH 中有效:

  • A) c:/Cygwin64/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig -
    不起作用。
  • B) /c/cygdrive/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig -
    不起作用。
  • C) /usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig - 有效。

解决方案:始终将 .pc 文件位置作为 Cygwin 路径添加到 PKG_CONFIG_PATH 中。

3) CMake 在 Cygwin 上的 PKG_CONFIG_PATH 中将正斜杠转换为反斜杠。

这是由于 bug https://gitlab.kitware.com/cmake/cmake/-/issues/21629。它阻止使用[2]中描述的解决方法。

解决方案:手动更新文件 C:/Program Files/CMake/share/cmake-3.x/Modules/FindPkgConfig.cmake 中的函数 _pkg_set_path_internal()。注释/删除行:

file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)

4) CMAKE_PREFIX_PATH、CMAKE_FRAMEWORK_PATH、CMAKE_APPBUNDLE_PATH 对 Cygwin 中的 pkg-config 没有影响。

原因:bug https://gitlab.kitware.com/cmake/cmake/-/issues/21775

解决方案:如果您在 Cygwin 上运行 CMake 构建,则仅使用 PKG_CONFIG_PATH 作为环境变量。忘记 CMAKE_PREFIX_PATH、CMAKE_FRAMEWORK_PATH、CMAKE_APPBUNDLE_PATH。

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.

早乙女 2024-08-17 12:44:26
  1. https://sourceforge.net/projects/mingw-w64/ 安装 mingw64。避免安装program files/(x86) 文件夹。前任。 c:/mingw-w64
  2. 此处下载 pkg-config__win64.zip< /a>
  3. 解压上述 zip 文件并将 pkg-config/bin 文件夹中的所有文件复制粘贴到 mingw-w64。在我的例子中,它是 'C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin'
  4. 现在设置路径 = C:\mingw-w64\i686-8.1.0-posix-dwarf -rt_v6-rev0\mingw32\bin
    你完成了。

如果您发现任何安全问题,请按照以下步骤操作:

  1. 在系统中搜索 Windows Defender 安全中心
  2. 导航到应用程序和应用程序浏览器控制>利用保护设置>程序设置>单击“+添加程序自定义”
  3. 选择按名称添加程序
  4. 输入程序名称:pkgconf.exe
  5. 确定
  6. 现在检查所有设置并将其设置为关闭并应用。

就这样完成了!

  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!

晨光如昨 2024-08-17 12:44:26

对于基于 w64 的计算机,您必须安装 mingw64。如果缺少 pkg-config.exe,您可以参考 http ://ftp.acc.umu.se/pub/gnome/binaries/win64/dependency/

解压并复制/合并 pkg-config.exe 到您的 C:\mingw-w64 安装中,例如。在我的电脑上进入 C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin

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

习ぎ惯性依靠 2024-08-17 12:44:26

2022 年,VS Code 将与 CMake 和 CMake 配合使用。开箱即用的 pkgconfig (将 pkgconf && vcpkg-pkgconfig-get-modules 添加到您的 vcpkg.json)

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

铁憨憨 2024-08-17 12:44:26

另一个可以获得更多更新二进制文件的地方可以在 Fedora Build System 站点上找到。 mingw-pkg-config 包的直接链接是: http://koji.fedoraproject.org/ koji/buildinfo?buildID=354619

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

埋葬我深情 2024-08-17 12:44:26

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

本指南介绍如何在 Windows 上安装 JoinMarket 及其依赖项(python、libsodium、secp256k1)。

其中部分或全部可能适用于所有版本的 Windows,也可能不适用于所有版本的 Windows。报告表示赞赏。它并未声称以任何方式全面。下载验证由您自行负责。

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:

从左侧菜单的“基本设置”中:

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

选择这些后,从主菜单第一项中选择“更新”。这些组件将安装到 C:\MinGW\bin 中。完成后,您应该在该文件夹 C:\MinGW\bin 中拥有这个 dll:libgcc_s_dw2-1.dll 以及许多其他文件;我明确提及此文件,因为 libsecp256k1 在此设置中运行时专门需要它。

接下来,您必须确保 C:\MinGW\bin 添加到您的 PATH 变量中。以下是如何做到这一点的指南;在继续之前,您必须将 ;C:\MinGW\bin 附加到路径末尾。

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() 或按 Ctrl+C 退出 Python 控制台。现在,确保您的 pip 版本是最新的:运行命令: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

关闭并保存文件。

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)).

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)).
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文