Skip to content
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

Option to pass flags to rustc while bootstrapping using a file #135800

Open
WaffleLapkin opened this issue Jan 20, 2025 · 0 comments
Open

Option to pass flags to rustc while bootstrapping using a file #135800

WaffleLapkin opened this issue Jan 20, 2025 · 0 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. F-check-cfg --check-cfg T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@WaffleLapkin
Copy link
Member

WaffleLapkin commented Jan 20, 2025

When bootstrapping rustc invocations can be rather large. For example this is an invocation I wanted to debug today (~10.9 KiB):

LD_LIBRARY_PATH="/loc/waffle/rust-h/build/x86_64-unknown-linux-gnu/stage1/lib:/loc/waffle/rust-h/build/x86_64-unknown-linux-gnu/stage1-std/release/deps" RUST_BACKTRACE="1" "/loc/waffle/rust-h/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "--crate-name" "compiler_builtins" "--edition=2021" "/usr/sec/waffle/.cargo/registry/src/index.crates.io-6f17d22bba15001f/compiler_builtins-0.1.138/src/[lib.rs](http://lib.rs/)" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts,future-incompat" "--diagnostic-width=204" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "opt-level=3" "-C" "embed-bitcode=no" "-C" "codegen-units=10000" "-C" "debuginfo=line-tables-only" "--cfg" "feature=\"compiler-builtins\"" "--cfg" "feature=\"core\"" "--cfg" "feature=\"default\"" "--cfg" "feature=\"mem\"" "--cfg" "feature=\"rustc-dep-of-std\"" "--check-cfg" "cfg(docsrs)" "--check-cfg" "cfg(feature, values(\"c\", \"cc\", \"compiler-builtins\", \"core\", \"default\", \"mangled-names\", \"mem\", \"no-asm\", \"no-f16-f128\", \"public-test-deps\", \"rustc-dep-of-std\"))" "-C" "metadata=8b1a123d4d7caf72" "-C" "extra-filename=-8b1a123d4d7caf72" "--out-dir" "/loc/waffle/rust-h/build/x86_64-unknown-linux-gnu/stage1-std/riscv32i-unknown-none-tasking/release/deps" "--target" "riscv32i-unknown-none-tasking" "-C" "linker=cc" "-L" "dependency=/loc/waffle/rust-h/build/x86_64-unknown-linux-gnu/stage1-std/riscv32i-unknown-none-tasking/release/deps" "-L" "dependency=/loc/waffle/rust-h/build/x86_64-unknown-linux-gnu/stage1-std/release/deps" "--extern" "core=/loc/waffle/rust-h/build/x86_64-unknown-linux-gnu/stage1-std/riscv32i-unknown-none-tasking/release/deps/librustc_std_workspace_core-2e8331c85d5501e5.rmeta" "--cap-lints" "warn" "-Csymbol-mangling-version=legacy" "--check-cfg=cfg(feature,values(any()))" "-Zunstable-options" "--check-cfg=cfg(bootstrap)" "-Zmacro-backtrace" "-Csplit-debuginfo=off" "-Cforce-frame-pointers=true" "-Cprefer-dynamic" "-Zinline-mir" "-Zinline-mir-preserve-debug" "-Clink-args=-Wl,-z,origin" "-Clink-args=-Wl,-rpath,$ORIGIN/../lib" "-Cembed-bitcode=yes" "-Clto=off" "-Cforce-unwind-tables=yes" "-Cforce-frame-pointers=yes" "-Zcrate-attr=doc(html_root_url=\[https://doc.rust-lang.org/nightly/\](https://doc.rust-lang.org/nightly/))" "-Z" "binary-dep-depinfo" "--cfg" "f16_enabled" "--cfg" "f128_enabled" "--cfg" "feature=\"unstable\"" "--cfg" "feature=\"force-soft-floats\"" "--cfg" "feature=\"mem\"" "--check-cfg" "cfg(__ashldi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__ashlsi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__ashrdi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__ashrsi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__bswapsi2, values(\"optimized-c\"))" "--check-cfg" "cfg(__bswapdi2, values(\"optimized-c\"))" "--check-cfg" "cfg(__bswapti2, values(\"optimized-c\"))" "--check-cfg" "cfg(__divdi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__divsi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__divmoddi4, values(\"optimized-c\"))" "--check-cfg" "cfg(__divmodsi4, values(\"optimized-c\"))" "--check-cfg" "cfg(__divmodsi4, values(\"optimized-c\"))" "--check-cfg" "cfg(__divmodti4, values(\"optimized-c\"))" "--check-cfg" "cfg(__lshrdi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__lshrsi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__moddi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__modsi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__muldi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__udivdi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__udivmoddi4, values(\"optimized-c\"))" "--check-cfg" "cfg(__udivmodsi4, values(\"optimized-c\"))" "--check-cfg" "cfg(__udivsi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__umoddi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__umodsi3, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas1_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas1_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas1_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas1_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas2_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas2_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas2_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas2_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas4_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas4_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas4_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas4_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas8_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas8_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas8_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas8_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas16_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas16_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas16_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_cas16_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd1_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd1_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd1_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd1_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd2_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd2_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd2_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd2_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd4_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd4_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd4_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd4_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd8_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd8_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd8_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldadd8_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr1_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr1_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr1_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr1_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr2_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr2_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr2_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr2_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr4_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr4_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr4_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr4_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr8_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr8_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr8_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldclr8_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor1_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor1_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor1_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor1_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor2_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor2_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor2_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor2_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor4_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor4_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor4_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor4_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor8_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor8_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor8_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldeor8_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset1_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset1_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset1_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset1_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset2_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset2_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset2_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset2_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset4_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset4_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset4_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset4_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset8_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset8_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset8_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_ldset8_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp1_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp1_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp1_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp1_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp2_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp2_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp2_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp2_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp4_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp4_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp4_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp4_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp8_relax, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp8_acq, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp8_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(__aarch64_swp8_acq_rel, values(\"optimized-c\"))" "--check-cfg" "cfg(target_feature, values(\"vis3\"))" "--check-cfg" "cfg(feature, values(\"checked\"))" "--check-cfg" "cfg(assert_no_panic)" "--check-cfg" "cfg(f16_enabled)" "--check-cfg" "cfg(f128_enabled)" "--check-cfg" "cfg(feature, values(\"unstable\", \"force-soft-floats\"))" "--check-cfg" "cfg(feature, values(\"mem-unaligned\"))" "--check-cfg" "cfg(thumb)" "--check-cfg" "cfg(thumb_1)" "--check-cfg" "cfg(kernel_user_helpers)" "-Wrust_2018_idioms" "-Wunused_lifetimes" "--sysroot" "/loc/waffle/rust-h/build/x86_64-unknown-linux-gnu/stage1" "-Z" "force-unstable-if-unmarked"

This causes shells to melt (good luck editing a command when it doesn't render), which is very annoying when you want to change something about the command, or even simply run it through gdb (NB: you need to insert gdb --args in between the env vars and the rest of the command, which is mostly impossible when the command doesn't render!!).

One of the things I'd wish for is a way for cargo to pass check-cfg without repeating --check-cfg ~139 times. Something like --check-cfg "all(cfg(uwu), cfg(owo))" (or "cfg(uwu); cfg(owo)") maybe?

The second thing is for bootstrap to have an option (cli, config) to pass options to the rustc binary via a file. Note that rustc supports reading command line arguments from a file with @file:

: ~; echo '--version' > ./args.txt
: ~; rustc @./args.txt
rustc 1.86.0-nightly (48a426eca 2025-01-12)

Bootstrap could create a file in /tmp or in ./build/.. with the arguments and pass that to rustc. That would make it much easier to re-run commands run by bootstrap, which is sometimes useful when debugging.

cc @jieyouxu

@WaffleLapkin WaffleLapkin added C-enhancement Category: An issue proposing an enhancement or a PR with one. F-check-cfg --check-cfg T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jan 20, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 20, 2025
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. F-check-cfg --check-cfg T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

3 participants