linuxubuntupkg-configgobject-introspection

pkg-config cannot find adequate gobject-introspection-1.0 dependency on Ubuntu 24.04


I have a meson build that fails with:

Called: `/usr/bin/pkg-config --modversion gobject-introspection-1.0` -> 1
stderr:
Package dependency requirement 'glib-2.0 >= 2.80.0' could not be satisfied.
Package 'glib-2.0' has version '2.72.0', required version is '>= 2.80.0'
Package dependency requirement 'gobject-2.0 >= 2.80.0' could not be satisfied.
Package 'gobject-2.0' has version '2.72.0', required version is '>= 2.80.0'

as far as I understand this is because /usr/lib/x86_64-linux-gnu/pkgconfig/gobject-introspection-1.0.pc contains:

Name: gobject-introspection
Description: GObject Introspection
Version: 1.80.1
Requires: glib-2.0 >= 2.80.0, gobject-2.0 >= 2.80.0

If I check what I have installed:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                             Version        Architecture Description
+++-================================-==============-============-===========================================================
un  gir1.2-gobject-2.0               <none>         <none>       (no description available)
un  gir1.2-gobject-2.0-dev           <none>         <none>       (no description available)
ii  gobject-introspection:amd64      1.80.1-1       amd64        Generate interface introspection data for GObject libraries
ii  gobject-introspection-bin        1.80.1-1       amd64        Executables for gobject-introspection
un  gobject-introspection-bin-linux  <none>         <none>       (no description available)
un  gobject-introspection-repository <none>         <none>       (no description available)
ii  libcairo-gobject2:amd64          1.18.0-3build1 amd64        Cairo 2D vector graphics library (GObject library)
un  libgobject-2.0-0                 <none>         <none>       (no description available)

... there is no libgobject-2.0 package installed on my system but if I try to install it:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libglib2.0-0t64' instead of 'libgobject-2.0-0'
libglib2.0-0t64 is already the newest version (2.80.0-6ubuntu3.1).

Also /usr/lib/x86_64-linux-gnu/pkgconfig/gobject-2.0.pc says:

Name: GObject
Description: GLib Type, Object, Parameter and Signal Library
Version: 2.80.0
Requires: glib-2.0
Requires.private: libffi >=  3.0.0
Libs: -L${libdir} -lgobject-2.0
Cflags: -I${includedir}

So what is pkg-config looking at to determine that 2.72 version? Because ind /usr -name *.pc -exec grep -l -F '2.72' {} + doesn't find anything while find /usr -name *.pc -exec grep -l -F '2.80' {} + finds a few...

And more generally, how can I fix this?

System is a freshly installed (K)Ubuntu-24.04, freshly rebooted after apt-update+apt-upgrade.

I have seen this question but I already have the dev package. I have also seen this one but there is no requirements.txt.


Solution

  • So what is pkg-config looking at to determine that 2.72 version?

    We can't say specifically because that's dependent on your machine and your personal environment, but you can get pkg-config to tell you. For example,

    pkg-config --path glib-2.0
    

    In addition to a couple of standard directories, pkg-config will consult any directories designated in environment variable PKG_CONFIG_PATH, plus any additional directories specified on the command line. Command-line arguments could be snuck in unbeknownst to you in a couple of ways, but if you're getting configuration from a non-standard source then my first guess would be that it is one named in PKG_CONFIG_PATH.

    how can I fix this?

    It depends on where the rogue PC directory is being configured, but if it is indeed from PKG_CONFIG_PATH then the best fix would probably be by appropriate modification to your shell configuration scripts, either to remove lines setting an inappropriate custom value for that variable, or to add lines overriding an inappropriate value coming from elsewhere. Note that changes to your shell configuration scripts don't automatically take effect in shells that you have already started.