Glib linking problem on installation of gobject-introspection

Using Alma Linux 8.9, gcc 8.5.0

On trying to compile and install gobject-introspection 1.80.0:

meson setup -Dprefix=$install_top_dir build

As part of the process, ‘glib’ is cloned and installed.

The resulting binaries, glib-compile-schemas in particular, is linked with the wrong (see that it is linked with the system libglib and libgobject instead of the library recently installed ~/autobuild/Linux-pc.internal-gtk4/lib64/

glib-compile-schemas is complied with new glib headers, so this causes a problem down the line when compiling pygobject:

~/autobuild/Linux-pc.internal-gtk4/bin/glib-compile-schemas: symbol lookup error: /home/pemsley/autobuild/Linux-pc.lmb.internal-gtk4/bin/glib-compile-schemas: undefined symbol: g_ptr_array_sort_values

ldd ~/autobuild/Linux-pc.internal-gtk4/bin/glib-compile-schemas (0x00007ffc6a95e000) => /lib64/ (0x00007f4c349e3000) => /lib64/ (0x00007f4c346c9000) => /lib64/ (0x00007f4c34476000) => /lib64/ (0x00007f4c340b1000) => /lib64/ (0x00007f4c33ea8000) => /lib64/ (0x00007f4c33ca4000) => /lib64/ (0x00007f4c33aa0000) => /lib64/ (0x00007f4c336af000) => /lib64/ (0x00007f4c3343e000) => /lib64/ (0x00007f4c3321e000) => /lib64/ (0x00007f4c33006000) => /lib64/ (0x00007f4c32ddb000) => /lib64/ (0x00007f4c32bc3000) => /lib64/ (0x00007f4c32969000) => /lib64/ (0x00007f4c32751000)
/lib64/ (0x00007f4c34d8d000) => /lib64/ (0x00007f4c32427000) => /lib64/ (0x00007f4c32209000) => /lib64/ (0x00007f4c31e88000) => /lib64/ (0x00007f4c31c75000) => /lib64/ (0x00007f4c31a3b000) => /lib64/ (0x00007f4c3180b000) => /lib64/ (0x00007f4c34eff000) => /lib64/ (0x00007f4c31587000) => /lib64/ (0x00007f4c31334000) => /lib64/ (0x00007f4c3112c000) => /lib64/ (0x00007f4c30f24000)

Is this a bug in glib or in gobject-introspection or my failure to use meson correctly?

Is this the cirular dependency problem? i.e. I need to install glib first?


Do not build GLib as a subproject of gobject-introspection, especially if you already have an installed GLib.

The process to build GLib and gobject-introspection is:

  1. build GLib with -Dintrospection=disabled and install it in the desired prefix
  2. build gobject-introspection and install it in the same prefix
  3. build GLib again with -Dintrospection=enabled, and install it in the same prefix

Yes, you need to build GLib twice. Yes, it’s a cycle. Yes, it’s currently unavoidable. Yes, it’s being addressed and will likely be fixed in the next cycle.

Thank you for your reply.

It seems as if I’m missing something.

I went back and tried to install just GLib (your step 1). I was unable to get GLib to link against its own libraries. This is what I tried:

    echo BUILDING: glib $glib_version without introspection
    wget -nv -N$glib_version_dir/glib-$glib_version.tar.xz
    tar xf glib-$glib_version.tar.xz
    cd glib-$glib_version
    if meson setup -Dprefix=$install_top_dir -Dintrospection=disabled build ; then
        cd build
        ninja install
        cd -
    cd -

However, the resulting glib-compile-schemas is (still) linked with the system GLib, not its own.

I am puzzled, it is not typical for a package not to use its own libraries (at least in my experience) - how do the GLib developers address this? This is not a very googleable issue.

Edit: Having done a bit more reading, perhaps I should be using JHBuild? (I would like, eventually to build and use the latest and greatest GTK4).