Skip to content

Support building wheels for manylinux and OSX - #22

Open
aaronj0 wants to merge 2 commits into
mainfrom
wheels-build-test-ci
Open

Support building wheels for manylinux and OSX#22
aaronj0 wants to merge 2 commits into
mainfrom
wheels-build-test-ci

Conversation

@aaronj0

@aaronj0 aaronj0 commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Rebased on top of #21 since we need that patch for relocatable wheels.

@aaronj0 aaronj0 changed the title Wheels build test ci Support building wheels for manylinux and OSX Aug 17, 2026
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

Test Results

Configuration Result
macos-26-intel-llvm21-py3.14-cxx20 = 439 passed, 44 skipped, 85 xfailed, 32 xpassed, 100 warnings in 90.00s (0:01:30) =
macos-26-llvm21-py3.14-cxx20 = 445 passed, 30 skipped, 95 xfailed, 30 xpassed, 100 warnings in 73.12s (0:01:13) =
ubuntu-24.04-llvm21-py3.14-cxx20-vg ====== 555 passed, 25 skipped, 18 xfailed, 2 xpassed in 95.78s (0:01:35) =======
ubuntu-24.04-llvm22-py3.14-cxx20 ====== 555 passed, 25 skipped, 19 xfailed, 1 xpassed in 100.01s (0:01:40) ======
ubuntu-24.04-llvm22-py3.14-cxx20-cling ====== 545 passed, 25 skipped, 27 xfailed, 3 xpassed in 95.91s (0:01:35) =======
ubuntu-24.04-llvm22-py3.14-cxx23 ====== 576 passed, 3 skipped, 20 xfailed, 1 xpassed in 107.93s (0:01:47) =======

@aaronj0

aaronj0 commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

@vgvassilev A note: The cleanest way to do this is to have wheel-builder images on ci-workflows that provision the image and LLVM build for manylinux and OS X. I will open a PR once I have a working draft locally and update the approach here to trigger that common workflow. That can then, in principle, be reused to build wheels for any other Python package based on LLVM under compiler-research

Comment thread pyproject.toml
archs = ["arm64"]
# eigen and boost are test-suite build deps; the LLVM toolchain is the
# llvm-wheel artifact wheels.yml stages at /opt/llvm before this runs.
before-all = "brew install eigen boost"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this assume you are using homebrew? Not everyone does use it on MacOS. I use Macports for example.

Comment thread pyproject.toml
environment = { CMAKE_ARGS = "-DLLVM_DIR=/opt/llvm/lib/cmake/llvm -DClang_DIR=/opt/llvm/lib/cmake/clang" }

