Pkg config install windows

How to install pkg config in windows?

Posted by: admin December 11, 2017 Leave a comment

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

Download pkg-config and its depend libraries :

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.

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

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

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

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

Prevent taps from passing through buttons in XAML/WPF

Questions: In my project, I have a large container with a handler for taps. Inside this container, I also have a button. My goal is to handle all taps on the background container UNLESS the user click.

Send some keys to inactive window with python

Questions: I’m tryin to send some keys to inactive window/process/programm (win32/64) using python. Already read about pywinauto and SendKeys, but both of them activate window before sendin keys.

Performance Counter shows different values when ReadOnly=false

Questions: I was trying to figure out why certain performance counters aren’t updated in our production server, when I’ve hit this weird issue – the counter seems to return different.

PKG_CONFIG_PATH переменная среды

Рассмотрим настройку переменной среды PKG_CONFIG_PATH, если вы установленное программное обеспечение в нестандартном префиксе. Что это значит?

8 ответов

PKG_CONFIG_PATH — это переменная среды, которая указывает дополнительные пути, в которых pkg-config будет искать свои .pc-файлы.

Эта переменная используется для увеличения пути поиска pkg-config по умолчанию. В типичной системе Unix он будет искать в каталогах /usr/lib/pkgconfig и /usr/share/pkgconfig . Обычно это распространяется на модули, установленные системой. Однако некоторые локальные модули могут быть установлены в другом префиксе, таком как /usr/local . В этом случае необходимо добавить путь поиска, чтобы pkg-config мог найти файлы .pc.

Программа pkg-config используется для извлечения информации об установленных библиотеки в системе. Основное использование pkg-config — предоставить необходимые данные для компиляции и привязки программы к библиотеке. Эти метаданные хранятся в файлах pkg-config. Эти файлы имеют суффикс .pc и находятся в определенных местах, известных инструменту pkg-config.

Чтобы проверить значение PKG_CONFIG_PATH , используйте эту команду:

Чтобы установить значение PKG_CONFIG_PATH , используйте:

Первый ответ недостаточно технически достаточно ясен. На странице man (откройте терминал, введите man pkg-config ):

pkg-config извлекает информацию о пакетах из специальных файлов метаданных. Эти файлы названы в честь пакета и имеют расширение .pc . В большинстве случаев системы, pkg-config выглядит в /usr/lib/pkgconfig , —- +: = 5 = + —-, /usr/share/pkgconfig и /usr/local/lib/pkgconfig для этих файлов. Это дополнительно просмотрят разделенные двоеточиями (в Windows, разделенные точкой с запятой) список каталогов, указанный переменной окружения /usr/local/share/pkgconfig .

Таким образом, программа PKG_CONFIG_PATH не находится в pkg-config ; однако, если вы устанавливаете библиотеку, чтобы доступная информация использовалась в сценарии PKG_CONFIG_PATH , она должна быть в каталоге —- +: = 12 =: + —-.

Чтобы узнать, где pkg-config (версия 0.24 или новее) ищет установленные библиотеки по умолчанию, используйте следующую команду:

Чтобы изменить этот путь, установите переменную среды PKG_CONFIG_PATH . Состояние файла man PKG_CONFIG_PATH :

Разделенный двоеточием (в Windows, разделенный точкой с запятой) список каталоги для поиска .pc-файлов. Каталог по умолчанию всегда будет искать после поиска пути; по умолчанию используется libdir /pkgconfig: datadir /pkgconfig где libdir — это libdir, где pkg-config и datadir — это datadir, где установлен pkg-config.

Вы пытаетесь создать часть программного обеспечения, допустим, Widget. Виджет полагается на другую библиотеку libcog ради аргумента. Процесс сборки виджета (возможно, скрипт configure) использует pkg-config, чтобы определить, как использовать libcog. pkg-config ничего не знает о libcog.

Если libcog не установлен, это ваша проблема. Существует хорошая вероятность того, что стандартная установка libcog устранит проблему. В зависимости от вашей системы вам может потребоваться установить дополнительную версию «разработчика» пакета; он часто имеет «-devel» или «-dev» в конце, поэтому, если вы установите «libcog», вам также может понадобиться установить «libcog-devel».

