Description
Summary
I am trying to build LLVM in-tree as a shared library and then link against it as if it were an external, prebuilt installation (e.g. setting llvm-config
in the bootstrap config). When I try this, stage 1 builds fail to locate libLLVM
on macOS. This does not occur on an x86_64-unknown-linux-gnu
system.
Command used
Replace <host>
with the current host.
./x.py build llvm
export LD_LIBRARY_PATH="absolute/path/to/build/<host>/llvm/build/lib"
./x.py build —stage 1 --set target.<host>.llvm-config="absolute/path/to/build/<host>/llvm/bin/llvm-config"
Expected behaviour
The build should succeed on macOS like it does on Linux.
Actual behaviour
The build fails at the very end with the following message:
dyld[7250]: Library not loaded: @rpath/libLLVM.dylib
Bootstrap configuration (config.toml)
profile = "dist"
change-id = 134650
[llvm]
download-ci-llvm = false
link-shared = true
Operating system
- Ubuntu 22.04.5 (
x86_64-unknown-linux-gnu
) - macOS 15.3.2 (
aarch64-apple-darwin
)
HEAD
Additional context
I haven't modified anything other than my bootstrap config.
I am trying to do this so that I can test changes to a custom LLVM instrumentation pass without having to rebuild the Rust frontend. This is purely for convenience during development—the project's CI pipeline builds and tests everything with rustc statically linked to LLVM in the usual way. The variable LD_LIBRARY_PATH
is set by default to that directory in the development environment.