Skip to content

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

Open
@lolbinarycat

Description

@lolbinarycat

sorry for not formatting this as a PR, but i'm in the middle of drafting another PR, and i don't think i can split this into its own branch without making that pr unmergable.

this fixes an error where building stage1 on nixos would produce a rustc binary that is dynamically linked to libstdc++, but this dependency does not get patched, so the executable cannot be run without using LD_LIBRARY_PATH hacks.

diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs
index a7f4bb0cf..2fa47cc6c 100644
--- a/src/bootstrap/src/core/download.rs
+++ b/src/bootstrap/src/core/download.rs
@@ -154,6 +154,7 @@ fn fix_bin_or_dylib(&self, fname: &Path) {
                     zlib
                     patchelf
                     stdenv.cc.bintools
+                    stdenv.cc.cc.lib
                 ];
             }
             ";
@@ -224,6 +225,7 @@ fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error:
             tempfile.to_str().unwrap(),
             "--retry",
             "3",
+            "--retry-all-errors",
             "-SRf",
         ]);
         // Don't print progress in CI; the \r wrapping looks bad and downloads don't take long enough for progress to be useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.C-discussionCategory: Discussion or questions that doesn't represent real issues.O-NixOSOperating system: NixOS, https://nixos.org/T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions