Skip to content

fix(build): keep the host libgcc_s out of the Linux arm64 binary - #3708

Merged
Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
danielmeppiel-fix-linux-arm64-libgcc-bundle
Nov 13, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
danielmeppiel-fix-linux-arm64-libgcc-bundle

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

build-release.yml run 43322423829 on main fails Build & Test (ubuntu-24.04-arm, arm64, linux, apm-linux-arm64) in the "Build binary (Unix)" step. The glibc floor check added in #3553 reports:

[x] Bundled files require glibc newer than 2.28:
  GLIBC_2.35 dist/apm-linux-arm64/_internal/libgcc_s.so.1

Root cause, checked against the actual python-build-standalone release assets (cpython-3.12.16+20261110, and the same result for 3.12.15+20261021):

  • The aarch64 libpython3.12.so.1.0 lists NEEDED libgcc_s.so.1. It needs only two GCC_3.0 symbols (__extenddftf2, __trunctfdf2, the 128-bit long-double helpers). Its highest glibc symbol is still GLIBC_2.17.
  • The x86_64 libpython3.12.so.1.0 does not link libgcc_s at all. That is why x86_64 passed the same check with the same uv-managed Python. fix(build): lower the Linux binary glibc floor to 2.28 #3553 did not use a build container for x86_64 either.
  • The aarch64 wheels in the bundle (websockets, charset-normalizer, PyYAML) need only libc and libpthread.
  • PyInstaller therefore copied the ubuntu-24.04-arm runner's GCC 14 libgcc_s.so.1, which needs GLIBC_2.35 (_dl_find_object).

Fix: add libgcc_s.so.1 to the existing Linux _exclude_libs set in build/apm.spec, next to the other system libraries excluded under #462 and #1534. The binary then loads the host's libgcc_s.so.1, as x86_64 already does in effect. Every glibc distribution ships it as a base package (libgcc on RHEL/Rocky/Alma 8, libgcc-s1 on Debian/Ubuntu), and every version since GCC 3.0 provides the two GCC_3.0 symbols. Not bundling it also keeps a newer build-host copy out of LD_LIBRARY_PATH for child processes, which is the reason that set exists.

I did not switch to a manylinux_2_28 container. It would make arm64 build differently from x86_64 and change the build runner, while the exclusion fixes the actual cause.

The floor check (APM_MAX_GLIBC=2.28) and the Rocky Linux 8 smoke step are unchanged. The check still reads every bundled ELF file.

A regression test in tests/unit/test_build_spec.py fails if libgcc_s.so.1 is removed from _exclude_libs.

Issue and approved scope

Issue: Refs #3399

Human scope-approval comment: #3399 (comment) (delivered by #3553; the issue is closed)

This PR completes the arm64 half of the #3399 "Done when" list, which #3553 could not verify before merge because arm64 runs only in build-release.yml. The arm64 bundle needs to pass the glibc 2.28 check and run apm --version and apm install in Rocky Linux 8. Windows and macOS are unchanged, and the change stays inside the approved files (the release build and its tests).

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally

  • All existing tests pass

  • Added tests for new functionality (if applicable)

  • objdump -p / objdump -T against the python-build-standalone aarch64 and x86_64 install_only_stripped assets and the aarch64 manylinux wheels. Results are in the Description.

  • .venv/bin/python -m pytest -p no:xdist -q tests/unit/test_build_spec.py: 20 passed. Without the new test, the file has 19 tests.

  • Lint contract: ruff check and ruff format --check (ruff 0.15.12, the version pinned in uv.lock) pass on the changed test file. build/apm.spec is not linted by CI.

  • Not run locally: the arm64 PyInstaller build itself. Docker is unavailable on this host, and build-release.yml has no workflow_dispatch or PR trigger.

Post-merge verification: the push to main runs build-release.yml. The arm64 lane must pass "Build binary (Unix)" (glibc check reading every bundled ELF file) and "Smoke-test binary on Rocky Linux 8 (glibc 2.28)", which runs apm --version, apm init and apm install microsoft/apm-sample-package against the host's libgcc_s on an arm64 Rocky 8 container. A repository_dispatch manual-build-release will also run the tag-gate jobs on main.

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

python-build-standalone's aarch64 libpython lists libgcc_s.so.1 as NEEDED
(for GCC_3.0 long-double helpers); x86_64 does not. PyInstaller therefore
copied the ubuntu-24.04-arm runner's GCC 14 libgcc_s.so.1, which needs
GLIBC_2.35, and the APM_MAX_GLIBC=2.28 floor check failed the release lane.

Exclude libgcc_s.so.1 from the Linux bundle alongside the other system
libraries so the host's copy loads, as on x86_64. The floor check and the
Rocky Linux 8 smoke step are unchanged.

Refs #3399

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 23:12
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_now