[tool.cibuildwheel.macos]
archs = ["arm64"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know its being supported less and less, but what about MacOS intel. There is clearly appetite for it by people wanting to use cppjit (see #39 (comment))

Comment thread pyproject.toml
test-command = "python -m pip install -r requirements.txt && python .github/wheel_smoke.py && cd test && make -j$(sysctl -n hw.ncpu) PYTHON=python && python -m pytest -ra"
# 14.0 is the toolchain's own deployment floor (set at llvm-wheel build
# time); nothing brew-built ships in the wheel.
environment = { CMAKE_ARGS = "-DLLVM_DIR=/opt/llvm/lib/cmake/llvm -DClang_DIR=/opt/llvm/lib/cmake/clang", MACOSX_DEPLOYMENT_TARGET = "14.0" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused. Where does this /opt/llvm/ build come from?

Comment thread pyproject.toml
# LLVM/Clang 21 archives, pinned by sha256) at /opt/llvm.
before-all = "bash {project}/.github/cibw_before_all_linux.sh"
# CMAKE_ARGS reaches the CppInterOp ExternalProject sub-configure.
environment = { CMAKE_ARGS = "-DLLVM_DIR=/opt/llvm/lib/cmake/llvm -DClang_DIR=/opt/llvm/lib/cmake/clang" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same to MacOS quesion about the /opt/llvm/ build

Comment thread pyproject.toml
test-command = "python .github/wheel_smoke.py"

[tool.cibuildwheel.linux]
archs = ["x86_64"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about Linux arm?

Comment thread .github/cibw_before_all_linux.sh Outdated
# and linking LLVMSupport fails at generate time unless find_package(ZLIB)
# resolves, which needs zlib.h from the zlib package.
micromamba create -y -p /opt/llvm -c conda-forge 'llvmdev=21.*' 'clangdev=21.*' lld zlib
asset="llvm-wheel-21.1.8-ubuntu-24.04-x86_64-12af669f7a4444de.tar.zst"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still not sure if I understand the special llvm-wheel. How is it different from what we vendor?

@aaronj0 aaronj0 Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only different in the fact that it is built on top of the manylinux pypa container to ensure it satisfies the glibc floor and "standard" build environment when building wheels. We then vendor it the same way. We will need to have a separate llvm-wheel because we can only support one LLVM version and build config per-wheel. Some projects just do it from scratch with an alma8 container such as Triton which we could adopt but this approach is more reliable since PyPA controls the image there which is well tested against Python package deployment environments.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean that the other vendored llvms do not satisfy the libc versions?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because they are source built on ubuntu24 runners. We need to build on a manylinux image to publish the wheels for manylinux. Similarly we will need a new image for manylinux-aarch64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm...

@aaronj0

aaronj0 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

@mcbarton A comment: this PR is in development and some of the decisions here are still in discussion. I can request your review at a point things have converged. To answer your current questions:

Yes, Intel mac support is planned but is best-effort since macOS 27 drops support for those platforms. Currently the wheels ship with macOS deployment target 14.0 (the llvm-wheel toolchain's own floor). Linux aarch64 is planned as well.

The goal is to land the current wheel-building infrastructure before extending to more platforms, instead of having the entire thing arrive in one PR. That gives me a chance to verify the system before incrementally extending for more architectures (and more Python versions).

Regarding homebrew for eigen/boost: that's a test-time dependency, not part of how the wheel is built. The suite's probes now cover /opt/homebrew (arm64 brew) and /opt/local (MacPorts) as of the last commit, so whichever package manager provides eigen/boost, the tests find them.

On /opt/llvm: We build the llvm-wheel toolchain from compiler-research/ci-workflows on a manylinux image and OS X runner. Those archives are published on the recipe cache release (https://github.com/compiler-research/ci-workflows/releases/tag/cache) and this toolchain is staged at /opt/llvm by the 'before-all' step on linux and by the setup-recipe step in wheels.yml on macOS. I am still trying to figure out how to optimise this process further so bear that in mind.

@aaronj0
aaronj0 force-pushed the wheels-build-test-ci branch 3 times, most recently from e94d1e6 to afcfde2 Compare August 25, 2026 13:56
Comment thread pyproject.toml
test-sources = ["test", "requirements.txt", ".github/wheel_smoke.py"]
test-command = "python .github/wheel_smoke.py"

[tool.cibuildwheel.linux]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vgvassilev You can see here that the vendored LLVM is reused exactly as build args on the machine that builds the wheel. Those machines are configured in the matrix in wheels.yml:

- { os: ubuntu-24.04, label: manylinux-x86_64, arch: x86_64 }
- { os: macos-26,     label: macosx-arm64,     arch: arm64 }

So for every new target platform we can add a new row and extend the wheels infra. I hope this addresses your concern of any redundancy here

- uses: actions/checkout@v7

# ref pins the recipe content the cache key is computed from.
- uses: compiler-research/ci-workflows/actions/setup-recipe@main

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we reuse the recipe we created with manylinux

Comment on lines +62 to +73
- uses: pypa/cibuildwheel@v4.2.0

- uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.label }}
path: wheelhouse/*.whl

sdist:
name: sdist
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are standard PyPA cibuildwheel and sdist actions required to generate the Python wheel

@vgvassilev vgvassilev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think I am competent enough to review this, but lgtm... @henryiii, do you mind having a look?

@aaronj0
aaronj0 force-pushed the wheels-build-test-ci branch from afcfde2 to e327565 Compare August 25, 2026 16:51
@aaronj0
aaronj0 force-pushed the wheels-build-test-ci branch 2 times, most recently from 7e0f1aa to e71d2df Compare August 25, 2026 17:18
@aaronj0
aaronj0 force-pushed the wheels-build-test-ci branch from e71d2df to 684e839 Compare August 26, 2026 14:32
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.

3 participants