From 254d98129d7eeb00d3fdc2f034b1ad074d0b0673 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sun, 6 Sep 2026 10:52:37 +0800 Subject: [PATCH] ci: use thin LTO for the armv7 sciter build The nightly armv7 sciter build aborts while compiling the final `rustdesk` binary: fatal runtime error: Rust cannot catch foreign exceptions error: could not compile `rustdesk` (bin "rustdesk") (signal: 6, SIGABRT) armv7 is the only 32-bit target in this job that links the whole binary, and `[profile.release]` uses fat LTO with codegen-units = 1, so LLVM merges every module into a single unit and runs past the ~3GB address space a 32-bit process gets. The allocation failure surfaces as a C++ bad_alloc unwinding into rustc's Rust frames, which is what that "foreign exceptions" abort is. The x86_64 sciter build uses the same settings and passes, as do aarch64 and every other 64-bit job in the same run, so this is specific to the 32-bit address space rather than to the source change itself. It started failing once the crate graph grew (hbb_common is pulled with the `webrtc` feature unconditionally), which pushed an already marginal target over the limit. Use thin LTO with more codegen units for armv7 only. Peak memory stays bounded while cross-crate inlining is kept, and 64-bit targets are untouched. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Lq6xFoeEmjcuKwRx1GfdQ2 --- .github/workflows/flutter-build.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml index c4d8f5289..0a7c09c25 100644 --- a/.github/workflows/flutter-build.yml +++ b/.github/workflows/flutter-build.yml @@ -2300,6 +2300,16 @@ jobs: # build rustdesk python3 ./res/inline-sciter.py export CARGO_INCREMENTAL=0 + # armv7 is the only 32-bit target in this job that links the whole binary, and the + # release profile uses fat LTO with codegen-units=1. LLVM then merges every module + # into a single unit and runs past the ~3GB address space a 32-bit process gets, + # aborting rustc with "Rust cannot catch foreign exceptions" (a C++ bad_alloc from + # LLVM unwinding into rustc's Rust frames). Thin LTO keeps peak memory bounded and + # still allows cross-crate inlining; 64-bit targets keep fat LTO untouched. + if [ "${{ matrix.job.arch }}" = "armv7" ]; then + export CARGO_PROFILE_RELEASE_LTO=thin + export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16 + fi cargo build --locked --features inline${{ matrix.job.extra_features }} --release --bins --jobs 1 # make debian package mkdir -p ./Release