18

I have Ubuntu 13.10 32 bit system. Recently when I try to to compile by running ./autogen.sh and ./configure I get

 PKG_PROG_PKG_CONFIG: command not found

error. I have libtool installed. I have three aclocal files in usr/share/ like alocal, aclocal-1.13 and aclocal-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 generate makefile I get

  PKG_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
kenn
  • 5,162
  • is the pkg-config package installed? does the file /usr/share/aclocal/pkg.m4 exist on your system? – steeldriver May 18 '14 at 14:03
  • What are you trying to compile? – jobin May 18 '14 at 14:35
  • @steeldriver find /usr -name "pkg.m4" gives me /usr/share/aclocal/pkg.m4 – kenn May 18 '14 at 15:55
  • @Jobin I am trying to compile this: https://codeload.github.com/blazt/submarine/zip/master – kenn May 18 '14 at 15:56
  • What does aclocal --print-ac-dir say? – steeldriver May 18 '14 at 16:01
  • @steeldriver it's /usr/local/share/aclocal – kenn May 18 '14 at 16:03
  • So 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 of automake maybe? – steeldriver May 18 '14 at 17:04
  • @steeldriver Yes, I think so, but I don't remember when. I reinstalled pkg-config but it didn't fix it. You helped me pinpoint the problem, Thank you. – kenn May 18 '14 at 17:12
  • You could try setting (or exporting) the ACLOCAL_PATH environment variable e.g. ACLOCAL_PATH=/usr/share/aclocal ./autogen.shorexport ACLOCAL_PATH=/usr/share/aclocal ; ./autogen.sh ; ./configure` - see here – steeldriver May 18 '14 at 17:20
  • @steeldriver It works. Would you post it as an answer? It might be helpful to readers. – kenn May 18 '14 at 17:27
  • please, add all the information of the comments to your question. – Braiam May 21 '14 at 21:15

1 Answers1

26

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.

steeldriver
  • 136,215
  • 21
  • 243
  • 336
  • Or, PKG_PROG_PKG_CONFIG could come from a typo in a variable assignment, e.g. PKG_PROG_PKG_CONFIG<space>=... instead of PKG_PROG_PKG_CONFIG=.... grep "PKG_PROG_PKG_CONFIG " on your files. – waltinator May 22 '14 at 15:38