Skip to content

Patch atkversion.h in sysroots to add C linkage declarations - #195883

Open
vhaudiquet wants to merge 1 commit into
flutter:masterfrom
vhaudiquet:atk-sysroot-c-linkage
Open

vhaudiquet wants to merge 1 commit into
flutter:masterfrom
vhaudiquet:atk-sysroot-c-linkage

Conversation

@vhaudiquet

Copy link
Copy Markdown
Contributor

The atkversion.h header in at-spi2-core (Debian Bullseye 2.38 and Trixie 2.56.2) lacks G_BEGIN_DECLS/G_END_DECLS, causing link failures when included from C++ code. This was fixed upstream in https://gitlab.gnome.org/GNOME/at-spi2-core/-/merge_requests/219 but the fix has not yet propagated to all Debian stable releases.

Previously, fl_view_accessible.cc and fl_accessibility_handler_test.cc worked around this by wrapping #include <atk/atk.h> in extern "C" { }. This breaks on Trixie sysroots where atk.h pulls in headers with C++ features that cannot be inside an extern "C" block.

This commit:

  • Adds PatchAtkVersionHeader() to install-sysroot.py, which patches atkversion.h after sysroot extraction to add G_BEGIN_DECLS/ G_END_DECLS (the same fix as upstream MR 219). Idempotent.
  • Removes the extern "C" workaround from fl_view_accessible.cc and fl_accessibility_handler_test.cc, relying on the patched header for proper C linkage.

Debian Trixie sysroot is needed for #178712, so this fix is needed in order to be able to build riscv64 at all, but also more generally to upgrade any build to use a Trixie sysroot instead of bookworm.

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant in-code documentation (doc comments with ///).
  • If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@vhaudiquet
vhaudiquet requested a review from a team as a code owner November 3, 2026 09:37
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) platform-linux Building on or for Linux specifically a: desktop Running on desktop team-linux Owned by the Linux platform team labels Nov 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request automates patching of atkversion.h in the Linux sysroot to add missing C linkage declarations, allowing the removal of local extern "C" workarounds in C++ files. Feedback on the changes highlights that the newly added Python function uses 2-space indentation instead of the 4-space indentation required by the Google Python Style Guide, and suggests specifying the file encoding when opening files.

@vhaudiquet
vhaudiquet force-pushed the atk-sysroot-c-linkage branch 2 times, most recently from 75de51f to 9f8a780 Compare November 3, 2026 10:32
@richyo-codes

richyo-codes commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

FYI I also experimented with enabling Trixie builds but for x86-64 and tracked here

Regarding the ATK headers I took more of a work around approach, while you fixed at sysroot level which I believe is better root cause solution

I will track and close duplicate if your approach is accepted.

@robert-ancell robert-ancell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution is a more complicated/obscure than I'd like, but it does work around the problem. I'm currently looking at replacing the ATK code, so this can be removed in the future if we progress with that.

@robert-ancell robert-ancell added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Nov 9, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 9, 2026
@auto-submit

auto-submit Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/195883, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a member of flutter-hackers before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@auto-submit

auto-submit Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/195883, because - The status or check suite ci.yaml validation has failed. Please fix the issues identified (or deflake) before re-applying this label.

The atkversion.h header in at-spi2-core (Debian Bullseye 2.38 and
Trixie 2.56.2) lacks G_BEGIN_DECLS/G_END_DECLS, causing link failures
when included from C++ code. This was fixed upstream in
https://gitlab.gnome.org/GNOME/at-spi2-core/-/merge_requests/219
but the fix has not yet propagated to all Debian stable releases.

Previously, fl_view_accessible.cc and fl_accessibility_handler_test.cc
worked around this by wrapping #include <atk/atk.h> in extern "C" { }.
This breaks on Trixie sysroots where atk.h pulls in headers with C++
features that cannot be inside an extern "C" block.

This commit:
- Adds PatchAtkVersionHeader() to install-sysroot.py, which patches
  atkversion.h after sysroot extraction to add G_BEGIN_DECLS/
  G_END_DECLS (the same fix as upstream MR 219). Idempotent.
- Removes the extern "C" workaround from fl_view_accessible.cc and
  fl_accessibility_handler_test.cc, relying on the patched header
  for proper C linkage.
@vhaudiquet
vhaudiquet force-pushed the atk-sysroot-c-linkage branch from 9f8a780 to 1bc8231 Compare November 10, 2026 15:41
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 10, 2026
@vhaudiquet

Copy link
Copy Markdown
Contributor Author

Rebased on top of main. As far as I understand, this is what was making CI fail.

FormatException: ERROR: Mac_x64 ios_app_with_extensions_test is a new builder added. it needs to be marked bringup: true
If ci.yaml wasn't changed, try git fetch upstream && git merge upstream/master

Should be ok now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: desktop Running on desktop engine flutter/engine related. See also e: labels. platform-linux Building on or for Linux specifically team-linux Owned by the Linux platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants