Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.
What does this mean ?
Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.
What does this mean ?
PKG_CONFIG_PATH
is a environment variable that specifies additional paths in whichpkg-config
will search for its .pc files.This variable is used to augment pkg-config's default search path. On a typical Unix system, it will search in the directories
/usr/lib/pkgconfig
and/usr/share/pkgconfig
. This will usually cover system installed modules. However, some local modules may be installed in a different prefix such as/usr/local
. In that case, it's necessary to prepend the search path so that pkg-config can locate the .pc files.The
pkg-config
program is used to retrieve information about installed libraries in the system. The primary use ofpkg-config
is to provide the necessary details for compiling and linking a program to a library. This metadata is stored in pkg-config files. These files have the suffix .pc and reside in specific locations known to the pkg-config tool.To check the
PKG_CONFIG_PATH
value use this command:To set the
PKG_CONFIG_PATH
value use:or
To see where pkg-config (version 0.24 or later) searches for installed libraries by default, use the following command:
To add to that path, set the
PKG_CONFIG_PATH
environment variable. The man file statesPKG_CONFIG_PATH
is:The first answer is not technically explicit enough. From the man page (open a terminal, type
man pkg-config
):So the
pkg-config
program is not in thePKG_CONFIG_PATH
directory; however, if you install a library, for the information to use it in anautomake
script to be accessible it needs to be in a directorypkg-config
is aware of.You're trying to build a piece of software, let's say Widget. Widget relies on another library, libcog for the sake of argument. Widget's build process (probably a configure script) is using pkg-config to determine how to use libcog. pkg-config doesn't know anything about libcog.
If libcog isn't installed, that's your problem. There is a good chance that a standard install of libcog will fix the problem. Depending on your system, you may need to install an addition "developer" version of the package; it often has "-devel" or "-dev" at the end, so if you install "libcog", you might also need to install "libcog-devel".
If libcog is installed, it's probably not installed in a way that pkg-config can find it. There is probably a libcog.pc file somewhere on your system. For the sake of argument, it's at /opt/cog/lib/pkgconfig/libcog.pc. In that case, you can tell pkg-config about it by setting the PKG_CONFIG_PATH to the directory holding libcog.pc. So in a Bourne shell or similar, something like
Once that's done, re-running the command that failed will hopefully work.
If libcog is installed, including the libraries and header files, and you don't have a libcog.pc file, things are going poorly. Presumably a standard install of libcog includes the information, or else Widget wouldn't rely on it. I'd first investigate reinstalling libcog. It is possible to manually create the libcog.pc file, but getting it right is difficult and highly specific to a given library.
I looked at the man-page on my 64-bit system and got a bit confused. It said in one line:
I had assumed that it alwas looks in the directories lib/pkgconfig. Turns out its the directories themselves. In my case, I was trying to compile the hello world gtk tutorial. I locate the file i want e.g.
Among the results are:
Finally was to do an export.
It seems to me that most of the answers have too much information than needed.
The software that one installs may (and usually does) rely on some libraries and/or headers and the System uses pkg-config to find them.
Said so,
pkg-config
looks for this files in pre-defined (default) system's directories. Those folders are "prefix". E.g. a library that has prefix/usr/local
is expected to have headers in/usr/local/include
, and the library itself will be in/usr/local/lib
. pkg-config however looks for libraries also in directory listed in the environment variable PKG_CONFIG_PATH.Then if you install software outside the default list of folders you had to "adjust" the list, namely add your directories to PKG_CONFIG_PATH
For more info, you can look here and here
It means you're trying to build something from source, and it can't find all of the dependencies it needs. The
pkg-config
script it uses to find the development files for those libraries, outputs this message.I was trying to install the latest version of axel and I ran
./configure
and I got this:So I tried:
and I got:
As obvious I had openssl installed (
sudo apt-get install openssl
) But on the above output as you can see it states "No package 'openssl' found". So to make sure I did:Turns out I need some other package for sure, so a little googling and I found that I had to install this package:
And all this had nothing to do with changing pkg-config path env variable.
Those who are using https://github.com/confluentinc/confluent-kafka-go
Please follow the installing librdkafka
Now you can use go install/ go run go build