"Unknown option -m" when running GTK4 + GJS Book example

I’m following GTK4 + GJS Book and I finished Creating the Project. Trying “flatpak run name” gives me “Unknown option -m” but gjs has “-m” option. I’m with Fedora Linux 38 (Workstation Edition). What am I missing and how can I debug such problems?

1 Like

Are you sure that you got the correct org.gnome.Platform version in your Flatpak manifest?
Try replacing the -m with --version to check whether you got the right GJS version.

Thank for replying!

Changing the -m wiht --version like this:

#!@GJS@ --version

gives me again:

Unknown option --version

This is my manifest:

{
“app-id” : “me.proton.urtsi.santsi.filebrowser”,
“runtime” : “org.gnome.Platform”,
“runtime-version” : “44”,
“sdk” : “org.gnome.Sdk”,
“command” : “me.proton.urtsi.santsi.filebrowser”,

"finish-args" : [
    "--socket=wayland",
    "--socket=fallback-x11",
    "--share=ipc",
    "--device=dri"
],

"cleanup" : [
    "/include",
    "/lib/pkgconfig",
    "/share/doc",
    "/share/man",
    "'*.a'",
    "'*.la'"
],

"modules" : [
    {
        "name" : "filebrowser",
        "buildsystem" : "meson",
        "sources" : [
            {
                "type" : "dir",
                "path" : "."
            }
        ]
    }
]

}

And I have installed:

GNOME Application Platform version 44
GNOME Software Development Kit version 44

That strongly suggests that the substitution of @GJS@ is not working. Can you provide the relevant bits from your meson.build?

I don’t think I made any intentional changes compared to the book, except for the meson_version and APP_ID.

meson.build:

Define our project

project(
‘filebrowser’,
version: ‘0.0.1’,
license: [‘GPL-3.0-or-later’],
meson_version: ‘>= 0.62.0’
)

APP_ID = ‘me.proton.urtsi.santsi.filebrowser’

Import the modules

gnome = import(‘gnome’)

Load instructions from subdirectories

subdir(‘data’)
subdir(‘src’)

src/meson.build

Configure the entry point

configure_file(
input : APP_ID + ‘.js’,
output : APP_ID,
configuration: {
‘GJS’: find_program(‘gjs’).full_path(),
‘PACKAGE_NAME’: APP_ID,
‘PACKAGE_VERSION’: meson.project_version(),
‘PREFIX’: get_option(‘prefix’),
‘LIBDIR’: get_option(‘prefix’) / get_option(‘libdir’)
},
install_dir: get_option(‘bindir’),
install_mode: ‘rwxr-xr-x’
)

Compile the resources

app_resource = gnome.compile_resources(
APP_ID + ‘.src’,
APP_ID + ‘.src.gresource.xml’,
gresource_bundle: true,
install: true,
install_dir : get_option(‘datadir’) / APP_ID
)

data/meson.build

Compile the resources

gnome.compile_resources(
APP_ID + ‘.data’,
APP_ID + ‘.data.gresource.xml’,
gresource_bundle: true,
install: true,
install_dir: get_option(‘datadir’) / APP_ID
)

Can you provide the actual script that gets run when you do flatpak run? In other words, what is the #!@GJS@ substituted with?

This is what I have currently:

#!/usr/bin/gjs --version

It runs if I paste it in the terminal and prints:

gjs 1.76.2

And this it what is executed (I think) for the flatpak :

#!/bin/sh
exec /usr/bin/flatpak run --branch=master --arch=x86_64 me.proton.urtsi.santsi.filebrowser “$@”

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.