Skip to content

Comments

Build: Add stdenv.cc.cc.lib to Nix dependencies#152708

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
PaulDance:patches/nix-stdenv.cc.cc.lib
Feb 22, 2026
Merged

Build: Add stdenv.cc.cc.lib to Nix dependencies#152708
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
PaulDance:patches/nix-stdenv.cc.cc.lib

Conversation

@PaulDance
Copy link
Contributor

@PaulDance PaulDance commented Feb 16, 2026

Otherwise, it systematically fails on:

error: process didn't exit successfully: `[...]/rust/build/bootstrap/debug/rustc [...]/rust/build/bootstrap/debug/rustc -vV` (exit status: 127)
--- stderr
[...]/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

for us at least. Closes #127620.

@rustbot label T-bootstrap A-reproducibility

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-reproducibility Area: Reproducible / deterministic builds labels Feb 16, 2026
@PaulDance PaulDance marked this pull request as ready for review February 16, 2026 13:09
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 16, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 16, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 16, 2026

r? @clubby789

rustbot has assigned @clubby789.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu

@clubby789
Copy link
Contributor

I'm not familiar with Nix, but #127620 seems relevant. In that issue, it seems like further steps were required to get it working (cc @lolbinarycat)

@PaulDance
Copy link
Contributor Author

#127620 seems relevant

Indeed it is. @lolbinarycat should we close the issue with this PR?

In that issue, it seems like further steps were required to get it working

In our case, only the first line is required, removing it definitely breaks the build as indicated in the original description. The second line does not seem necessary for us at least.

@clubby789
Copy link
Contributor

There's a list of explanations for each dep just above your change, can you add an explanation for stdenv.cc.cc.lib too?

This basically LGTM, but I'd like to wait for someone who knows more about Nix/the usage here to comment.

Otherwise, it systematically fails on:

```
error: process didn't exit successfully: `[...]/rust/build/bootstrap/debug/rustc [...]/rust/build/bootstrap/debug/rustc -vV` (exit status: 127)
--- stderr
[...]/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
```

for us at least.

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
@PaulDance PaulDance force-pushed the patches/nix-stdenv.cc.cc.lib branch from 5352c81 to 751b7d5 Compare February 19, 2026 16:32
@rustbot
Copy link
Collaborator

rustbot commented Feb 19, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@PaulDance
Copy link
Contributor Author

There's a list of explanations for each dep just above your change, can you add an explanation for stdenv.cc.cc.lib too?

Yup, done.

someone who knows more about Nix/the usage here to comment

@roblabla might be of help here.

@adwinwhite
Copy link
Contributor

adwinwhite commented Feb 19, 2026

LGTM.
Thank you for investigating and fixing this. Finally I don't have to patch librustc_driver.so myself.

Going through the U.R.L.O. thread, the problem is that only stage0 compiler is patched.

@PaulDance
Copy link
Contributor Author

What do you mean exactly? I don't quite understand.

@adwinwhite
Copy link
Contributor

adwinwhite commented Feb 20, 2026

I was asking whether this change fixes stage1 rustc.

If so, the "rust-stage0-dependencies" name is confusing. At least it got me for a while.

@PaulDance
Copy link
Contributor Author

PaulDance commented Feb 20, 2026

Yes, it seems to be for stage1 indeed: the message preceding the error was Building stage1 library artifacts (stage1:x86_64-unknown-linux-gnu -> stage1:x86_64-win7-windows-msvc).

For stage0, I guess the same change could also be applied to bootstrap.py that has a similar Nix expression? However, we definitely observe the attempting to patch [...] logs that precede it and no error afterwards, so unless the branch was never taken, the additional dependency does not seem actually needed there, at least for us.

@adwinwhite
Copy link
Contributor

adwinwhite commented Feb 20, 2026

Sorry for repeatedly pushing the same concern.

You're right that stage0 rustc doesn't need dynamic libstdc++.so.6 while stage1 rustc needs it.
I just inspected them with ldd ./build/x86_64-unknown-linux-gnu/stage{0,1}/bin/rustc.

Checking all usages of fix_bin_or_dylib, it seems that it's only used for stage0 components.
So I doubt this PR fixes the problem 🤔. an older thread about it
Could you try to run stage1 rustc locally with your change applied? That should verify the effects.

@PaulDance
Copy link
Contributor Author

We currently only build the (x86_64|i686)-win7-windows-msvc targets with it, so this could explain some differences? Otherwise, the error I mentioned in the original description was when recently removing the patch from our build just to check that it was still indeed required before opening this PR, and keeping it has definitely enabled us to build for a long time, so at least for us the change seems to be a sufficient fix.

@clubby789
Copy link
Contributor

Given that this does seem to be a strict improvement for now, I'm happy to merge this unless there's any immediate ideas to make this a more complete fix?

@adwinwhite
Copy link
Contributor

Strange that nix has anything do with windows target.
But if it fixes something for you, that's good.

@clubby789
Copy link
Contributor

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 22, 2026

📌 Commit 751b7d5 has been approved by clubby789

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 22, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 22, 2026
….lib, r=clubby789

Build: Add `stdenv.cc.cc.lib` to Nix dependencies

Otherwise, it systematically fails on:

```
error: process didn't exit successfully: `[...]/rust/build/bootstrap/debug/rustc [...]/rust/build/bootstrap/debug/rustc -vV` (exit status: 127)
--- stderr
[...]/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
```

for us at least. Closes rust-lang#127620.

@rustbot label T-bootstrap A-reproducibility
rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #149366 (GVN: consider constants of primitive types as deterministic)
 - #152779 (Clarify aspects of query macros)
 - #152958 (`rustc_queries` simplifications)
 - #149783 (stabilize `cfg_select!`)
 - #152708 (Build: Add `stdenv.cc.cc.lib` to Nix dependencies)
rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #149366 (GVN: consider constants of primitive types as deterministic)
 - #152779 (Clarify aspects of query macros)
 - #152958 (`rustc_queries` simplifications)
 - #149783 (stabilize `cfg_select!`)
 - #152708 (Build: Add `stdenv.cc.cc.lib` to Nix dependencies)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 22, 2026
….lib, r=clubby789

Build: Add `stdenv.cc.cc.lib` to Nix dependencies

Otherwise, it systematically fails on:

```
error: process didn't exit successfully: `[...]/rust/build/bootstrap/debug/rustc [...]/rust/build/bootstrap/debug/rustc -vV` (exit status: 127)
--- stderr
[...]/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
```

for us at least. Closes rust-lang#127620.

@rustbot label T-bootstrap A-reproducibility
rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #149366 (GVN: consider constants of primitive types as deterministic)
 - #152779 (Clarify aspects of query macros)
 - #152958 (`rustc_queries` simplifications)
 - #152385 (Feature gate for defaulted associated type_consts with associated_type_defaults )
 - #152708 (Build: Add `stdenv.cc.cc.lib` to Nix dependencies)
 - #152921 (Add build.rustdoc option to bootstrap config)
 - #152926 (Fix ICE when an associated type is wrongly marked as `final`)
 - #152927 (Index expressions rendered the index: subexpression as the id, instea…)
rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #152779 (Clarify aspects of query macros)
 - #152958 (`rustc_queries` simplifications)
 - #152385 (Feature gate for defaulted associated type_consts with associated_type_defaults )
 - #152708 (Build: Add `stdenv.cc.cc.lib` to Nix dependencies)
 - #152921 (Add build.rustdoc option to bootstrap config)
 - #152926 (Fix ICE when an associated type is wrongly marked as `final`)
 - #152927 (Index expressions rendered the index: subexpression as the id, instea…)
@rust-bors rust-bors bot merged commit ae8fa15 into rust-lang:main Feb 22, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 22, 2026
rust-timer added a commit that referenced this pull request Feb 22, 2026
Rollup merge of #152708 - PaulDance:patches/nix-stdenv.cc.cc.lib, r=clubby789

Build: Add `stdenv.cc.cc.lib` to Nix dependencies

Otherwise, it systematically fails on:

```
error: process didn't exit successfully: `[...]/rust/build/bootstrap/debug/rustc [...]/rust/build/bootstrap/debug/rustc -vV` (exit status: 127)
--- stderr
[...]/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
```

for us at least. Closes #127620.

@rustbot label T-bootstrap A-reproducibility
@PaulDance PaulDance deleted the patches/nix-stdenv.cc.cc.lib branch February 23, 2026 00:50
@PaulDance
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-reproducibility Area: Reproducible / deterministic builds S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bootstrap]: fix stage1 build on nixos and improve download robustness

4 participants