[flatpak] introspection files not found in gnome-47 runtime (worked in 46)

Hi,

When converting a python flatpak project from gnome-46 to gome-47, the dependency’s introspection data are not found anymore.

Simple manifest example:

{
    "app-id": "com.example.TestVte",
    "runtime": "org.gnome.Platform",
    "runtime-version": "46",
    "sdk": "org.gnome.Sdk",
    "command": "test_vte",
    "finish-args": [
        "--device=dri",
        "--share=ipc",
        "--socket=fallback-x11",
        "--socket=wayland"
    ],
    "cleanup": [
        "/include",
        "/lib/pkgconfig",
        "/man",
        "/share/aclocal",
        "/share/doc",
        "/share/gtk-doc",
        "/share/man",
        "/share/pkgconfig",
        "*.la",
        "*.a"
    ],
    "modules": [
        {
            "name": "vte",
            "buildsystem": "meson",
            "config-opts": [
                "-Dglade=false",
                "-Dgtk3=false",
                "-Dgtk4=true",
                "-Dvapi=false"
            ],
            "sources": [
                {
                    "type": "git",
                    "url": "https://gitlab.gnome.org/GNOME/vte.git",
                    "tag": "0.78.0"
                }
            ]
        },
        {
            "name": "test_vte",
            "builddir": true,
            "buildsystem": "simple",
            "build-commands": [
                "echo '#!/usr/bin/env python3'        >  test_vte",
                "echo 'import gi'                     >> test_vte",
                "echo 'from gi.repository import Vte' >> test_vte",
                "echo 'print(Vte.get_user_shell())'   >> test_vte",
                "install -m 755 test_vte /app/bin/test_vte"
            ],
            "sources": [
            ]
        }
    ]
}

The executable script will load Vte and print the user shell path.

On gnome-46 runtime, it works and prints /bin/sh.
On gnome-47, it fails with an error “gi: Vte not found”.

Looking at the build logs, it seems gnome-47 installs the Vte’s GIR under /app/lib64/, while gnome-46 used /app/lib/.

Any idea what to change in the manifest to make it work on gnome-47?

Is this with the same version of VTE? cause I’d say that is most likely a bug in vte meson config.

Yes, same Vte version 0.78.0.

Just changing "runtime-version" from 46 to 47 will break.

You can test this manifest with Gnome-Builder, it’s standalone and does not require additional files. Just put it in an empty folder that you open as project.

VTE does not specify the installation directory for the GIR and typelib data, so Meson’s default will take precedence.

Meson defaults to ${prefix}/lib64 in various environments, so you must specify the --libdir=lib option when building with flatpak-builder, unless Meson detects being built in a Flatpak, and changes the default.

1 Like

Thanks for the hint! I’ll try that tonight.

Since version 1.4.3 flatpak-builder always passes --libdir to meson and autotools however it’s likely other tooling doesn’t mirror this and if left to meson it will pick up a broken lib64 default indeed. We used to have a patch for this but dropped it once flatpak-builder was fixed.

This isn’t the first time I thought of this, been thinking we should add this logic to meson itself as well so it figures out the correct directory regardless of the tooling used. Had the same issue with cargo-c (which mirrors meson’s logic ffor this as well) which I need to get back to.

1 Like

--libdir=lib works, thanks!

I must admit it’s a bit confusing, I naively expected the installation paths to be automatically handled by the toolchain, just like it already does --prefix=/app.

@gwillems I just tried building your manifest, it works fine over here.

What version of flatpak-builder are you using? if it’s from Builder, what version fo that and where did you got Builder from.

Could you try with flatpak-builder 1.4.3+ (Builder from flathub has an up to date version).

1 Like

OpenSUSE Tumbleweed 20240926, with default system versions:

  • Gnome Builder 46.3
  • flatpak-builder 1.4.2

I’ll try the flatpaked one…

With flatpak-builder 1.4.3+ I don’t need to manually specify libdir=lib anymore.

Thank you @alatiera for the tip!