Skip to content

Create a universal binary for macos.#12

Merged
floitsch merged 12 commits intopatch-head-5.1.0from
floitsch/patch-head-5.1.0.universal-macos
Apr 6, 2026
Merged

Create a universal binary for macos.#12
floitsch merged 12 commits intopatch-head-5.1.0from
floitsch/patch-head-5.1.0.universal-macos

Conversation

@floitsch
Copy link
Copy Markdown
Member

@floitsch floitsch commented Apr 6, 2026

Make a universal binary for macos.

floitsch added 12 commits April 6, 2026 12:40
Replace separate macos-amd64 (macos-13) and macos-aarch64 builds with
a single universal2 build on macos-latest. The fat binary works natively
on both Intel and Apple Silicon Macs.

Upload the archive under both legacy names (macos-aarch64, macos-amd64)
for backwards compatibility.

Add verification step using lipo and arch -x86_64 to confirm both
architectures work.
The setup-python action installs arm64-only Python on macOS ARM
runners, causing PyInstaller to fail with "not a fat binary" errors
when building universal2 binaries.

Install the official python.org universal2 framework build instead,
so all native extensions (bitarray, cryptography, etc.) are compiled
as fat binaries.
The python.org installer only provides python3/pip3 binaries.
Create symlinks so bare 'python' and 'pip' commands work.

Also fix comment about why we use python.org instead of setup-python.
Pip downloads arm64-only wheels on ARM runners regardless of whether
Python itself is universal2. Use --no-binary :all: with ARCHFLAGS to
compile native extensions (bitarray, cffi, pyyaml, tibs) as fat
binaries for the universal2 PyInstaller build.
The python.org manual install is unnecessary — setup-python already
installs universal2 Python. The ARCHFLAGS + --no-binary fix handles
the actual problem (pip's wheel selection).
bitstring 4.4.0 dynamically imports bitstore_bitarray, which
PyInstaller doesn't detect. Add --hidden-import for esptool and
espefuse builds.
bitstring 4.4.0 has many dynamically imported submodules. Collect them
all rather than chasing individual ones.
--no-binary :all: breaks cryptography (needs Rust toolchain).
Instead, install normally first, then force-reinstall only the
packages that don't publish universal2 wheels (bitarray, cffi,
pyyaml, tibs) from source with ARCHFLAGS.
tibs uses maturin/Rust and needs the x86_64 target to build a
universal2 fat binary on an ARM runner.
tibs 0.5.7 requires Rust edition 2024, but the ubuntu 22.04 apt
package only provides Cargo 1.75.0. Install Rust via rustup to get
a recent enough version.

Also add --collect-submodules bitstring for the same PyInstaller
hidden import issue as the main build.
A shell comment inside a backslash-continued apt-get command broke
the line continuation, causing 'build-essential: command not found'.
@floitsch floitsch requested a review from kasperl April 6, 2026 16:15
@floitsch
Copy link
Copy Markdown
Member Author

floitsch commented Apr 6, 2026

TBR.

@floitsch floitsch merged commit 43be523 into patch-head-5.1.0 Apr 6, 2026
6 checks passed
@floitsch floitsch deleted the floitsch/patch-head-5.1.0.universal-macos branch April 6, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant