DEV Community

Yuki Ito
Yuki Ito

Posted on

pkg-config matters tripped me up in compiling porg

In compiling porg, I struggled with pkg-config failings so I'll left memo.

It was really smooth and no problem in past, but now it's failing on my refreshed PC as Ubuntu 17.10.

$ tar xf porg-0.10.tar.gz
$ ./configure

[...]

configure: error: Package requirements (gtkmm-3.0 >= 3.4.0) were not met:

No package 'gtkmm-3.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GTKMM_CFLAGS
and GTKMM_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Enter fullscreen mode Exit fullscreen mode

OK, let's install gtkmm-3.0.

$ sudo apt install libgtkmm-3.0-dev
$ ./configure

...

No package 'gtkmm-3.0' found

...
Enter fullscreen mode Exit fullscreen mode

No changes on error message.

$ pkg-config gtkmm-3.0 --libs --cflags
Package gtkmm-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtkmm-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtkmm-3.0' found
Enter fullscreen mode Exit fullscreen mode

Hmm... For some reason, gtkmm-3.0.pc is not recognized from pkg-config.

Where is PKG_CONFIG_PATH?

$ echo $PKG_CONFIG_PATH

$
Enter fullscreen mode Exit fullscreen mode

Oh, it's not set.

Ubuntu Manpage: pkg-config - Return metainformation about installed libraries

As the above manual, even if the environment variable is not set, pkg-config sees /usr/lib/pkgconfig, /usr/local/lib/pkgconfig, /usr/share/pkgconfig, /usr/local/share/pkgconfig.

OK. So, the where is gtkmm-3.0?

$ dpkg -L libgtkmm-3.0 | grep '\.pc'
/usr/lib/x86_64-linux-gnu/pkgconfig/gdkmm-3.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/gtkmm-3.0.pc
Enter fullscreen mode Exit fullscreen mode

Out of referenced paths. What is /usr/lib/x86_64-linux-gnu?

It seems to be called "MultiArch tuple".

Multiarch/Tuples - Debian Wiki

It shows ABI and CPU instruction types.

My architecture is x86_64-linux for sure so just adding it to $PKG_CONFIG_PATH.

$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/x86_64-linux-gnu
$ pkg-config gtkmm-3.0 --libs --cflags
Package xproto was not found in the pkg-config search path.
Perhaps you should add the directory containing `xproto.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xproto', required by 'xau', not found
Enter fullscreen mode Exit fullscreen mode

Hmm. Now xproto is needed.

Ubuntu – File list of package x11proto-core-dev/trusty-updates/all

It seems to be already installed and at /usr/share/pkgconfig so let's add it also to $PKG_CONFIG_PATH.

$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/share/pkgconfig
$ pkg-config gtkmm-3.0 --libs --cflags
-pthread -I/usr/include/gtkmm-3.0 -I/usr/lib/x86_64-linux-gnu/gtkmm-3.0/include -I/usr/include/atkmm-1.6 -I/usr/include/gtk-3.0/unix-print -I/usr/inc
lude/gdkmm-3.0 -I/usr/lib/x86_64-linux-gnu/gdkmm-3.0/include -I/usr/include/giomm-2.4 -I/usr/lib/x86_64-linux-gnu/giomm-2.4/include -I/usr/include/pa
...
Enter fullscreen mode Exit fullscreen mode

Looks good.

And ./configure; make; make install succeeded also.

Top comments (0)