pkg-config matters tripped me up in compiling porg
Tags: memo, linux
Published: 2017-12-05 01:47:41

---
title: pkg-config matters tripped me up in compiling porg
published: true
description: 
tags: memo,linux
---

In compiling [porg](http://porg.sourceforge.net/), 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.

```bash
$ 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.
```

OK, let's install `gtkmm-3.0`.

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

...

No package 'gtkmm-3.0' found

...
```

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
```

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


Where is PKG_CONFIG_PATH?

```
$ echo $PKG_CONFIG_PATH

$
```

Oh, it's not set.

[Ubuntu Manpage: pkg-config - Return metainformation about installed libraries](http://manpages.ubuntu.com/manpages/trusty/man1/pkg-config.1.html)

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`?

```bash
$ 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
```

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

It seems to be called "MultiArch tuple".

[Multiarch/Tuples - Debian Wiki](https://wiki.debian.org/Multiarch/Tuples)

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
```

Hmm. Now `xproto` is needed.

[Ubuntu – File list of package x11proto-core-dev/trusty-updates/all](https://packages.ubuntu.com/en/trusty-updates/all/x11proto-core-dev/filelist)

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

```bash
$ 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
...
```

Looks good.

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