Repository navigation
Route get_toolchain() through ppbt.archive_for(triplet) for cross builds - #353
Merged
Merged
Conversation
Pre-0.2.0 ppbt only exposed `ARCHIVE` which pointed at the host native toolchain, so a cross-arch request on an x86_64 host silently extracted the x86_64 tarball into `<data>/toolchain/aarch64-linux-gnu/` and the downstream build used x86_64 gcc with an aarch64 target triplet. ppbt 0.2.0 adds `archive_for(triplet)` which resolves cross triplets through the `ppbt.toolchains` entry point to the matching `ppbt-cross-<triplet>` sibling package. - Use `archive_for(triplet)` when the ppbt in use exposes it; fall back to `ARCHIVE` for compat with 0.1.x installs. - If the resolved archive doesn't exist (user hasn't installed the `ppbt[cross-<triplet>]` extra), surface a clear error instead of silently extracting the host tarball — unless the target toolchain dir already exists from a prior run, in which case we return it. - Expose matching extras in pyproject.toml so `pip install relenv[toolchain-cross-aarch64-linux-gnu]` pulls in the sibling package. - Extend _mock_ppbt_module to simulate 0.2.0+ shape and cover three new cases: cross-triplet routed via archive_for, missing cross archive raises, missing archive + existing toolchain returns dir.
dwoz
force-pushed
the
switch-ppbt-archive-for-triplet
branch
from
November 21, 2026 10:09
bd1f1c4 to
d6e129d
Compare
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.
Summary
Switches relenv's
get_toolchain()to look up the toolchain tarball viappbt.common.archive_for(triplet)(ppbt 0.2.0+) so a cross-arch request on an x86_64 host picks the aarch64 tarball out of the siblingppbt-cross-aarch64-linux-gnupackage, and vice versa. Pre-0.2.0 ppbt only exposedARCHIVE(host native only), so cross-arch requests silently extracted the host tarball and the downstream build ended up calling x86_64 gcc with an aarch64 target triplet — the root reason gh-37's cross-build path was never actually exercised end-to-end.ppbt 0.2.0 is already on PyPI with the new sibling packages (
ppbt-cross-aarch64-linux-gnucarries amanylinux_2_17_x86_64wheel;ppbt-cross-x86_64-linux-gnucarries amanylinux_2_17_aarch64wheel). Sibling packages register themselves via theppbt.toolchainsentry point.Changes
relenv/common.py: usearchive_for(triplet)when ppbt exposes it; fall back toARCHIVEfor compat with 0.1.x. Missing cross archive + no existing toolchain dir raises a helpful"pip install ppbt[cross-<triplet>]"message.pyproject.toml: bump thetoolchainextra toppbt>=0.2.0, addtoolchain-cross-aarch64-linux-gnu,toolchain-cross-x86_64-linux-gnu,toolchain-cross-allextras that forward the ppbt extras through.tests/test_common.py: extend_mock_ppbt_moduleto simulate 0.2.0+ shape; add three new tests covering cross-triplet routing, missing-cross-archive error, and graceful fallback to an already-extracted dir.Test plan
pytest tests/test_common.py tests/test_relocate.py— 75 pass, 3 skipped.pre-commit run— clean (ruff, ruff-format, mypy, copyright-headers).pip install relenv[toolchain-cross-aarch64-linux-gnu], confirm PR Fix relocate stripping RPATH on cross-compiled builds (#37) #352's relocate fails on cross compiled builds #37 fix (readelf-based RPATH handling) works against a real foreign-arch ELF produced by the local build.