You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Distributed libLLVM conflicts with system libraries #55737
Now that libLLVM.so is distributed with rust, we are unable to dynamically link a rust binary against a different libLLVM.so library. The rustlib directory containing libLLVM is prepended to the linker search path, and I don't see a good way to ask cargo to add a search path earlier than the rustlib is added. It looks to me like the rustlib directory is added here:
I noticed that support for appending a suffix to the LLVM libs was added in #53987. Can we turn that on for CI so the prebuilt distributions have a suffix on the library?
This is not just a redistribution problem, but also leads to a general FTBFS while bootstrapping with clang compilers since rust 1.34.0.
1.34.0 now seems to put libLLVM.dylib into the stage0-$arch/lib artifacts dir and use that via DYLD_LIBRARY_PATH, so subsequent usages of clang will fail to execute.
1.33.0 and prior didn't do this. They only created a librustc_codegen_llvm-llvm.dylib file as a later stage artifact (1? 2?), which didn't clash with system libraries.
I'm stupid - rust isn't compiling its own version of llvm - at least not when passing --llvm-root.
The problem is that the precompiled 1.33 binaries that are used to bootstrap rust contain a libLLVM.dylib file which makes compiling with clang impossible since the rust-root lib directory is added to the dynamic linker library path, overriding the correct LLVM library.
I'm stupid - rust isn't compiling its own version of llvm - at least not when passing --llvm-root. ...
@Ionic The problem is most likely the same in as in cargo, people assume DYLD_LIBRARY_PATH is equivalent to LD_LIBRARY_PATH and set it to whatever but it's actually not thes same. DYLD_LIBRARY_PATH is a hack and should not be used at all if possible because it overrides default system search paths. Instead, DYLD_FALLBACK_LIBRARY_PATH should be used; as those paths are only searched if a suitable library cannot be found in the default locations.
Activity
emilio commentedon Mar 18, 2019
This should be fixed by #59173.
rinon commentedon Mar 18, 2019
#59173 fixed this on Linux, thanks! The issue still persists on OS X because the filename is always
libLLVM.dylibas mentioned above.Ionic commentedon Apr 20, 2019
This is not just a redistribution problem, but also leads to a general FTBFS while bootstrapping with clang compilers since rust 1.34.0.
1.34.0 now seems to put
libLLVM.dylibinto thestage0-$arch/libartifacts dir and use that viaDYLD_LIBRARY_PATH, so subsequent usages ofclangwill fail to execute.1.33.0 and prior didn't do this. They only created a
librustc_codegen_llvm-llvm.dylibfile as a later stage artifact (1? 2?), which didn't clash with system libraries.Ionic commentedon Apr 24, 2019
I'm stupid - rust isn't compiling its own version of
llvm- at least not when passing--llvm-root.The problem is that the precompiled 1.33 binaries that are used to bootstrap rust contain a
libLLVM.dylibfile which makes compiling with clang impossible since the rust-root lib directory is added to the dynamic linker library path, overriding the correct LLVM library.Lord-Kamina commentedon Aug 16, 2019
@Ionic The problem is most likely the same in as in cargo, people assume
DYLD_LIBRARY_PATHis equivalent toLD_LIBRARY_PATHand set it to whatever but it's actually not thes same.DYLD_LIBRARY_PATHis a hack and should not be used at all if possible because it overrides default system search paths. Instead,DYLD_FALLBACK_LIBRARY_PATHshould be used; as those paths are only searched if a suitable library cannot be found in the default locations.Sent with GitHawk
Enselic commentedon Oct 2, 2025
Triage: Is this still a problem?