Если установлен libcog, он, вероятно, не установлен таким образом, чтобы pkg-config мог его найти. Возможно, файл libcog.pc находится где-то в вашей системе. Для аргументации он находится в /opt/cog/lib/pkgconfig/libcog.pc. В этом случае вы можете сообщить об этом pkg-config, установив PKG_CONFIG_PATH в каталог, содержащий libcog.pc. Таким образом, в оболочке Bourne или подобном, что-то вроде

Как только это будет сделано, повторное выполнение неудавшейся команды, надеюсь, будет работать.

Читайте также:  Mac os проще чем windows

Если libcog установлен, включая библиотеки и файлы заголовков, и у вас нет файла libcog.pc, все идет плохо. Предположительно, стандартная установка libcog включает в себя информацию, иначе Виджет не будет полагаться на нее. Сначала я исследовал переустановку libcog. Можно создать файл libcog.pc вручную, но получение его права затруднено и очень специфично для данной библиотеки.

Я посмотрел man-страницу на своей 64-битной системе и немного запутался. Он сказал в одной строке:

pkg-config извлекает информацию о пакетах из специальных файлы метаданных. Эти файлы названы в честь пакета, с расширение .pc. По умолчанию pkg-config выглядит в директории tory prefix /lib /pkgconfig для этих файлов; он также будет смотреть в разделенный двоеточием (в Windows, разделенный точкой с запятой) список каталогов, указанных в параметре PKG_CONFIG_PATH. состояние.

Я предположил, что он также выглядит в каталогах lib /pkgconfig. Оказывается, сами каталоги. В моем случае я пытался скомпилировать приветственный учебник gtk world gtk. Я найду файл, который я хочу, например.

Наконец, нужно было выполнить экспорт.

Мне кажется, что в большинстве ответов есть слишком много информации, чем нужно.

Программное обеспечение, которое устанавливается, может (и обычно) полагаться на некоторые библиотеки и /или заголовки, а система использует pkg-config для их поиска.

Сказано так, pkg-config ищет эти файлы в предопределенных (по умолчанию) системных каталогах. Эти папки являются «префиксными». Например. ожидается, что в библиотеке с префиксом /usr/local есть заголовки в /usr/local/include , а сама библиотека будет в /usr/local/lib . pkg-config , однако ищет библиотеки также в каталоге, указанном в переменной окружения PKG_CONFIG_PATH .

Затем, если вы устанавливаете программное обеспечение за пределами списка папок по умолчанию, вам нужно «настроить» список, а именно добавить свои каталоги в PKG_CONFIG_PATH

Для получения дополнительной информации вы можете посмотреть здесь и здесь

Это означает, что вы пытаетесь создать что-то из исходного кода и не можете найти все зависимости, которые ему нужны. Сценарий pkg-config , который он использует для поиска файлов разработки для этих библиотек, выводит это сообщение.

Я пытался установить последнюю версию axel , и я запустил ./configure , и я получил следующее:

Итак, я попробовал:

Как очевидно, я установил openssl ( sudo apt-get install openssl ). Но на вышеприведенном выходе, как вы можете видеть, говорится: «Нет пакета» openssl ‘ найденный». Поэтому, чтобы убедиться, что я сделал:

Оказывается, мне нужен еще какой-то другой пакет, поэтому немного по поиску в Google, и я обнаружил, что мне нужно установить этот пакет:

И все это не имело ничего общего с изменением переменной env переменной pkg-config.

pkg-config Windows #4029

Comments

erakis commented Aug 15, 2018 •

I’m trying for the first time the meson build system. Get it working on linux is easy but on Windows I’m a little bit stuck.

My project depends on protobuf .

  1. Meson seems to use pkg-config to test the presence of dependency but where to find the latest pkg-config for Windows ? I’m getting the error : ERROR: Pkg-config not found.
  2. Once I have installed the pkg-config, it will be a certainty that the protobuf library will not be available on the OS. So, which Windows compatible package manager should I install ?
    • vc-pkg ?
    • Chocolatey ?
    • No one as no package manager on Windows can provide *.pc file ?

