Description
Summary
Since 1.83, cross-building in Debian is broken because of the check/invocation introduced by #130899 (68034f8 to be exact).
Command used
on an amd64/x86_64 host:
python3 src/bootstrap/bootstrap.py -j 8 build --stage 2 --config config.toml --on-fail env --target aarch64-unknown-linux-gnu
Expected behaviour
up to 1.82, cross building worked.
Actual behaviour
since 1.83, the newly introduced rustc invocation fails, since it doesn't seem to set the right LD_LIBRARY_PATH
:
< Std { target: aarch64-unknown-linux-gnu, compiler: Compiler { stage: 2, host: x86_64-unknown-linux-gnu }, crates: [], force_recompile: false, extra_rust_args: [], is_for_mir_opt_tests: false }
c Assemble { target_compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu } }
> Rustc { target: aarch64-unknown-linux-gnu, compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, crates: [] }
c Std { target: aarch64-unknown-linux-gnu, compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, crates: [], force_recompile: false, extra_rust_args: [], is_for_mir_opt_tests: false }
c Assemble { target_compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu } }
c Assemble { target_compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu } }
c Std { target: x86_64-unknown-linux-gnu, compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, crates: [], force_recompile: false, extra_rust_args: [], is_for_mir_opt_tests: false }
c Libdir { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, target: x86_64-unknown-linux-gnu }
c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, force_recompile: false }
c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, force_recompile: false }
using sysroot /<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage1
c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, force_recompile: false }
running: "/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "--target" "aarch64-unknown-linux-gnu" "--print=file-names" "--crate-type=proc-macro" "-" (failure_mode=Exit) (created at src/core/builder.rs:1688:33, executed at src/core/builder.rs:1694:26)
Command "/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "--target" "aarch64-unknown-linux-gnu" "--print=file-names" "--crate-type=proc-macro" "-" (failure_mode=Exit) did not execute successfully.
Expected success, got exit status: 127
Created at: src/core/builder.rs:1688:33
Executed at: src/core/builder.rs:1694:26
STDOUT ----
STDERR ----
/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-3099989dab198f47.so: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/src/bootstrap/bootstrap.py", line 1226, in <module>
main()
File "/<<PKGBUILDDIR>>/src/bootstrap/bootstrap.py", line 1211, in main
bootstrap(args)
File "/<<PKGBUILDDIR>>/src/bootstrap/bootstrap.py", line 1187, in bootstrap
run(args, env=env, verbose=build.verbose, is_bootstrap=True)
File "/<<PKGBUILDDIR>>/src/bootstrap/bootstrap.py", line 202, in run
raise RuntimeError(err)
RuntimeError: failed to run: /<<PKGBUILDDIR>>/build/bootstrap/debug/bootstrap -j 1 build --stage 2 --config debian/config.toml --on-fail env
the mentioned librustc_driver-3099989dab198f47.so
exists in stage1/lib
, setting LD_LIBRARY_PATH
and repeating the rustc
invocation doesn't fail, manually repeating it without setting LD_LIBRARY_PATH
does and gives the same error.
Bootstrap configuration (config.toml)
somewhat reduced from the actual config used during a Debian package build (this is the one I used to bisect/reproduce the issue from git):
change-id = 133207
[build]
submodules = true
locked-deps = false
verbose = 2
profiler = false
build = "x86_64-unknown-linux-gnu"
host = ["aarch64-unknown-linux-gnu"]
target = ["aarch64-unknown-linux-gnu"]
docs = true
extended = true
tools = [
"cargo",
"clippy",
"rust-analyzer",
"rust-analyzer-proc-macro-srv",
"rustdoc",
"rustfmt",
"wasm-component-ld",
]
# we use pre-built LLVM, so can't optimize compiler-rt
optimized-compiler-builtins = false
[install]
prefix = "/usr"
[target.x86_64-unknown-linux-gnu]
llvm-config = "/usr/lib/llvm-19/bin/llvm-config"
linker = "x86_64-linux-gnu-gcc"
profiler = "/usr/lib/llvm-19/lib/clang/19/lib/linux/libclang_rt.profile-aarch64.a"
[target.aarch64-unknown-linux-gnu]
llvm-config = "/usr/lib/llvm-19/bin/llvm-config"
linker = "aarch64-linux-gnu-gcc"
profiler = "/usr/lib/llvm-19/lib/clang/19/lib/linux/libclang_rt.profile-aarch64.a"
[llvm]
link-shared = true
download-ci-llvm = false
[rust]
download-rustc = false
jemalloc = false
optimize = true
dist-src = false
channel = "stable"
debuginfo-level = 2
debuginfo-level-std = 2
rpath = false
remap-debuginfo = true
omit-git-hash = true
verbose-tests = true
backtrace-on-ice = true
deny-warnings = false
Operating system
Debian unstable (sid) with rustc 1.84.0 as packaged, but see above
HEAD
Additional context
while the problem surfaced as part of the (modified) Debian package build, it is reproducible using the config and command given above on a stock git clone.