Closed
Description
I noticed that some CI builds started breaking over winter break with the 1.49.0 release of rustc. It looks like this is the behavior I'm running into:
$ echo 'fn main() {}' > foo.rs
$ rustc foo.rs --target wasm32-unknown-unknown
$ `rustup which rustc` foo.rs --target wasm32-unknown-unknown
error: linking with `rust-lld` failed: exit code: 127
|
= note: "rust-lld" "-flavor" "wasm" "--rsp-quoting=posix" "-z" "stack-size=1048576" "--stack-first" "--allow-undefined" "--fatal-warnings" "--no-demangle" "--export-dynamic" "--no-entry" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/self-contained" "foo.foo.7rcbfp3g-cgu.0.rcgu.o" "foo.foo.7rcbfp3g-cgu.1.rcgu.o" "foo.foo.7rcbfp3g-cgu.2.rcgu.o" "foo.foo.7rcbfp3g-cgu.3.rcgu.o" "foo.foo.7rcbfp3g-cgu.4.rcgu.o" "foo.foo.7rcbfp3g-cgu.5.rcgu.o" "-o" "foo.wasm" "--export" "main" "--export=__heap_base" "--export=__data_end" "foo.belfx9afw9cmv8.rcgu.o" "--gc-sections" "-O0" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libstd-57520f873e4386ea.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libpanic_abort-2bb76cd91836cd74.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libdlmalloc-2362cd2b752fe8cf.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/librustc_demangle-4e35388d2cf809d9.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libhashbrown-7528bb1d1a92d729.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/librustc_std_workspace_alloc-46e1c6d1138ee9b3.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libunwind-ffe09f2236ae74f5.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libcfg_if-f26ee661ae55669e.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/liblibc-0476900897b6039b.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/liballoc-b0c04b53f6ac3156.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/librustc_std_workspace_core-50344da360c5e489.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libcore-0b67ff3e00a8bf99.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libcompiler_builtins-5ca68120625f03c4.rlib"
= note: rust-lld: error while loading shared libraries: libLLVM-11-rust-1.49.0-stable.so: cannot open shared object file: No such file or directory
error: aborting due to previous error
This appears to work with 1.48.0. It looks like in Rust 1.48.0 the rust-lld
executable had libLLVM statically linked and now it has it dynamically linked. Unless the rustup wrapper is executed though (which munges LD_LIBRARY_PATH
I believe) the executable no longer works (e.g. if you execute the rustc binary directly).
I think this is a case where the -rpath
business may need to get involved? Ideally rust-lld
would know that its libraries, when installed, are a few layers up.
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: linking into static, shared libraries and binariesCategory: This is a bug.Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcHigh priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.