error while loading shared libraries: libLLVM-17-rust-1.75.0-stable.so for stable rust
soruh opened this issue · 3 comments
soruh commented
Checklist
- I've looked through the issues and pull requests for similar reports
Describe your issue
Cross fails to compile any project which depends on the libc
crate when using the latest stable
toolchain, but works when using the latest nightly
.
What target(s) are you cross-compiling for?
armv7-unknown-linux-gnueabihf, x86_64-unknown-linux-gnu
Which operating system is the host (e.g computer cross is on) running?
- macOS
- Windows
- Linux / BSD
- other OS (specify in description)
What architecture is the host?
- x86_64 / AMD64
- arm32
- arm64 (including Mac M1)
What container engine is cross using?
- docker
- podman
- other container engine (specify in description)
cross version
cross 0.2.5 (f272b47 2024-02-06)
Example
% rustup default stable
stable-x86_64-unknown-linux-gnu unchanged - rustc 1.75.0 (82e1608df 2023-12-21)
% cargo uninstall cross
[...]
% cargo install cross --git https://github.com/cross-rs/cross
[...]
% cargo new testcase
% cd testcase
% cargo add libc
% cargo build
[...]
Finished dev [unoptimized + debuginfo] target(s) in 0.46s
% cross build -v
+ cargo metadata --format-version 1
+ rustc --print sysroot
+ /usr/bin/docker
+ /usr/bin/docker version -f '{{ .Server.Os }},,,{{ .Server.Arch }}'
+ /usr/bin/docker info -f {{.SecurityOptions}}
+ rustup toolchain list
+ rustup target list --toolchain stable-x86_64-unknown-linux-gnu
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
+ /usr/bin/docker run --userns host -e 'XARGO_HOME=/home/soruh/.xargo' -e 'CARGO_HOME=/home/soruh/.cargo' -e 'CROSS_RUST_SYSROOT=/home/soruh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu' -e 'CARGO_TARGET_DIR=/target' -e 'CROSS_RUNNER=' -e TERM -e 'USER=soruh' -e 'CROSS_RUSTC_MAJOR_VERSION=1' -e 'CROSS_RUSTC_MINOR_VERSION=75' -e 'CROSS_RUSTC_PATCH_VERSION=0' --name cross-stable-x86_64-unknown-linux-gnu-495a4-82e1608df-x86_64-unknown-linux-gnu-82bae-1707401153581 --rm --user 1000:1001 -v /home/soruh/.xargo:/home/soruh/.xargo:z -v /home/soruh/.cargo:/home/soruh/.cargo:z -v /home/soruh/.cargo/bin -v /tmp/tmp.cOSKY5EQKP/testcase:/tmp/tmp.cOSKY5EQKP/testcase:z -v /home/soruh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/home/soruh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:z,ro -v /tmp/tmp.cOSKY5EQKP/testcase/target:/target:z -w /tmp/tmp.cOSKY5EQKP/testcase -v /nix/store:/nix/store:z -t ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main sh -c 'PATH="$PATH":"/home/soruh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin" cargo build -v --target x86_64-unknown-linux-gnu'
Compiling libc v0.2.153
Running `/target/debug/build/libc-10fd0db5075c6882/build-script-build`
error: failed to run custom build command for `libc v0.2.153`
Caused by:
process didn't exit successfully: `/target/debug/build/libc-10fd0db5075c6882/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-changed=build.rs
--- stderr
thread 'main' panicked at /home/soruh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.153/build.rs:206:9:
failed to run rustc: rustc: error while loading shared libraries: libLLVM-17-rust-1.75.0-stable.so: cannot open shared object file: No such file or directory
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
% rustup default nightly
nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.78.0-nightly (256b6fb19 2024-02-06)
% cross build
Finished dev [unoptimized + debuginfo] target(s) in 0.04s
Additional information / notes
% rustup show
Default host: x86_64-unknown-linux-gnu
rustup home: /home/soruh/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu (default)
nightly-2023-09-15-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu
installed targets for active toolchain
--------------------------------------
armv7-unknown-linux-gnueabihf
x86_64-unknown-linux-gnu
active toolchain
----------------
stable-x86_64-unknown-linux-gnu (default)
rustc 1.75.0 (82e1608df 2023-12-21)
% rustc -V
rustc 1.75.0 (82e1608df 2023-12-21)
% cargo -V
cargo 1.75.0 (1d8b05cdd 2023-11-20)
Emilgardis commented
Could you try uninstalling stable-x86_64-unknown-linux-gnu
then reinstall it
soruh commented
That seems to have worked. It now works for both architectures.
Thanks a lot!
Emilgardis commented
Awesome! We actually have a warning for a similar issue, but I think this one is pretty much impossible to detect reliably.
Line 129 in f272b47