-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Address libunwind.a inconsistency issues in the bootstrap program #144473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp. |
This comment has been minimized.
This comment has been minimized.
let source_date_epoch_env = "SOURCE_DATE_EPOCH"; | ||
if let Ok(var) = std::env::var(&source_date_epoch_env) { | ||
cargo.env(&source_date_epoch_env, &var); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we clearing the environment somewhere? I'd expect that passing through an env variable unchanged is the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure. But with out this passthrough, the SOURCE_DATE_EPOCH didn't appear in env arg list when building cargo when running SOURCE_DATE_EPOCH=timestamp python3 x.py install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a rebuild and removed the "SOURCE_DATE_EPOCH" pass through code I have. The build command is SOURCE_DATE_EPOCH=1735689600 python3 x.py install --config config4.toml --verbose 2>&1 |tee build4.log
I. So the bootstrap program didn't copy its env args to the cargo. See the verbose log:
Building tool cargo (stage1 -> stage2, x86_64-unknown-linux-gnu)
running: cd "/mnt/nvme_crypt/SRC/rust" && env -u MAKEFLAGS -u MFLAGS AR_x86_64_unknown_linux_gnu="/mnt/nvme_crypt/SRC/TQ/prebuilt/third_party/clang/linux-x64/bin/llvm-ar" CARGO_INCREMENTAL="0" CARGO_LOG="cargo::core::compiler::fingerprint=info" CARGO_PROFILE_RELEASE_CODEGEN_UNITS="1" CARGO_PROFILE_RELEASE_DEBUG="0" CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS="false" CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS="false" CARGO_PROFILE_RELEASE_STRIP="false" CARGO_TARGET_DIR="/mnt/nvme_crypt/SRC/rust/build4/x86_64-unknown-linux-gnu/stage1-tools" CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER="/mnt/nvme_crypt/SRC/TQ/prebuilt/third_party/clang/linux-x64/bin/clang++" CC_x86_64_unknown_linux_gnu="/mnt/nvme_crypt/SRC/TQ/prebuilt/third_party/clang/linux-x64/bin/clang" CFG_COMMIT_DATE="2025-07-09" CFG_COMMIT_HASH="eabb4cd923deb73e714f7ad3f5234d68ca284dbe" CFG_COMPILER_BUILD_TRIPLE="x86_64-unknown-linux-gnu" CFG_COMPILER_HOST_TRIPLE="x86_64-unknown-linux-gnu" CFG_RELEASE="1.90.0-nightly" CFG_RELEASE_CHANNEL="nightly" CFG_RELEASE_NUM="1.90.0" CFG_SHORT_COMMIT_HASH="eabb4cd92" CFG_VERSION="1.90.0-nightly (1c6de2150 2025-07-16)" CFG_VER_DATE="2025-07-16" CFG_VER_HASH="1c6de215099bbe33668de762f9591187f6c25eef" CFLAGS_x86_64_unknown_linux_gnu="" CXXFLAGS_x86_64_unknown_linux_gnu="" CXX_x86_64_unknown_linux_gnu="/mnt/nvme_crypt/SRC/TQ/prebuilt/third_party/clang/linux-x64/bin/clang++" DOC_RUST_LANG_ORG_CHANNEL="https://doc.rust-lang.org/nightly" LIBC_CHECK_CFG="1" LIBZ_SYS_STATIC="1" LZMA_API_STATIC="1" RANLIB_x86_64_unknown_linux_gnu="/mnt/nvme_crypt/SRC/TQ/prebuilt/third_party/clang/linux-x64/bin/llvm-ar s" REAL_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" RUSTBUILD_NATIVE_DIR="/mnt/nvme_crypt/SRC/rust/build4/x86_64-unknown-linux-gnu/native" RUSTC="/mnt/nvme_crypt/SRC/rust/build4/bootstrap/debug/rustc" RUSTC_BOOTSTRAP="1" RUSTC_BREAK_ON_ICE="1" RUSTC_ERROR_METADATA_DST="/mnt/nvme_crypt/SRC/rust/build4/tmp/extended-error-metadata" RUSTC_HOST_FLAGS="--check-cfg=cfg(bootstrap) -Clinker=/mnt/nvme_crypt/SRC/TQ/prebuilt/third_party/clang/linux-x64/bin/clang++" RUSTC_INSTALL_BINDIR="bin" RUSTC_LIBDIR="/mnt/nvme_crypt/SRC/rust/build4/x86_64-unknown-linux-gnu/stage1/lib" RUSTC_LINK_STD_INTO_RUSTC_DRIVER="1" RUSTC_LINT_FLAGS="" RUSTC_REAL="/mnt/nvme_crypt/SRC/rust/build4/x86_64-unknown-linux-gnu/stage1/bin/rustc" RUSTC_SNAPSHOT="/mnt/nvme_crypt/SRC/rust/build4/x86_64-unknown-linux-gnu/stage1/bin/rustc" RUSTC_SNAPSHOT_LIBDIR="/mnt/nvme_crypt/SRC/rust/build4/x86_64-unknown-linux-gnu/stage1/lib" RUSTC_STAGE="1" RUSTC_SYSROOT="/mnt/nvme_crypt/SRC/rust/build4/x86_64-unknown-linux-gnu/stage1" RUSTC_TLS_MODEL_INITIAL_EXEC="1" RUSTC_VERBOSE="1" RUSTC_WRAPPER="/mnt/nvme_crypt/SRC/rust/build4/bootstrap/debug/rustc" RUSTDOC="/mnt/nvme_crypt/SRC/rust/build4/bootstrap/debug/rustdoc" RUSTDOCFLAGS="--cfg=windows_raw_dylib -Csymbol-mangling-version=v0 -Zunstable-options --check-cfg=cfg(bootstrap) --check-cfg=cfg(llvm_enzyme) --check-cfg=cfg(rust_analyzer) --crate-version 1.90.0-nightly\t(1c6de2150\t2025-07-16) -Clinker=/mnt/nvme_crypt/SRC/TQ/prebuilt/third_party/clang/linux-x64/bin/clang++" RUSTDOC_REAL="/path/to/nowhere/rustdoc/not/required" RUSTFLAGS="--cfg=windows_raw_dylib -Csymbol-mangling-version=v0 -Zunstable-options --check-cfg=cfg(bootstrap) --check-cfg=cfg(llvm_enzyme) --check-cfg=cfg(rust_analyzer) -Zmacro-backtrace -Csplit-debuginfo=off -Clink-arg=-L/mnt/nvme_crypt/SRC/rust/build4/x86_64-unknown-linux-gnu/llvm/lib\n -Clink-args=-Wl,-z,origin -Clink-args=-Wl,-rpath,$ORIGIN/../lib -Alinker-messages -Zunstable-options" RUST_TEST_THREADS="128" SYSROOT="/mnt/nvme_crypt/SRC/rust/build4/x86_64-unknown-linux-gnu/stage1" __CARGO_DEFAULT_LIB_METADATA="nightlytool-rustc1.90.0" "/mnt/nvme_crypt/SRC/rust/build4/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "128" "-Zroot-dir=/mnt/nvme_crypt/SRC/rust" "-v" "--release" "--manifest-path" "/mnt/nvme_crypt/SRC/rust/src/tools/cargo/Cargo.toml" "--features" "all-static" "--message-format" "json-render-diagnostics" (failure_mode=Exit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a closer look. The cargo process to build cargo did inherited the SOURCE_DATE_EPOCH variable. It is the debug output didn't print it because it is not explicitly passed to the child process. Maybe worth improve the debug output to include the env args the child process inherited implicitly. It would make the debugging easier.
Anyway, I removed the environment variable handling in the latest patch set. Please take a look.
2285c8c
to
7515619
Compare
Some changes occurred in src/tools/cargo cc @ehuss |
This comment has been minimized.
This comment has been minimized.
7515619
to
52bbc67
Compare
This comment has been minimized.
This comment has been minimized.
52bbc67
to
0792f7d
Compare
We noticed when building rustc multiple time in a roll, some files will not be consistent across the build despite the fact that they are built from same source under the same environment. This patch addresses the inconsistency issue we found on libunwind.a by sorting the order of the files passed to the linker.
0792f7d
to
b3f369d
Compare
@rustbot ready |
Can you fix the PR description + title to reflect the current state of the PR? Those both get persisted into the commit history so good for them to be accurate. r=me with that done. |
Done. |
@bors r+ |
…ark-Simulacrum Address libunwind.a inconsistency issues in the bootstrap program We noticed when building rustc multiple time in a roll, some files will not be consistent across the build despite the fact that they are built from same source under the same environment. This patch addresses the inconsistency issue we found on libunwind.a, by sorting the order of the files passed to the linker.
Rollup of 16 pull requests Successful merges: - #143857 (Port #[macro_export] to the new attribute parsing infrastructure) - #144133 (Stabilize const TypeId::of) - #144369 (Upgrade semicolon_in_expressions_from_macros from warn to deny) - #144443 (Make target pointer width in target json an integer) - #144473 (Address libunwind.a inconsistency issues in the bootstrap program) - #144659 (bootstrap: refactor mingw dist and fix gnullvm) - #144682 (Stabilize `strict_overflow_ops`) - #144794 (Port `#[coroutine]` to the new attribute system) - #144835 (Anonymize binders in tail call sig) - #144836 (Change visibility of Args new function) - #144900 (Stabilize `unsigned_signed_diff` feature) - #144903 (Rename `begin_panic_handler` to `panic_handler`) - #144910 (Add regression tests for seemingly fixed issues) - #144926 (Correct the use of `must_use` on btree::IterMut) - #144928 (Drop `rust-version` from `rustc_thread_pool`) - #144931 ([win][arm64ec] Fix msvc-wholearchive for Arm64EC) Failed merges: - #144914 (Add support for `ty::Instance` path shortening in diagnostics) r? `@ghost` `@rustbot` modify labels: rollup
…ark-Simulacrum Address libunwind.a inconsistency issues in the bootstrap program We noticed when building rustc multiple time in a roll, some files will not be consistent across the build despite the fact that they are built from same source under the same environment. This patch addresses the inconsistency issue we found on libunwind.a, by sorting the order of the files passed to the linker.
Rollup of 15 pull requests Successful merges: - #143857 (Port #[macro_export] to the new attribute parsing infrastructure) - #144133 (Stabilize const TypeId::of) - #144369 (Upgrade semicolon_in_expressions_from_macros from warn to deny) - #144473 (Address libunwind.a inconsistency issues in the bootstrap program) - #144659 (bootstrap: refactor mingw dist and fix gnullvm) - #144682 (Stabilize `strict_overflow_ops`) - #144794 (Port `#[coroutine]` to the new attribute system) - #144835 (Anonymize binders in tail call sig) - #144836 (Change visibility of Args new function) - #144900 (Stabilize `unsigned_signed_diff` feature) - #144903 (Rename `begin_panic_handler` to `panic_handler`) - #144910 (Add regression tests for seemingly fixed issues) - #144926 (Correct the use of `must_use` on btree::IterMut) - #144928 (Drop `rust-version` from `rustc_thread_pool`) - #144931 ([win][arm64ec] Fix msvc-wholearchive for Arm64EC) r? `@ghost` `@rustbot` modify labels: rollup
We noticed when building rustc multiple time in a roll, some files will not be consistent across the build despite the fact that they are built from same source under the same environment. This patch addresses the inconsistency issue we found on libunwind.a, by sorting the order of the files passed to the linker.