Skip to content

manylinux: stop at glibc 2.17 on every arch except x86_64 and i686 - #92

Merged
patrickballard merged 5 commits into
wheelgap:mainfrom
shounakjoshi88-a11y:fix/manylinux-glibc-floor
Nov 9, 2026
Merged

patrickballard merged 5 commits into
wheelgap:mainfrom
shounakjoshi88-a11y:fix/manylinux-glibc-floor

Conversation

@shounakjoshi88-a11y

Copy link
Copy Markdown
Contributor

Closes #79

What this changes

manylinux_platforms() in src/wheelgap/targets.py enumerated manylinux_2_* floors from the target's glibc down to 2.5 (plus legacy aliases) for every architecture. pip only accepts floors down to 2.5 on x86_64/i686: in packaging._manylinux.platform_tags the oldest floor is (2, 4)-exclusive on x86 and (2, 16)-exclusive everywhere else, whose range bottoms out at minor 17 — those arches had no manylinux before manylinux2014 (PEP 599). So wheelgap counted e.g. manylinux_2_12_aarch64 as accepted on linux-aarch64 when pip would refuse it.

The function now stops at minor 17 unless the arch is x86_64/i686:

oldest = 5 if arch in ("x86_64", "i686") else 17
for m in range(minor, oldest - 1, -1):

A target whose --glibc is itself below its arch floor (e.g. linux-aarch64 --glibc 2.12) now enumerates no manylinux tags at all, just plain linux_<arch> — which is exactly what pip takes on such a host. Legacy-alias gating (_LEGACY_ARCHES) is untouched: manylinux2014_<arch> still appears at 2.17 and manylinux2010/manylinux1 aliases stay x86-only. musllinux_platforms is untouched (PEP 656 has no arch floors).