Release-critical arm64 build fix: exclude host libgcc_s from the Linux bundle to restore the glibc 2.28 floor and unblock 0.36.0.

panel-mode=lean; personas=supply-chain-security-expert,test-coverage-expert,apm-ceo

cc Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

Both panelists agree. The supply-chain-security-expert finds that excluding libgcc_s.so.1 shrinks what the bundle ships and keeps the host-trust level unchanged: x86_64 already relies on the host for the same library. The PR adds no dependency and no new trust boundary. The test-coverage-expert confirms that the regression test (tests/unit/test_build_spec.py::TestSpecFileSyntax::test_linux_bundle_excludes_host_libgcc_s) passes at the unit tier, which suits a string added to an existing exclusion list. The CI objdump floor check and the Rocky Linux 8 smoke step test the result on both architectures.

The fix extends an exclusion list that has existed since #462/#1534. Keeping it, rather than building arm64 in a manylinux_2_28_aarch64 container, keeps the x86_64 and arm64 builds the same. The CHANGELOG folds into the #3553 line, so users read one entry about the glibc floor. The one gap: build-release.yml has no PR trigger, so the full PyInstaller build cannot run before merge. The post-merge push run and a repository_dispatch build-release are the planned check. That is acceptable for a one-line spec change backed by objdump analysis of the python-build-standalone release assets.

Aligned with: Portable by manifest: arm64 gets back to the glibc 2.28 floor, and the ELF gate and Rocky 8 smoke step still enforce it. Secure by default: the bundle ships one fewer library, and the host-trust level matches x86_64. Multi-harness / multi-host: arm64 and x86_64 both use the host's libgcc_s again.

Panel summary

Persona B R N Takeaway
Supply Chain Security Expert 0 0 0 No supply-chain concerns: libgcc_s joins the existing exclusion set, the host-trust level matches libc, all four defense layers stay in place, and the bundle shrinks.
Test Coverage Expert 0 1 0 The bug fix ships with an AST regression test (20/20 passed). CI objdump floor check and Rocky 8 smoke give integration proof. No coverage gap.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 1 follow-ups

  1. [Test Coverage Expert] After merge, confirm the push run and the manual build-release dispatch pass the arm64 floor check end to end. -- The unit test proves the spec entry exists, and the objdump analysis supports the fix. The full integration proof (PyInstaller bundle, floor gate, Rocky 8 smoke) only runs after merge. Treat the first green arm64 lane as the closing evidence for [FEATURE] Lower the glibc floor of prebuilt Linux binaries to 2.28 (RHEL/Rocky/Alma 8+, Debian 12, Ubuntu 22.04) #3399.

Recommendation

Neither panelist found a blocking issue, the regression test passes, and the bundle ships one fewer library. Both panelists agree on this release-critical fix to an existing mechanism. Ship it, then confirm that the first post-merge arm64 build-release lane passes the APM_MAX_GLIBC=2.28 check to close out #3399.


Full per-persona findings

Supply Chain Security Expert

No findings.

Test Coverage Expert

  • [recommended] The regression test covers the new exclusion entry, and existing CI provides integration-tier proof. At tests/unit/test_build_spec.py.
    test_linux_bundle_excludes_host_libgcc_s AST-parses build/apm.spec and asserts that libgcc_s.so.1 is in _exclude_libs, which is the right unit-tier check for a string added to an existing list. The objdump floor check and Rocky 8 smoke step in build-release.yml provide the integration proof. The PR touches no critical user-facing surface.
    Proof (passed): tests/unit/test_build_spec.py::TestSpecFileSyntax::test_linux_bundle_excludes_host_libgcc_s -- proves: the build spec excludes the host libgcc_s.so.1 from the Linux bundle.

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

Copilot AI 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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue
What changed in this PR

Updates the Linux arm64 release build to avoid bundling the build-host libgcc_s.so.1 (which can require a newer glibc than allowed), and adds a regression test to ensure the exclusion remains in place.

Changes:

  • Add libgcc_s.so.1 to the Linux _exclude_libs set in the PyInstaller spec to prevent bundling the host copy.
  • Add a unit test that asserts libgcc_s.so.1 remains excluded from the Linux bundle.
  • Update the changelog entry to reference this follow-up PR.
File Description
build/​apm.spec Excludes libgcc_s.so.1 from bundled binaries on Linux to keep the glibc floor.
tests/​unit/​test_build_spec.py Adds a regression test that inspects the spec AST to ensure libgcc_s.so.1 is excluded.
CHANGELOG.md Notes the follow-up PR number for the glibc 2.28 Linux binary change.

Review effort: Lite

Comment thread tests/unit/test_build_spec.py Resolved
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit dcefede into main Nov 13, 2026
23 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-fix-linux-arm64-libgcc-bundle branch November 13, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants