fix: patchelf LLVM runtime libs to fix stale RUNPATH#67
Merged
Conversation
libc++.so.1 depends on libatomic.so.1 (NEEDED). After mcpp copies the LLVM xpkg from xlings, the shared libraries retain xlings-era RUNPATH entries that point to non-existent paths. Since ELF RUNPATH is non-transitive, the loader uses libc++.so.1's own stale RUNPATH when searching for libatomic.so.1, causing runtime failure on systems without a system-installed gcc runtime. Fix: run patchelf_walk() on the LLVM lib/ directory (not bin/) after install, rewriting RUNPATH to point to the mcpp registry paths. This mirrors the existing GCC post-install fixup. The bin/ directory is excluded because clang++ has its own xlings-managed RUNPATH that must be preserved.
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
libc++.so.1retains stale xlings-era RUNPATH, causinglibatomic.so.1to not be found at runtimepatchelf_walk()on LLVMlib/directory after install to rewrite RUNPATH to mcpp registry pathslib/(notbin/) to preserve clang++'s own xlings-managed RUNPATHRoot Cause
libc++.so.1(NEEDED by user binaries) depends onlibatomic.so.1. ELF RUNPATH is non-transitive — the loader useslibc++.so.1's own RUNPATH (stale xlings paths) to findlibatomic.so.1, not the executable's RUNPATH.Test plan
mcpp toolchain install llvm 20.1.7completes,libc++.so.1RUNPATH points to mcpp registrymcpp new + mcpp runwith LLVM toolchain — nolibatomic.so.1error