Skip to content

fix(macos): build wheels for macOS 11+ instead of macOS 15+ - #29

Merged
jameskermode merged 1 commit into
masterfrom
fix/macos-deployment-target
Jun 9, 2026
Merged

jameskermode merged 1 commit into
masterfrom
fix/macos-deployment-target

Conversation

@jameskermode

Copy link
Copy Markdown
Member

Problem

Published macOS wheels required macOS 15+ (macosx_15_0), so pip install extxyz failed on macOS 11–14 with "no compatible version" / a dyld load error. Reported by a user on macOS arm64 / Python 3.12 installing into a mamba env.

Root cause (verified against the live PyPI wheel): CI set MACOSX_DEPLOYMENT_TARGET=15.0 and bundled Homebrew's PCRE2 bottle (compiled for the runner's macOS), so both _extxyz.so and the bundled libpcre2-8.0.dylib carried minos 15.0. Lowering only the env var is insufficient — the Homebrew dylib stays pinned to the runner's macOS (a real cibuildwheel run fails delocation; on a current runner Homebrew PCRE2 is minos 26.0).

Fix

On macOS, build a static PCRE2 from source at the wheel's deployment target and link it into _extxyz.so (via PKG_CONFIG_PATH) instead of bundling Homebrew's bottle.

  • tools/wheels/build_pcre2_macos.sh — static PCRE2 (JIT + PIC) at MACOSX_DEPLOYMENT_TARGET.
  • pyproject.toml — before-all runs the script; MACOSX_DEPLOYMENT_TARGET=11.0 + PKG_CONFIG_PATH in [tool.cibuildwheel.macos.environment].
  • build-wheels.yml — drop the CIBW_ENVIRONMENT_MACOS override (a single env var would replace, not merge with, the pyproject environment table, silently dropping PKG_CONFIG_PATH).
  • subprojects/pcre2.wrap — refresh to WrapDB pcre2_10.44-2; the pinned -1 patch hash had gone stale, which had separately broken the meson subproject fallback for source/standalone builds.

Verification (local cibuildwheel, committed config only)

cp312-macosx_arm64 → 264 KB wheel containing only _extxyz.so: minos 11.0, PCRE2 statically linked (nothing vendored, no pcre2grep/headers leaking into user envs), test suite passes during build, installs + imports under Python 3.12.

🤖 Generated with Claude Code

The published macOS wheels were tagged `macosx_15_0` because CI set
MACOSX_DEPLOYMENT_TARGET=15.0 and bundled Homebrew's PCRE2 (a bottle compiled
for the runner's macOS 15). Both the extension and the bundled
`libpcre2-8.0.dylib` carried `minos 15.0`, so `pip install extxyz` failed on
macOS 11-14 with "no compatible version" / a dyld load error — which is what a
user on macOS arm64 hit when installing into a Python 3.12 (mamba) env.

Fix: on macOS, build a static PCRE2 from source at the wheel's deployment
target (11.0, the oldest arm64 macOS) and link it into `_extxyz.so` via
PKG_CONFIG_PATH, instead of using the Homebrew bottle. The resulting wheel
ships only the extension module (no vendored dylib), is tagged `macosx_11_0`,
and loads on macOS 11+.

- tools/wheels/build_pcre2_macos.sh: static PCRE2 build (jit, PIC) at target
- pyproject.toml: use the script in before-all; set MACOSX_DEPLOYMENT_TARGET
  and PKG_CONFIG_PATH in [tool.cibuildwheel.macos.environment]
- build-wheels.yml: drop the conflicting CIBW_ENVIRONMENT_MACOS override (a
  single env var would replace, not merge with, the pyproject environment table)
- subprojects/pcre2.wrap: refresh to WrapDB pcre2_10.44-2 (the pinned -1 patch
  hash had gone stale, which broke the meson subproject fallback used by
  source/standalone builds)

Verified locally with cibuildwheel (cp312-macosx_arm64): 264 KB wheel,
`_extxyz.so` minos 11.0, PCRE2 statically linked, test suite passes, installs
and imports under Python 3.12.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jameskermode
jameskermode merged commit ec5a0e5 into master Jun 9, 2026
42 of 43 checks passed
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.

1 participant