Error:Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Asked Answered
F

4

25

I am using Point cloud library 1.5.1. When I run CMake 3.4.0-rc2 to build my project, it has error:

Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)

How do I fix this error?

Farci answered 27/10, 2015 at 23:2 Comment(1)
Have a look at this linkDacey
D
29

This error is raised because the pkg-config utility is not available on your system.

Using PkgConfig with CMake is not a truly cross-platform solution, as Windows does not come with the pkg-config utility installed. (The PCL developers should instead use find_package() in their CMake. Perhaps, this is worth opening up a bug report on their Github.) On Linux, this is an easy fix; you can install pkg-config like this:

sudo apt-get install pkg-config

However, on Windows, the process is more involved. There are several solutions for installing pkg-config on Windows documented here. I'm not sure which most directly applies to your situation, so I suggest reading through some of those. After successfully installing the pkg-config utility on your Windows machine, clear your CMake cache, and re-run CMake. This should remove the error, and allow your build to proceed.

Distorted answered 8/11, 2019 at 17:19 Comment(0)
H
6

Install vcpkg: https://vcpkg.io/en/getting-started.html

Install pkgconf:

 .\vcpkg install pkgconf

If use CMake, delete the Cache files/folders: CMakeCache.txt and CMakeFiles. After that, run the command

cmake .. -DCMAKE_TOOLCHAIN_FILE=C:\dev\vcpkg\scripts\buildsystems\vcpkg.cmake
Heterochromatic answered 18/9, 2022 at 13:30 Comment(0)
D
2

On Fedora 34, it was because of multiple pkg-config

/home/sapillai/go/bin/pkg-config
/home/sapillai/go/bin/pkg-config
/usr/bin/pkg-config
/home/sapillai/go/bin/pkg-config

I deleted the others and kept /usr/bin/pkg-config. Error was gone.

Delilahdelimit answered 11/12, 2022 at 14:29 Comment(1)
There is only one "other". You erroneously, but harmlessly, have the same directory three times on your PATHEmblem
M
1

On Ubuntu 24.04, I tried pkg-config and pkgconf without success.

Finally, I found pkgconf-bin and all was right in the world.

$ sudo apt-get reinstall pkgconf-bin

I used reinstall because I suspected something was leftover and/or damaged and reinstall cleans up what it knows about before going forward.

Mcconaghy answered 15/7 at 20:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.