rust-lang / rust-lang/rust

When binutils doesn't have native symlink for strip, rust-1.94.0 fails to build

Open
#154,054 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug T-bootstrap
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Summary

https://github.com/rust-lang/rust/blob/fd0c901b00ee1e08a250039cdb90258603497e20/src/bootstrap/src/core/build_steps/compile.rs#L2907

When binutils provides only tuple-prefixed commands, eg. x86_64-pc-linux-gnu-strip, rust fails to build.

Command used
<command>
Expected behaviour

Rust builds successfully, automatically picking correct strip like it does for ar and other binutils components

Actual behaviour

compilation fails

Bootstrap configuration (bootstrap.toml)
# Suppresses a warning about tracking changes which we don't care about.
change-id = "ignore"
# https://github.com/rust-lang/rust/issues/135358 (bug #947897)
profile = "dist"
[llvm]
download-ci-llvm = false
optimize = true
release-debuginfo = false
assertions = false
ninja = true
targets = "X86"
experimental-targets = ""
link-shared = true


enable-warnings = false
[llvm.build-config]
CMAKE_VERBOSE_MAKEFILE = "ON"
CMAKE_C_FLAGS_RELEASE = "-O2 -pipe -march=native -ggdb"
CMAKE_CXX_FLAGS_RELEASE = "-O2 -pipe -march=native -ggdb"
CMAKE_EXE_LINKER_FLAGS_RELEASE = "-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
CMAKE_MODULE_LINKER_FLAGS_RELEASE = "-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
CMAKE_SHARED_LINKER_FLAGS_RELEASE = "-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
CMAKE_STATIC_LINKER_FLAGS_RELEASE = ""
[build]
build-stage = 2
test-stage = 2
build = "x86_64-unknown-linux-gnu"
host = ["x86_64-unknown-linux-gnu"]
target = ["x86_64-unknown-linux-gnu"]
cargo = "/opt/rust-bin-1.94.0/bin/cargo"
rustc = "/opt/rust-bin-1.94.0/bin/rustc"
rustfmt = "/opt/rust-bin-1.94.0/bin/rustfmt"
description = "gentoo"
docs = true
compiler-docs = false
submodules = false
python = "python3.14"
locked-deps = true
vendor = true
extended = true
tools = ["cargo","rustdoc","clippy","rustfmt"]
verbose = 2
sanitizers = false
profiler = true
cargo-native-static = false
[install]
prefix = "/usr/lib/rust/1.94.0"
sysconfdir = "etc"
docdir = "share/doc/rust"
bindir = "bin"
libdir = "lib"
mandir = "share/man"
[rust]
# https://github.com/rust-lang/rust/issues/54872
codegen-units-std = 1
optimize = true
debug = false
debug-assertions = false
debug-assertions-std = false
debuginfo-level = 0
debuginfo-level-rustc = 0
debuginfo-level-std = 0
debuginfo-level-tools = 0
debuginfo-level-tests = 0
backtrace = true
incremental = false
default-linker = "x86_64-pc-linux-gnu-cc"
channel = "stable"
rpath = true
verbose-tests = true
optimize-tests = true
codegen-tests = true
omit-git-hash = false
dist-src = false
remap-debuginfo = true
lld = false

# only deny warnings if doc+wasm are NOT requested, documenting stage0 wasm std fails without it
# https://github.com/rust-lang/rust/issues/74976
# https://github.com/rust-lang/rust/issues/76526
deny-warnings = true
backtrace-on-ice = true
jemalloc = false
# See https://github.com/rust-lang/rust/issues/121124
lto = "off"
[dist]
src-tarball = false
compression-formats = ["xz"]
compression-profile = "balanced"
[target.x86_64-unknown-linux-gnu]
ar = "x86_64-pc-linux-gnu-ar"
cc = "x86_64-pc-linux-gnu-gcc"
cxx = "x86_64-pc-linux-gnu-g++"
linker = "x86_64-pc-linux-gnu-gcc"
ranlib = "x86_64-pc-linux-gnu-ranlib"
llvm-libunwind = "no"
llvm-config = "/usr/lib/llvm/21/bin/llvm-config"
Operating system

Gentoo.

HEAD

4a4ef493e3a1488c6e321570238084b38948f6db

Additional context

Using standard Gentoo patch set, container without native symlinks for gcc, llvm and binutils, for testing.
Rust successfully compiled with glibc-llvm, musl-llvm and musl-gcc combinations, but failed with glibc-gcc

reproductible by https://codeberg.org/NHOrus/gap/src/commit/58e564f42e77e85353b23957887727f9136f4f3d , failure at step 3 of readme, setup takes few hours, could be speed up by limiting build to glib-gcc container only.

Build Log

    Finished `release` profile [optimized] target(s) in 1m 42s
running: "strip" "--strip-debug" "/var/tmp/portage/dev-lang/rust-1.94.0/work/rustc-1.94.0-src/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/librustc_driver.so" (failure_mode=Exit) (created at src/bootstra
p/src/core/build_steps/compile.rs:2929:9, executed at src/bootstrap/src/core/build_steps/compile.rs:2929:57)
Command `"strip" "--strip-debug" "/var/tmp/portage/dev-lang/rust-1.94.0/work/rustc-1.94.0-src/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/librustc_driver.so" (failure_mode=Exit)` failed to start: Os { code: 2, kind: NotFound, message: "No such file or directory" }
Created at: src/bootstrap/src/core/build_steps/compile.rs:2929:9
Executed at: src/bootstrap/src/core/build_steps/compile.rs:2929:57

--- STDOUT vvv


--- STDERR vvv


Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/rust-1.94.0/work/rustc-1.94.0-src/./x.py", line 53, in <module>
    bootstrap.main()
    ~~~~~~~~~~~~~~^^
  File "/var/tmp/portage/dev-lang/rust-1.94.0/work/rustc-1.94.0-src/src/bootstrap/bootstrap.py", line 1410, in main
    bootstrap(args)
    ~~~~~~~~~^^^^^^
  File "/var/tmp/portage/dev-lang/rust-1.94.0/work/rustc-1.94.0-src/src/bootstrap/bootstrap.py", line 1370, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
    ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-lang/rust-1.94.0/work/rustc-1.94.0-src/src/bootstrap/bootstrap.py", line 237, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /var/tmp/portage/dev-lang/rust-1.94.0/work/rustc-1.94.0-src/build/bootstrap/debug/bootstrap build -v --config=/var/tmp/portage/dev-lang/rust-1.94.0/work/rustc-1.94.0-src/bootstrap.toml -j16

<log>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/bootstrap/src/core/build_steps/compile.rs around lines 2907-2929, where the build invokes strip, and compare its lookup with the handling of ar and other binutils tools. Reproduce with the reported Gentoo configuration or the linked container, then verify that builds using tuple-prefixed binutils commands complete successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.