The text was updated successfully, but these errors were encountered:

jpakkane commented Aug 15, 2018

Pkg-config is not that useful on its own, you also need something like msys2 to provide the .pc files (and prebuilt libraries) needed to make it work.

If your only dependency is Protobuf, then you can build the dependency from source using Meson subprojects instead. Protobuf is available in the wrapdb, so using it is fairly straightforward. See the documentation on mesonbuild.com for reference.

You need to compile the protoc binary on your own and put it in the path, though.

erakis commented Aug 15, 2018

My project depends on ( protobuf 3 , libsodium and zlib ). What do you advise me ?

What I want to achieve is to

  • Install dependencies
  • Produce a Visual Studio solution
  • Let the user open the solution and use it

jpakkane commented Aug 15, 2018

You need to have some way of getting the dependencies. I don’t use Windows all that much so I can’t really say what the best way to do that is. Also note that the solution files produced by Meson are not portable between machines. Anyone who wants to use your project also needs to obtain all the dependencies and generate the solution files with Meson.

erakis commented Aug 15, 2018 •

The only way I found yet is

  1. Get source and compile library manually or use vc-pkg to get binary directly.
  2. I have to inform pkg-config where to find the library. Usually this is done by indicating the path ( PKG_CONFIG_PATH ) where are the *.pc file. But those do not even exists. Worst, they must contains the path where the library are, so I cannot ship *.pc file with hard-coded path.

This is a mess on Windows.

I think I will create a Visual Studio 2015 solution for Windows and a makefile for unix based os.

barcharcraz commented Aug 16, 2018

  1. get pkgconf’s meson build working on windows
  2. allow embedding of pkgconf as a subproject, and make dependencies/base.py find it
  3. use pkgconf’s built in windows personality support with whatever .pc files are around.

3 works. 2 needs some changes in meson, and 1 is in progress (I’ve opened upstream issues).

erakis commented Aug 16, 2018

What about supporting vc-pkg to querying installed libraries ? pkg-config does not work as well on windows as linux.

From what I’ve test yet, Meson work perfectly on Linux but on Windows I will unfortunately use cmake with vc-pkg. As they are better coupled. But I hate cmake !

For Meson + Windows a package manager like vc-pkg is essential. It’s too much painful having to manually compile each third party dependency, create or link pk-config file, etc.

Читайте также:  Windows зависает при установке драйвера видеокарты

barcharcraz commented Aug 16, 2018

well vcpkg doesn’t provide any functionality for finding libraries, the integrations it has happen via either setting all the link options globally (for msbuild) or adding WhateverConfig.cmake files to the cmake paths for cmake.

Neither are really viable for meson. However packages can output pc files on windows and they work just as well as on linux (pkgconf has some special handling of paths and whatnot). Relocation works as well.

There has been some discussion in the cmake mailing lists around how to better support this sort of thing. Basically CmakeConfig.cmake files are quite coupled to cmake itself, and almost impossible to use from other tools, there’s work going on to make generation of pkgconfg files easier from cmake and to encourage that.

nirbheek commented Aug 16, 2018 •

You don’t need pkg-config to use Meson, and I don’t think it makes sense to build pkgconf to get it. You either have dependencies already available on your Windows system via pkg-config, but if you don’t, then downloading pkg-config won’t give you anything.

There are better ways of getting dependencies on Windows.

One way would be with nuget or vcpkg. Another would be to host and ship manually-created binary wraps for the dependencies that are painful to build (such as libsodium). Currently, the way to do this is to download the binaries are configure time and set up a declare_dependency() pointing to it.

There are already source wraps on wrapdb for zlib and protobuf. We are planning on adding better integration in Meson for binary wraps for Windows so you don’t have to do the above work manually.

erakis commented Aug 16, 2018 •

@nirbheek Thank you so much for your explanation.

You don’t need pkg-config to use Meson

I was reading documentation about declare_dependency. Does it means I could use binary got from vc-pkg, a configure them manually ? The only drawback with this solution is that I will have to have a different configuration between linux and windows like.

