fix(deps): only require LLVM when building the LLVM pass - #49
Open
w00tzenheimer wants to merge 1 commit into
Open
fix(deps): only require LLVM when building the LLVM pass#49w00tzenheimer wants to merge 1 commit into
w00tzenheimer wants to merge 1 commit into
Conversation
The dependencies superbuild included llvm.cmake unconditionally, so every dependency build either required a system LLVM install (USE_EXTERNAL_LLVM=ON -> find_package(LLVM REQUIRED CONFIG)) or built LLVM from source. Neither is needed for cobra-core: libcobra-core.a references zero LLVM symbols. LLVM is used only by lib/llvm, which the main project already gates on COBRA_BUILD_LLVM_PASS (CMakeLists.txt:64). Gate the superbuild the same way. This makes it possible to build cobra-core in environments without LLVM, such as cibuildwheel/CI images.
kyle-elliott-tob
approved these changes
Aug 11, 2026
Collaborator
|
Will merge after the CLA has been signed, thanks :) |
Author
|
Done! |
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.
Problem
dependencies/CMakeLists.txtincludesllvm.cmakeunconditionally. With thedefault
USE_EXTERNAL_LLVM=ONthat reachesfind_package(LLVM REQUIRED CONFIG)atdependencies/llvm.cmake:8, so everydependency build fails unless a system LLVM is installed. Setting
USE_EXTERNAL_LLVM=OFFavoids that only by building LLVM from source.Neither is needed for
cobra-core, which references zero LLVM symbols:LLVM is used only by
lib/llvm, which the main project already gates onCOBRA_BUILD_LLVM_PASS(CMakeLists.txt:64). The superbuild was missing thesame gate.
Fix
Gate
include(llvm.cmake)onCOBRA_BUILD_LLVM_PASS, matching the mainproject. Default is unchanged (OFF), so builds that do want the pass plugin
behave exactly as before by passing
-DCOBRA_BUILD_LLVM_PASS=ON.Verification
Counterfactual, with LLVM hidden from CMake. Before the change:
After the change the same command configures and builds cleanly:
The dependency prefix contains no LLVM afterwards, and
cobra-clilinks onlyCoreFoundation, libc++ and libSystem.
Verified on macOS arm64, macOS x86_64 and Linux (manylinux_2_28). Windows
additionally needs the companion MSVC fix, since
cobra-coredoes not compileunder MSVC today.
Motivation
This makes it possible to build
cobra-coreinside cibuildwheel images forPython bindings, where installing a full LLVM is not practical.