How to fix "PKG_PROG_PKG_CONFIG: command not found" error?
The PKG_PROG_PKG_CONFIG
variable refers to a macro pkg.m4
that is provided as part of the pkg-config package, so the first thing to check is that pkg-config is installed and that the macro file is in the default location (and is readable, of course)
dpkg -l pkg-config
ls -l /usr/share/aclocal/pkg.m4
If that checks out, then the question becomes why is aclocal
not finding it? You can check where aclocal
is configured to look for third-party m4 files using the --print-ac-dir
switch i.e.
aclocal --print-ac-dir
If that's not the same as the location above, it suggests there is a non-standard version of automake on your system - if you can't resolve that, then a possible workaround is to set or export the ACLOCAL_PATH
environment variable before running the autogen.sh script e.g.
ACLOCAL_PATH=/usr/share/aclocal ./autogen.sh
or
export ACLOCAL_PATH=/usr/share/aclocal
./autogen.sh
./configure
See the macro search path section of the GNU automake manual.
Related videos on Youtube
Comments
-
kenn over 1 year
I have Ubuntu 13.10 32 bit system. Recently when I try to to compile by running
./autogen.sh
and./configure
I getPKG_PROG_PKG_CONFIG: command not found
error. I have
libtool
installed. I have three aclocal files inusr/share/
likealocal
,aclocal-1.13
andaclocal-1.4
How can I fix that alocal error?
EDIT:
Some time ago I compiled latest version of automake from source and installed it because a source code needed recent version of automake to run configure process. Since then whenever I run standard
./autogen
and/configure
commands in source directory to generatemakefile
I getPKG_PROG_PKG_CONFIG: command not found
error
find /usr -name "pkg.m4"
gives me
/usr/share/aclocal/pkg.m4
and
aclocal --print-ac-dir
gives me
/usr/local/share/aclocal
-
Admin almost 10 yearsis the
pkg-config
package installed? does the file/usr/share/aclocal/pkg.m4
exist on your system? -
Admin almost 10 yearsWhat are you trying to compile?
-
Admin almost 10 years@steeldriver
find /usr -name "pkg.m4"
gives me/usr/share/aclocal/pkg.m4
-
Admin almost 10 years@Jobin I am trying to compile this: codeload.github.com/blazt/submarine/zip/master
-
Admin almost 10 yearsWhat does
aclocal --print-ac-dir
say? -
Admin almost 10 years@steeldriver it's
/usr/local/share/aclocal
-
Admin almost 10 yearsSo the disconnect appears to be that your
pkg.m4
macro file is in/usr/share
but for some reason aclocal is looking in/usr/local/share
. It's difficult to suggest the best fix without knowing how you got in that situation - did you install a local (non-standard) version ofautomake
maybe? -
Admin almost 10 yearsYou could try setting (or exporting) the
ACLOCAL_PATH
environment variable e.g.ACLOCAL_PATH=/usr/share/aclocal
./autogen.sh` orexport ACLOCAL_PATH=/usr/share/aclocal ; ./autogen.sh ; ./configure
- see here -
Admin almost 10 yearsplease, add all the information of the comments to your question.
-
-
goo almost 10 yearsOr,
PKG_PROG_PKG_CONFIG
could come from a typo in a variable assignment, e.g.PKG_PROG_PKG_CONFIG<space>=...
instead ofPKG_PROG_PKG_CONFIG=...
.grep "PKG_PROG_PKG_CONFIG "
on your files.