Skip to content

ui/feature-gates/version_check.rs broken with rpath=false #141579

Closed
@Fabian-Gruenbichler

Description

@Fabian-Gruenbichler

Summary

this test case is only executed on x86 (not x86_64 or other targets, which already seems wrong, but might be the reason this was not caught/reported yet?).

it tries to execute the stage2 rustc binary without setting LD_LIBRARY_LOAD_PATH correctly, at least for rpath=false:

Command used

RUST_BACKTRACE=1 python3 src/bootstrap/bootstrap.py -j XXX --stage 2 --config debian/config.toml --on-fail env test --no-fail-fast --exclude src/tools/tidy

Expected behaviour

the test should pass :)

Actual behaviour

failures:

---- [ui] tests/ui/feature-gates/version_check.rs stdout ----


executing env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/build/reproducible-path/rustc-1.86.0+dfsg1/build/i686-unknown-linux-gnu/stage2/bin/rustc" "/build/reproducible-path/rustc-1.86.0+dfsg1/tests/ui/feature-gates/version_check.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/build/reproducible-path/rustc-1.86.0+dfsg1/debian/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/build/reproducible-path/rustc-1.86.0+dfsg1/vendor" "--sysroot" "/build/reproducible-path/rustc-1.86.0+dfsg1/build/i686-unknown-linux-gnu/stage2" "--target=i686-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/build/reproducible-path/rustc-1.86.0+dfsg1/build/i686-unknown-linux-gnu/test/ui/feature-gates/version_check/a" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/build/reproducible-path/rustc-1.86.0+dfsg1/build/i686-unknown-linux-gnu/native/rust-test-helpers" "-Clinker=i686-linux-gnu-gcc"
------rustc stdout------------------------------

------rustc stderr------------------------------

------------------------------------------
executing cd "/build/reproducible-path/rustc-1.86.0+dfsg1/build/i686-unknown-linux-gnu/test/ui/feature-gates/version_check" && RUSTC="/build/reproducible-path/rustc-1.86.0+dfsg1/build/i686-unknown-linux-gnu/stage2/bin/rustc" RUST_TEST_THREADS="6" "/build/reproducible-path/rustc-1.86.0+dfsg1/build/i686-unknown-linux-gnu/test/ui/feature-gates/version_check/a"
------a stdout------------------------------

------a stderr------------------------------

thread 'main' panicked at /build/reproducible-path/rustc-1.86.0+dfsg1/tests/ui/feature-gates/version_check.rs:15:81:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
             at /usr/src/rustc-1.86.0/library/std/src/panicking.rs:695:5
   1: core::panicking::panic_fmt
             at /usr/src/rustc-1.86.0/library/core/src/panicking.rs:75:14
   2: core::panicking::panic
             at /usr/src/rustc-1.86.0/library/core/src/panicking.rs:145:5
   3: core::option::unwrap_failed
             at /usr/src/rustc-1.86.0/library/core/src/option.rs:2015:5
   4: version_check::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

------------------------------------------

error: test run failed!
status: exit status: 101

adding some debug code shows that version is Ok("") (i.e., stdout is empty), and the executed rustc binary is /build/reproducible-path/rustc-1.86.0+dfsg1/build/i686-unknown-linux-gnu/stage2/bin/rustc". dumping the test commands stderr instead of stdout, we get the actual error:

/build/reproducible-path/rustc-1.86.0+dfsg1/build/i686-unknown-linux-gnu/stage2/bin/rustc: error while loading shared libraries: librustc_driver-b27aa4671471dea1.so: cannot open shared object file: No such file or directory\n"

Bootstrap configuration (bootstrap.toml)

this happened during the Debian package build.

the config is heavily modified to suite distro purposes, but we don't carry any bootstrap or compiletest patches that should cause this:

change-id = 133207

[build]
submodules = false
vendor = true
locked-deps = false
verbose = 2
profiler = true

rustc = "/usr/bin/rustc"
cargo = "/usr/bin/cargo"

build = "i686-unknown-linux-gnu"
host = ["i686-unknown-linux-gnu"]
target = ["i686-unknown-linux-gnu"]

#full-bootstrap = true
# originally needed to work around #45317 but no longer necessary
# currently we have to omit it because it breaks #48319

# this might get changed later by override_dh_auto_configure-indep
# we do it this way to avoid spurious rebuilds
docs = false

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.i686-unknown-linux-gnu]
llvm-config = "/usr/lib/llvm-19/bin/llvm-config"
linker = "i686-linux-gnu-gcc"
profiler = "/usr/lib/llvm-19/lib/clang/19/lib/linux/libclang_rt.profile-i386.a"

[target.wasm32-wasip1]
wasi-root = "/usr"
profiler = false
[target.wasm32-wasip2]
wasi-root = "/usr"
profiler = false
[target.wasm32-unknown-unknown]
profiler = false

[target.i686-pc-windows-gnu]
profiler = false

[llvm]
link-shared = true
download-ci-llvm = false
ninja = false

[rust]
download-rustc = false
jemalloc = false
optimize = true
dist-src = false
lld = false

channel = "stable"

# parallel codegen interferes with reproducibility, see
# https://github.com/rust-lang/rust/issues/34902#issuecomment-319463586
#codegen-units = 0
debuginfo-level = 0
debuginfo-level-std = 2
rpath = false
# see also d-custom-debuginfo-path.patch
remap-debuginfo = true

omit-git-hash = true
verbose-tests = true
backtrace-on-ice = true

deny-warnings = false

minimizing this config when testing from git 1.86 or master to just:

# See bootstrap.example.toml for documentation of available options
#
profile = "compiler"  # Includes one of the default files in src/bootstrap/defaults
change-id = 140732

[build]
verbose = 2
[rust]
verbose-tests = true
rpath = false

with the following diff to run on 64-bit x86:

diff --git a/tests/ui/feature-gates/version_check.rs b/tests/ui/feature-gates/version_check.rs
index e212dc74fd1..76621317b2c 100644
--- a/tests/ui/feature-gates/version_check.rs
+++ b/tests/ui/feature-gates/version_check.rs
@@ -1,6 +1,6 @@
 //@ run-pass
 //@ only-linux
-//@ only-x86
+//@ only-x86_64
 // FIXME: this should be more like //@ needs-subprocesses
 use std::process::Command;
 

and the following command:

./x --stage 2 test tests/ui/feature-gates/version_check.rs

reproduces the issue as well. without rpath=false it works.

Operating system

Debian experimental

HEAD

1.86 tarball

Additional context

Build Log

<log>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-testsuiteArea: The testsuite used to check the correctness of rustcC-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions