Repository navigation
[CI][ORCJIT] Source manylinux LLVM from a release, link libstdc++ dynamically - #688
Merged
Merged
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
…amically The orcjit addon linked against conda-forge's LLVM, which is built with a newer GCC whose libstdc++ carries GLIBCXX_3.4.29+ symbols. Those exceed the manylinux_2_28 floor the project standardized on in apache#675, which is why the addon carried a -static-libstdc++/-static-libgcc workaround. Build LLVM from source inside the manylinux_2_28 image instead (gcc-toolset-14, static + PIC + RTTI, native target only), publish the install prefix as a compressed release asset, and have CI download it. Because that toolchain sits at the manylinux ABI floor, the workaround is no longer needed: * Linux acquires /opt/llvm by downloading llvm-<version>-linux-<arch>.tar.zst and extracting it. macOS/Windows keep the conda-forge binaries (no GLIBCXX floor); their actions/cache step is split out so their install gating is unchanged. Everything downstream is unchanged -- same /opt/llvm, same LLVM_PREFIX, same bind-mount into the build container. * Drop -static-libstdc++/-static-libgcc, so the addon no longer bakes in a private copy of the C++ runtime. The repaired wheels are tagged manylinux_2_27/manylinux_2_28, confirming the prefix stays under the floor, and the addon's exported dynamic symbols drop from ~965 to ~30 -- it no longer re-exports a private libstdc++ that could interpose with a host's own copy. The by-name --exclude-libs list is deliberately kept rather than collapsed to --exclude-libs,ALL. The embedded liborc_rt.a is linked by the JIT at run time and resolves its C++ runtime through the process, including archive-only helpers such as _ZSt28__throw_bad_array_new_lengthv that libstdc++.so does not export; ALL localizes those and the ORC platform fails to materialize. That is true whether libstdc++ is static or dynamic, so the comment there is corrected accordingly. Prebuilt LLVM is produced out-of-band, so this removes the ~50 minute from-source build from the CI path; the Linux orcjit jobs now spend a few minutes downloading.
cyx-6
force-pushed
the
ci/llvm-from-source
branch
from
July 28, 2026 13:47
c24bbeb to
03f5df4
Compare
cyx-6
marked this pull request as ready for review
July 28, 2026 14:11
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
tqchen
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The orcjit addon links against conda-forge's LLVM, which is built with a newer GCC whose libstdc++ carries
GLIBCXX_3.4.29+symbols. Those exceed themanylinux_2_28floor this project standardized on in #675, which is why the addon has carried a-static-libstdc++/-static-libgccworkaround since the original addon PR (#254).This builds LLVM from source inside the
manylinux_2_28image instead, publishes the install prefix as a release asset, and has CI download it. Because that toolchain already sits at the manylinux ABI floor, the workaround is no longer needed.What changes
/opt/llvmis obtained by downloadingllvm-<version>-linux-<arch>.tar.zstand extracting it, instead of being built or installed via conda. macOS/Windows keep the conda-forge binaries (no GLIBCXX floor); theiractions/cachestep is split out so their install gating is unchanged. Everything downstream is untouched — same/opt/llvm, sameLLVM_PREFIX, same bind-mount into the build container.-static-libstdc++/-static-libgcc, so the addon no longer bakes in a private copy of the C++ runtime.The by-name
--exclude-libslist is deliberately kept rather than collapsed to--exclude-libs,ALL. I tried that; it fails. The embeddedliborc_rt.ais linked by the JIT at run time and resolves its C++ runtime through the process, including archive-only helpers such as_ZSt28__throw_bad_array_new_lengthvthatlibstdc++.sodoes not export —ALLlocalizes those and the ORC platform fails to materialize (Failed to materialize symbols: { (<Platform>, ...) }). That holds whether libstdc++ is static or dynamic, so the comment there is corrected rather than the flag changed.Results
Full CI green on all four platforms. The repaired wheel names are the ABI evidence — auditwheel tags them:
i.e. the prefix stays under the floor with libstdc++ linked dynamically. The addon's exported dynamic symbols drop from ~965 to ~30, since it no longer re-exports a private libstdc++ that could interpose with a host's own copy (e.g. PyTorch's bundled LLVM), and the C++ runtime references (
_Znwm,__cxa_throw,__gxx_personality_v0) are nowUND, served by the process. Tests: 89 passed x86_64 / 87 passed aarch64, plus the quick-start C and C++ examples.Prebuilt LLVM is produced out-of-band, so this also removes a ~50 minute from-source build from the CI path; the Linux orcjit jobs now spend a few minutes downloading.
Notes for reviewers
Two things worth flagging that are not visible in the diff:
mlc-ai/package, which is outside the ASF org. The asset is currently a pre-release, and the workflow that produces it lives on an unmerged branch there. That side should land (and ideally be promoted out of pre-release) before this is merged — hence the draft status. The download source is parameterized via thellvm_release_repoinput if you would prefer it mirrored elsewhere.publish_orcjit_wheel.ymlinherits this. It calls the same composite action without passingllvm_version/llvm_release_repo, so published PyPI wheels will also start sourcing LLVM from that release. This is a supply-chain change to a published artifact that the diff does not visibly touch.Builds on #675 (
manylinux_2_28standardization), which is what makes the floor the right target.