ci(macos): link mrbind against libclang-cpp + libLLVM dylibs#6101
Open
Fedr wants to merge 10 commits into
Open
ci(macos): link mrbind against libclang-cpp + libLLVM dylibs#6101Fedr wants to merge 10 commits into
Fedr wants to merge 10 commits into
Conversation
mrbind#35 adds an opt-in for linking against libclang-cpp.dylib + libLLVM.dylib
instead of statically pulling in clangTooling. Homebrew's llvm@N is built with
LLVM_LINK_LLVM_DYLIB=ON, so the dynamic path is safe there (the runtime
`LLVM ERROR: inconsistency in registered CommandLine options` only fires on
apt-clang/Ubuntu where the granular libs collide).
Pass the flag in install_mrbind_macos.sh. Expected effect:
- mrbind binary shrinks ~6x on macOS
- per-platform cache entry for the macos-{x64,arm}-build runners drops from
~13 MiB to ~2 MiB, matching Rocky's already-dynamic linkage
Submodule bumped to mrbind#35 HEAD; will move to a master commit once that PR
merges.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mrbind#35 commit 7f600ed1 wraps clang-cpp / LLVM / LLVMSupport in `$<LINK_ONLY:...>` so their INTERFACE_INCLUDE_DIRECTORIES (specifically Homebrew's `/opt/homebrew/opt/llvm@N/include`) don't get propagated to mrbind sources at compile time. Without that, libc++'s `<cstddef>` can't find its own `<stddef.h>` wrapper and the build dies at the first source file. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The $<LINK_ONLY:...> attempt didn't stop the imported-target leakage (libc++ <cstddef> still failed). mrbind#35 now resolves clang-cpp / LLVM / LLVMSupport via find_library and links by absolute path, which adds them to the link line without any INTERFACE_* propagation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
No behaviour change vs the previous pin -- mrbind#35 now reorganizes the CMakeLists so the OFF branch keeps the original `clangTooling`-or-fallback shape verbatim, and the new find_library path is gated behind `MRBIND_LINK_CLANG_CPP_DYLIB=ON`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diagnostic step that dumps the contents of `$BREW_PREFIX/opt/llvm@$CLANG_VER/lib` on every macOS runner, separating `.a` static archives from `.dylib` dynamic libs. Helps confirm what each runner has installed for the dynamic-link path.
3 tasks
…nto ci/macos-link-clang-cpp-dylib
mrbind master switched to unconditional dynamic linking of clang-cpp + LLVM, so the opt-in flag no longer exists. Removing the now-dead cmake arg.
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.
Summary
Pass
-DMRBIND_LINK_CLANG_CPP_DYLIB=ONto mrbind's cmake configure inscripts/mrbind/install_mrbind_macos.sh. Bumps thethirdparty/mrbindsubmodule to a commit that exposes the new flag (MeshInspector/mrbind#35).Why
mrbind's parser currently statically pulls inclangToolingon macOS (and Ubuntu, Windows-MSYS2). The resulting binary is ~30 MiB stripped. On Rocky Linux the toolchain happens to take the alternative dynamic-link branch (clang-cpp + LLVMshared libs), giving a ~5 MiB stripped binary.Homebrew's
llvm@Nis built withLLVM_LINK_LLVM_DYLIB=ON, which means we can safely take the dynamic path on macOS without theLLVM ERROR: inconsistency in registered CommandLine optionsruntime crash that apt-clang/Ubuntu hits. MeshInspector/mrbind#35 adds an opt-in flag (MRBIND_LINK_CLANG_CPP_DYLIB) for exactly this case; this PR turns it on for macOS.The mrbind PR ended up needing two iterations: the naive
target_link_libraries(... clang-cpp ...)propagated Homebrew'sINTERFACE_INCLUDE_DIRECTORIES(/opt/homebrew/opt/llvm@N/include) into mrbind's compile commands and broke libc++'s<cstddef>include chain. Final shape usesfind_libraryto resolve to absolute lib paths, which CMake links without any usage-requirement propagation.Files changed
scripts/mrbind/install_mrbind_macos.sh— appends-DMRBIND_LINK_CLANG_CPP_DYLIB=ONto the cmake configure.thirdparty/mrbind— pinned to Add MRBIND_LINK_CLANG_CPP_DYLIB opt-in for smaller mrbind on macOS mrbind#35's HEAD.Linux and Windows are not affected — they continue to take the static
clangToolingpath because the option defaults toOFF.Submodule pin
thirdparty/mrbindadvances fromb895ca0d…to MeshInspector/mrbind#35's HEAD. Will move to a master commit once that PR merges.Test plan
macOS CI passes — verified on run 25877837374. All three macOS jobs (
x64 Release,arm64 Release,arm64 Debug) green;Build MRBind,Generate C bindings, andGenerate and build Python bindingsall succeed. NoLLVM ERROR: inconsistency in registered CommandLine optionsand no libc++<cstddef>failures.Cache footprint drops — all three macOS runners (two GitHub-hosted, one self-hosted) repopulated at the new size:
macos-15-intel)mrbind-build-macos-15-intel-clangmacos-14)mrbind-build-macos-14-clangmrbind-build-self-hosted-arm-clangMatches Rocky's footprint, as predicted.