Repository navigation
fix(linux): build with GLib older than 2.74 - #89
Merged
lijy91 merged 1 commit intoNov 3, 2026
Merged
Conversation
G_CONNECT_DEFAULT was added in GLib 2.74. Ubuntu 22.04 ships GLib 2.72, so shortcut_portal_linux.cpp does not compile there, and the whole library fails to build. Pass the value 0 directly, the same flags value on every GLib version.
Contributor
Author
|
@lijy91 kindly asking for a review here 🙏 |
lijy91
approved these changes
Nov 3, 2026
lijy91
left a comment
Member
There was a problem hiding this comment.
The zero-valued GConnectFlags cast preserves the existing signal behavior and avoids the GLib 2.74-only enum name. No actionable findings; all CI build jobs pass.
Member
Contributor
Author
Thanks! will use it ASAP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
I'm blocked from using this library in flutter - On Ubuntu 22.04, the library does not build.
shortcut_portal_linux.cppfails to compile:The same error stops every Flutter app that depends on
cnativeapi0.5.6 or 0.5.7 (for example throughtray_manager0.8.x orwindow_manager0.6.x), because the native-assets build hook compiles all sources:Ubuntu 22.04 is still a common build host, because a Linux app must be built on the oldest distribution that it supports.
Root cause
GLib added
G_CONNECT_DEFAULTin 2.74 (GConnectFlags: "Value: 0. Available since: 2.74"). Ubuntu 22.04 ships GLib 2.72.4. The README asks only for GTK 3, X11 and Xi, andapplication_linux.cppalready guardsG_APPLICATION_DEFAULT_FLAGSwithGLIB_CHECK_VERSION(2, 74, 0)for older distributions. The Wayland shortcut portal code from 0.5.6 added a new use of a GLib 2.74 name without such a guard. CI usesubuntu-latest(24.04, GLib 2.80), so it does not see the error.Fix
Pass
static_cast<GConnectFlags>(0).G_CONNECT_DEFAULThas the value 0, so the behavior does not change on any GLib version.Verification
I built the repository in an
ubuntu:22.04container (Ubuntu 22.04.5, GLib 2.72.4, GCC 11.4, CMake 3.22) with the same steps as the Linux CI job:main(472b2ad): the build fails with the error above.I also compiled the
cxx_implsources of the publishedcnativeapi0.5.7 package with clang 14 on the same image. With this change, all 102 Linux sources compile, and the shared library links.A Linux CI job on
ubuntu-22.04would catch this kind of error. I can add one in a separate PR if you want.🤖 Generated with Claude Code