DEV Community

Yuki Ito
Yuki Ito

Posted on

3

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.

πŸ‘‹ While you are here

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay