From 6f70b8d737d76ef21e639046de86a1eb8e3bad80 Mon Sep 17 00:00:00 2001 From: Jacob Alexander Date: Sat, 30 May 2026 11:42:28 -0700 Subject: [PATCH] ci: build libcapnp for the target arch on macOS The macos-15 runner is arm64. Previously, cp38 was the first Python in the cibuildwheel matrix, and because the cp38 macOS installer is x86_64-only, cibuildwheel ran the build under \`arch -x86_64\`, which also caused CMake to build libcapnp as x86_64. Subsequent Python versions then reused that cached x86_64 libcapnp. After dropping cp38, cp39 is built first and CMake auto-detects the host arch (arm64), producing an arm64 libkj/libcapnp. The x86_64 wheel then silently links via \`-undefined dynamic_lookup\` (the linker just ignores arm64 archive members) and fails at dlopen time with "symbol not found in flat namespace ... AsyncIoStream::getsockopt". Set CMAKE_OSX_ARCHITECTURES to the matrix arch on macOS so libcapnp is always built for the wheel's target architecture. --- .github/workflows/wheels.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 8902601..093d2e2 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -48,8 +48,10 @@ jobs: CIBW_SKIP: "cp38-*" CIBW_TEST_REQUIRES: pytest pytest-asyncio CIBW_TEST_COMMAND: pytest {project} - # Only needed to make the macosx arm64 build work - CMAKE_OSX_ARCHITECTURES: "${{ matrix.arch == 'arm64' && 'arm64' || '' }}" + # Force libcapnp to build for the target arch on macOS (the runner + # is arm64, so without this an x86_64 wheel ends up linking against + # an arm64 libkj/libcapnp and failing to load at test time). + CMAKE_OSX_ARCHITECTURES: "${{ runner.os == 'macOS' && matrix.arch || '' }}" - uses: actions/upload-artifact@v6 with: