CLI option --g-fatal-warnings failing with Gtk4

I was trying to debug the Gtk4 version of Swell-Foop, and discovered that the –g-fatal-warnings CLI option doesn’t work in this build, while it’s OK when rebuilding the Gtk3 main branch. Same happens for other games. What’s going wrong here? Is there a new way to do the same thing? Is my (recent) build somehow buggy?

GTK4 does not handle command line arguments any more.

You can use G_DEBUG=fatal-warnings in your environment to make any warning exit the process.

Thanks @ebassi, that explains things.

Do you know a way to pass this environment variable to gdb in command-line, to replace my usual jhbuild run gdb --args swell-foop --g-fatal-warnings?

The jhbuild run command will inherit the current environment:

G_DEBUG=fatal-warnings jhbuild run gdb --args swell-foop

You can also set environment variables inside GDB:

> set env G_DEBUG = fatal-warnings
> run
1 Like

Your second option works! at least that gives me a way to make things works, even if it’s boring to type this each time I run gdb. Is there a way to make these environment variables the default?

The first option doesn’t work, at least here. There’s one more level of complexity, as I’m using Fedora Silverblue with jhbuild in a container, so the complete command-line I run (without alias) is:

G_DEBUG=fatal-warnings toolbox run /home/aton/.local/bin/jhbuild run gdb --args swell-foop

An idea on how to have things work conveniently here?

You should look into the GDB documentation.

Either use jhbuild shell, to open a shell into the build; or write a script that can use launched by jhbuild run and sets up the environment for debugging.

1 Like

I forgot about that, and I think it will be good enough for me! Many thanks!

[aton@localhost swell-foop]$ toolbox run /home/aton/.local/bin/jhbuild shell
⬢[aton@toolbox swell-foop]$ G_DEBUG=fatal-warnings gdb --args swell-foop

Do we cover this in the migration guide? Might be good to add a paragraph specifically on --g-fatal-warnings

I’ve opened a merge request for the documentation.

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