The way I try with Meson is :

  1. Install pkg-config lite for Windows
  2. Get vc-pkg and install dependencies

But I was always getting the error ERROR: Pkg-config not found. So I tried listing pkg installed package using

The only library listed was protobuf , no zlib or libsodium . The problem is that vc-pkg does not always produce *.pc file needed by pkg-config .

Looking at the original cmake of zlib, the variable SKIP_INSTALL_FILES should NOT be set to get the *.pc file. But on the vc-pkg porting they set this variable to ON .

nirbheek commented Aug 16, 2018 •

The only drawback with this solution is that I will have to have a different configuration between linux and windows like.

It shouldn’t. The code will be the same on all OSes

You can use meson wrap install zlib and meson wrap install protobuf to install the wrap files for those before running meson itself.

The wrap files will download meson build files from our wrapdb server, download the sources from upstream, and build it. For more details: https://mesonbuild.com/Wrap-dependency-system-manual.html

For libsodium you’d have to create a binary subproject, and you can either put this inside your project’s git repository directly, or you can host it separately and create a wrap file that points to that git repo. For more details: https://mesonbuild.com/Shipping-prebuilt-binaries-as-wraps.html (the page talks about subproject().get_variable() , but that is equivalent to the dependency(. fallback:) syntax above)

But I was always getting the error ERROR: Pkg-config not found.

Are you sure pkg-config is available in PATH ? What does where pkg-config return?

FWIW, the reason why your method doesn’t work for protobuf and libsodium on vc-pkg is because those projects don’t ship pkg-config files. For such projects, the mechanism is something like this:

We have plans to make this use-case easier in the future.

As an anecdote, the last time I spoke to a Linux maintainers a library on vc-pkg, they were appalled at the quality of the port. The build system had been hacked together without understanding the code or talking to upstream, and was likely untested. I would not recommend using it unless you have verified that the libraries you want to use were ported correctly. 😅

erakis commented Aug 16, 2018 •

Are you sure pkg-config is available in PATH? What does where pkg-config return?

But there’s only protobuf that output a *.pc file

So, this is normal that pkg-config only list the protobuf as installed library

But for zlib and libsodium the vc-pkg configuration does not instruct to output the *.pc file 😞

I’m curious, what is cc and what location find_library will look ?

mqudsi commented Aug 17, 2018

Writing custom .pc files is pretty straight forward, you can set PKG_CONFIG_PATH to a local directory and include the pc files in your version control for Windows.

nirbheek commented Aug 17, 2018

I’m curious, what is cc and what location find_library will look ?

Sorry, that was missing a sentence:

This will use the compiler to find the library in the compiler’s default search paths. See: https://mesonbuild.com/Reference-manual.html#compiler-object

erakis commented Aug 28, 2018 •

Writing custom .pc files is pretty straight forward, you can set PKG_CONFIG_PATH to a local directory and include the pc files in your version control for Windows.

@mqudsi Interesting but if I use the package-manager vk-pkg to get binaries, the user can install them anywhere they want. From what I’ve understood, the pkg-config file should contains the path where the binaries are. I can’t push a pkg-config file with an hard-coded path to my version control repo.

erakis commented Aug 28, 2018 •

This will use the compiler to find the library in the compiler’s default search paths. See:

@nirbheek Seriously on Windows this is almost impossible to use meson. If we use vcpkg , the binaries can be installed anywhere on the user’s hard disk.

Also, some package does not comes with pkg-config so meson can’t find them automatically. As exemple, protobuf is coming with, but zlib and libsodium no.

I could create my own pkg-config file for those package and save them in my repo, but this will still make no sens as I should put an hard-coded path inside. Remember, vc-pkg can installed binaries anywhere.

Now trying your solution to make a custom search.

Here is the listening of my vc-pkg folder

According your advise; I tried this to force meson cpp compiler to find the libsodium library manually

, but it still doesn’t work 😞 .

I can’t put hard-coded path here too, this make no sens. More over, I can’t use environment variable easily too or passing argument to meson and use it in the dirs parameters of the function find_library .

In conclusion, did I’m stuck ? Will I have to go back to cmake ? 🙁

erakis commented Aug 29, 2018 •

Other thing I tried is to add a path where the compiler should look.

But it still doesn’t work. I’m getting

Why there is no LIBPATH argument pass to the linker ? Like ;

If this was the case, the compiler would find the library.

erakis commented Aug 29, 2018 •

@barcharcraz I hijacked an issue on vc-pkg, hoping they recognizes the need to produce a pkg-config file for meson.

I took a look to the zlib library

Now, looking to the zlib porting of vc-pkg

Unfortunately options are hardcoded and no pc file can be produced.

ras0219-msft commented Aug 30, 2018

@purell We’d (vcpkg) be happy to welcome PRs that improve the pkg-config files! Ideally, we would have a vcpkg_fixup_pkgconfig() macro similar to cmake that would perform any needed modifications (such as making the files relocatable, moving them to a single consistent location, etc).

If we want to make .pc files consistently high quality, then we would also want to have post build checks (currently, we check things like CRT version, file layout, and ensuring the library built static/dynamic libraries based on what the user requested). We may also want post-install usage messages like we have for CMake:

Additionally, there are a few «overarching» questions I have about how meson would consume these files — such as how should debug vs release work? I know nothing about meson but I’m pretty familiar with CMake; if meson acts like a CMake «multi-config» generator, then there may be complex work to do regarding merging the two flavors. If Meson is always a single configuration, then having two separate .pc files is probably better and we’d need to store them in two separate locations (passing the right location in to Meson based on the build configuration).

galexite commented Aug 30, 2018

@ras0219-msft Could vcpkg export its own alternative configuration (i.e. as a JSON file) or provide a command similar to pkg-config , consumable by third-party build systems (such as Meson), thus allowing greater access to the features vcpkg provides?

I suggested this sometime back in an issue mentioned by @purell: microsoft/vcpkg#2662

erakis commented Aug 30, 2018 •

The good news is that I finally found a way to get cpp compiler of meson (VS) able to find the library with no pkg-config file. The trick is to set the LIB environment variable before calling meson.

Other alternative is

This way, the compiler cl.exe will try to find the library in installed folder of vc-pkg. But I have to make an exception for Windows vs Unix.

This is not a perfect solution, but I hope this will help someone else.

Obviously, it would be much simpler if vcpkg would provides the pkg-file. I’ll see if I can find time to do a PR, but seriously I’m pretty new with cmake.

ras0219-msft commented Aug 30, 2018 •

@galexite We’d definitely be happy to review a PR for something like that! Sorry for not commenting directly on your post in Microsoft/vcpkg :).

The trouble is that we (the upstream vcpkg team) primarily have experience in MSBuild and CMake, so we really do need someone who knows how it would be used to help drive the implementation. A potential first implementation is simply «include include\ and link everything in lib\ » — this is what we do for MSBuild.

(As a note: I believe this would be entirely implemented inside our pure-C++ tool, so no CMake knowledge required :))

erakis commented Aug 31, 2018

I shouted victory too quickly.

Now meson is happy but once I start the compilation of the Visual Studio solution generated, I’m getting a link error. VS don’t produce a lib file for my dll. Thus, my executable cannot be link with my dll.

With cmake I used the option CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS that automatically create a module definition (.def) file with all global symbols.

I would like to do the same using dumpbin but meson lack of prelink/postlink task. Why ? Most of build system propose that.

Else i could
*. use the old way __declspec(dllexport) but 😞
*. maintain a def file, I find it painful.

fungos commented Dec 5, 2019 •

I’m having trouble with this also and I believe the right fix is that Meson support an new alternate way of finding libraries. The LIB trick from @purell is a hint on this direction, but in his case he needed to adapt a meson.build file. Maybe this can be a fallback if either pkg_config and the cmake alternatives do not work.

For context, my issue is getting GTK to build on Windows, with Meson is basically impossible on windows to find all dependencies.

Читайте также:  Windows software from the uralsoft
Оцените статью