pkg-config Windows

See original GitHub issue

Hi,

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 ?

Best regards,

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:30 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
erakiscommented, 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.

In my case

# Open a Visual Studio command prompt and type
> set LIB=%LIB%;d:\vcpkg\installed\x86-windows\\lib;
> mkdir build && cd build
> meson ..

Other alternative is

meson .. "-Dcpp_link_args=/LIBPATH:d:\\installed\\x86-windows\\lib" --backend vs2015

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.

if build_machine.system() == 'windows'
  cpp = meson.get_compiler('cpp')
  zlib = cpp.find_library('zlib')
  sodium = cpp.find_library('libsodium')
else
  zlib = dependency('zlib', version: '>=1.2')
  sodium = dependency('libsodium', version: '>=1.0')
endif
protobuf = dependency('protobuf', version: '>=3.0')

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.

1reaction
mqudsicommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to install pkg config in windows? - Stack Overflow
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.
Read more >
pkg-config - Freedesktop.org
pkg-config is a helper tool used when compiling applications and libraries. It helps you insert the correct compiler options on the command line ......
Read more >
Windows : How to install pkg config in windows? - YouTube
Windows : How to install pkg config in windows ? [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] Windows : How to ...
Read more >
pkg-config - Wikipedia
pkg-config is a computer program that defines and supports a unified interface for querying installed libraries for the purpose of compiling software that ......
Read more >
pkgconfig - PyPI
pkgconfig is a Python module to interface with the pkg-config command line tool for Python 3.3+. It can be used to. find all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found