New tests in tests/test_targets.py (the issue's two named cases plus the rest of the glibc arches):

  • test_manylinux_below_2_17_is_rejected_outside_x86_arches[aarch64/armv7l/ppc64le/s390x/riscv64] — manylinux_2_12_<arch> rejected on each of the five arches' targets.
  • test_manylinux_2_12_is_still_accepted_on_x86_64
  • test_manylinux_stops_at_2_17_outside_x86_and_i686 — 2.17 present / 2.12 absent on all five; manylinux2014_aarch64 still in; x86_64/i686 still carry 2.5.
  • test_manylinux_target_below_the_arch_floor_takes_only_plain_linux — linux-aarch64 with glibc=(2, 8) → ["linux_aarch64"].

What I ran: uv run --group dev pytest / ruff format . / ruff check . / mypy all clean — 332 passed, 1 skipped (324 before + these 8 test items); the new tests fail on the unfixed code (verified by stashing targets.py and re-running). As a user: uv run wheelgap numpy -t all → wheel for all 8 targets; uv run wheelgap numpy -t linux-aarch64 → wheel accepted; uv run wheelgap numpy -t linux-aarch64 --glibc 2.12 → correctly a gap ("1 will build from source"), since numpy's 2.28-floor aarch64 wheel can't run on a 2.12 target. Floor cross-checked against the installed packaging (26.3) source (platform_tags's too_old_glibc2 and range bottoms). Windows box, so platform_tags couldn't run as a live host; the constants and range semantics are read from the module and mirrored.

armv7l isn't in packaging's _ALLOWED_ARCHS host-ELF set but is detected through _is_linux_armhf; it gets the same 2.17 floor. No CHANGELOG-adjacent README change is needed (no new flag, target or input format).

Checklist

  • Tests added or updated (no network access: use fake_pypi or a fixture)
  • uv run --group dev ruff format . and uv run --group dev ruff check . pass
  • uv run --group dev pytest passes
  • CHANGELOG.md has a line under ## Unreleased (if users would notice the change)
  • README updated (if there's a new flag, target or input format) — N/A, none of these

…heelgap#79)

pip (packaging._manylinux.platform_tags) generates manylinux floors down to
glibc 2.5 only on x86_64 and i686 (`too_old_glibc2 = (2, 4)`); every other
arch's first manylinux was 2.17 (manylinux2014), and it yields no floors
below 2.17 (`too_old_glibc2 = (2, 16)`). wheelgap generated them all the
way down for every arch, so `manylinux_2_12_aarch64` counted as accepted on
`linux-aarch64` though pip would refuse it. `manylinux_platforms` now stops
at minor 17 unless the arch is x86_64 or i686; a target whose `--glibc` is
itself below the arch floor takes only plain `linux_<arch>` wheels, as pip
does.

armv7l is not in packaging's host-ELF `_ALLOWED_ARCHS` but is detected by
`_is_linux_armhf` and gets the same 2.17 floor; `musllinux_platforms` is
untouched (PEP 656 has no such arch floors). The legacy-alias gating is
untouched: `manylinux2014_<arch>` still appears at 2.17, and
`manylinux2010`/`manylinux1` stay x86-only.

Closes wheelgap#79
@patrickballard

Copy link
Copy Markdown
Collaborator

Thanks @shounakjoshi88-a11y, this is a really careful fix! The new floor lines up exactly with packaging._manylinux.platform_tags, the legacy aliases stay untouched, and the tests cover all five non-x86 arches plus the below-the-floor case. CI is green across the board. Two small things before it can go in:

  1. src/wheelgap/targets.py, manylinux_platforms: pip only applies the 2.17 floor when the glibc major is 2 (for any other major its min_minor is -1). As written, oldest = 17 applies to every major, so e.g. -t linux-aarch64 --glibc 3.20 would now also drop manylinux_3_16_aarch64 and below. glibc 3 doesn't exist yet, so this is hypothetical, but the point of the issue is to agree with pip exactly. Something like this keeps the floor to major 2:

    oldest = 17 if major == 2 and arch not in ("x86_64", "i686") else 5

    A one-line test would be nice too, e.g. "manylinux_3_12_aarch64" in manylinux_platforms("aarch64", (3, 20)).

  2. CHANGELOG.md: the entry says "On Linux targets other than linux-x86_64, and for i686, wheelgap now stops at manylinux_2_17". That reads as if i686 stops at 2.17 too, when it's the other way round, and wheelgap has no i686 target anyway. Suggested wording:

    On linux-aarch64, linux-armv7l, linux-ppc64le, linux-s390x and linux-riscv64, wheelgap now stops at manylinux_2_17 like pip does, since those architectures had no manylinux before manylinux2014. So manylinux_2_12_aarch64 is no longer counted as accepted on linux-aarch64, and a target with --glibc below 2.17 takes only plain linux_<arch> wheels. linux-x86_64 still goes down to 2.5. (manylinux: don't accept glibc below 2.17 on arm, ppc64le, s390x and riscv64 #79)

Prompt for your AI assistant (if you use one)
In the wheelgap repo, on this PR branch:
1. In src/wheelgap/targets.py, in manylinux_platforms, change
   `oldest = 5 if arch in ("x86_64", "i686") else 17`
   to
   `oldest = 17 if major == 2 and arch not in ("x86_64", "i686") else 5`
   so the 2.17 floor only applies to glibc major 2, as in packaging._manylinux.platform_tags.
2. In tests/test_targets.py, add an assertion (e.g. in test_manylinux_stops_at_2_17_outside_x86_and_i686) that
   "manylinux_3_12_aarch64" is in manylinux_platforms("aarch64", (3, 20)).
3. In CHANGELOG.md, replace the #79 line under "## Unreleased" / "### Fixed" with:
   - On `linux-aarch64`, `linux-armv7l`, `linux-ppc64le`, `linux-s390x` and `linux-riscv64`, wheelgap now stops at `manylinux_2_17` like pip does, since those architectures had no manylinux before manylinux2014. So `manylinux_2_12_aarch64` is no longer counted as accepted on `linux-aarch64`, and a target with `--glibc` below 2.17 takes only plain `linux_<arch>` wheels. `linux-x86_64` still goes down to 2.5. (#79)
Then run `uv run --group dev ruff format .`, `uv run --group dev ruff check .` and `uv run --group dev pytest`, and push.

(Review assisted by Claude.)

@patrickballard

patrickballard commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

@shounakjoshi88-a11y, a few additions to the review above, from a second pass. The two points there still stand: keep the floor to glibc major 2, and fix the i686 wording. On top of those:

  1. --explain reason. A manylinux_2_12_aarch64 wheel on linux-aarch64 is now rejected, but --explain says it "doesn't match linux-aarch64", which reads like a wrong-arch wheel. The iOS and Android branches of _platform_reason in src/wheelgap/check.py already have a floor message. A matching one here would explain it, e.g. manylinux_2_12_aarch64 is older than glibc 2.17, the oldest pip accepts on aarch64. A case in tests/test_explain.py would pin it.
  2. Pin the exact floor in tests. An off-by-one (oldest = 16) would pass every new test, because they check that 2.17 is present and 2.12 is absent, and the below-floor test uses 2.8. Exact lists at the boundary cover it, e.g. glibc=(2, 17) gives ["manylinux_2_17_aarch64", "manylinux2014_aarch64", "linux_aarch64"] and glibc=(2, 16) gives ["linux_aarch64"].
  3. CHANGELOG format. Either wording is fine. Please drop the ### Fixed heading (Unreleased is one flat list until release), and end the line with the PR number and credit: (#92, thanks [@shounakjoshi88-a11y](https://github.com/shounakjoshi88-a11y)).
Prompt for your AI assistant (if you use one): covers both reviews
In the wheelgap repo, on this PR's branch:
1. src/wheelgap/targets.py, manylinux_platforms: apply the 2.17 floor only when the glibc major is 2:
   oldest = 17 if major == 2 and arch not in ("x86_64", "i686") else 5
   Keep the floor (2, 17) and the x86 arch set as module-level constants. Add a test that
   "manylinux_3_12_aarch64" is in manylinux_platforms("aarch64", (3, 20)).
2. src/wheelgap/check.py, _platform_reason: after the two glibc/musl mismatch checks, when same_arch and
   kind == "manylinux" and family == "manylinux" and major == 2 and arch is not x86 and minor < 17,
   return f"{plat} is older than glibc 2.17, the oldest pip accepts on {arch}", reusing the constants
   from targets.py. Add a case to tests/test_explain.py: a manylinux_2_12_aarch64 wheel on linux-aarch64.
3. tests/test_targets.py: assert exact lists at the boundary for linux-aarch64:
   glibc=(2, 17) -> ["manylinux_2_17_aarch64", "manylinux2014_aarch64", "linux_aarch64"]
   glibc=(2, 16) -> ["linux_aarch64"]
4. CHANGELOG.md: remove the "### Fixed" heading under "## Unreleased" and make the entry one bullet:
   "- `linux-aarch64`, `linux-armv7l`, `linux-ppc64le`, `linux-s390x` and `linux-riscv64` no longer accept
   `manylinux` wheels older than glibc 2.17 (e.g. `manylinux_2_12_aarch64`), matching pip: those arches had
   no manylinux before manylinux2014. (#92, thanks [@shounakjoshi88-a11y](https://github.com/shounakjoshi88-a11y))"
Then run `uv run --group dev ruff format .`, `uv run --group dev ruff check .`,
`uv run --group dev mypy` and `uv run --group dev pytest`, and push.

(Review assisted by Claude.)

@shounakjoshi88-a11y

Copy link
Copy Markdown
Contributor Author

Pushed fc7e0a0 covering both reviews:

  • The 2.17 floor now applies only to glibc major 2, same shape as your line but driven by MANYLINUX_FLOOR = (2, 17) and MANYLINUX_X86_ARCHES module-level constants in targets.py. A test asserts manylinux_3_12_aarch64 is present at glibc (3, 20).
  • _platform_reason now returns "is older than glibc 2.17, the oldest pip accepts on aarch64" for a same-arch glibc-major-2 manylinux below the floor (manylinux_2_12_aarch64 gets a real reason instead of "doesn't match linux-aarch64"), reusing the target constants; pinned in test_rejection_reasons.
  • Exact lists pinned at the floor: glibc (2, 17) gives exactly ["manylinux_2_17_aarch64", "manylinux2014_aarch64", "linux_aarch64"], glibc (2, 16) gives ["linux_aarch64"] - an off-by-one to 16 would fail them.
  • CHANGELOG: flat under Unreleased with your wording and the thanks credit.

Gates: ruff format/check clean, mypy clean, pytest 333 passed 1 skipped.

@patrickballard

Copy link
Copy Markdown
Collaborator

Thanks @shounakjoshi88-a11y, this covers everything from both reviews, and the exact-list tests at the 2.16/2.17 boundary are exactly what was needed. The --explain message reads well too. An independent second review also found nothing to change in the code.

One thing is blocking it: the branch now has a merge conflict in CHANGELOG.md, because 0.6.1 was released after you branched off 0.6.0. GitHub doesn't run CI on a conflicting PR, so no checks have run on fc7e0a0 yet.

Once that's pushed, CI will run, and if it's green this can go in.

(Review assisted by Claude.)

patrickballard and others added 3 commits November 9, 2026 13:16
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@patrickballard
patrickballard merged commit 43f7f58 into wheelgap:main Nov 9, 2026
9 checks passed
@patrickballard

Copy link
Copy Markdown
Collaborator

Merged, thanks @shounakjoshi88-a11y, and welcome! Your update covered both reviews well. We moved the CHANGELOG line back under Unreleased after merging main, and added one more --explain case for the legacy manylinux2010_aarch64 name. Great first contribution.

@shounakjoshi88-a11y

Copy link
Copy Markdown
Contributor Author

Merged - thanks for the two thorough review rounds; the boundary-list pinning suggestions made the fix much stronger. Happy to help with the follow-ups here anytime.

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.

manylinux: don't accept glibc below 2.17 on arm, ppc64le, s390x and riscv64

2 participants