Skip to content

Commit d7be479

Browse files
committed
Fix macOS Python 3.11 build by removing brewed liblzma
Python 3.11 is now the first actions/setup-python Python built to target universal2 (i.e., x86_64/arm64 multiarch) on macOS. Brewed packages such as xz (which provides liblzma.dylib and liblzma.a) are built for only a single native architecture. This led to build and configure failures when the native-only liblzma.dylib was linked against by a multiarch compilation. Work around this by unlinking the xz package so that this brewed library is not found by the linker, failing back to the system .tbd file instead. If later build steps use brewed commands that need this library, we may need to `brew link` it again later, but for now we get away without it.
1 parent 3e1ab70 commit d7be479

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ jobs:
1010
os: [ubuntu, macos]
1111
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
1212
exclude:
13-
# Run only the latest 3.x on macOS
13+
# Run only the latest two 3.x versions on macOS
1414
- os: macos
1515
python-version: 3.7
1616
- os: macos
1717
python-version: 3.8
1818
- os: macos
1919
python-version: 3.9
20-
- os: macos
21-
python-version: 3.11
2220

2321
steps:
2422
- name: Checkout pysam
@@ -32,12 +30,18 @@ jobs:
3230
- name: Install prerequisite Python libraries
3331
run: pip install cython pytest pytest-pep8
3432

35-
- name: Install build prerequisites
33+
- name: Install Linux build prerequisites
3634
if: runner.os == 'Linux'
3735
run: |
3836
sudo apt-get update
3937
sudo apt-get install -q --no-install-recommends --no-install-suggests libcurl4-openssl-dev
4038
39+
- name: Update macOS build prerequisites
40+
if: runner.os == 'macOS'
41+
run: |
42+
# Remove brewed liblzma (if any), as it is not multiarch
43+
brew unlink xz || true
44+
4145
- name: Build (directly from checkout)
4246
run: python setup.py build
4347

0 commit comments

Comments
 (0)