bootstrap: add Builder::rustc_cmd that includes the lib path
When building with `rust.rpath = false`, every `rustc` invocation needs
to include the library path as well. I particularly ran into this in
`generate_target_spec_json_schema` when testing 1.91-beta in Fedora,
where we do disable rpath for our system builds. The new helper function
will hopefully encourage the right thing going forward.
(cherry picked from commit 03cdcb5cd5)
This commit is contained in:
parent
555abc18d7
commit
3222bef156
5 changed files with 13 additions and 8 deletions
|
|
@ -519,7 +519,7 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, cargo: &mut Car
|
|||
// Query rustc for the deployment target, and the associated env var.
|
||||
// The env var is one of the standard `*_DEPLOYMENT_TARGET` vars, i.e.
|
||||
// `MACOSX_DEPLOYMENT_TARGET`, `IPHONEOS_DEPLOYMENT_TARGET`, etc.
|
||||
let mut cmd = command(builder.rustc(cargo.compiler()));
|
||||
let mut cmd = builder.rustc_cmd(cargo.compiler());
|
||||
cmd.arg("--target").arg(target.rustc_target_arg());
|
||||
cmd.arg("--print=deployment-target");
|
||||
let output = cmd.run_capture_stdout(builder).stdout();
|
||||
|
|
|
|||
|
|
@ -625,7 +625,7 @@ fn generate_target_spec_json_schema(builder: &Builder<'_>, sysroot: &Path) {
|
|||
// We do this by using the stage 1 compiler, which is always compiled for the host,
|
||||
// even in a cross build.
|
||||
let stage1_host = builder.compiler(1, builder.host_target);
|
||||
let mut rustc = command(builder.rustc(stage1_host)).fail_fast();
|
||||
let mut rustc = builder.rustc_cmd(stage1_host).fail_fast();
|
||||
rustc
|
||||
.env("RUSTC_BOOTSTRAP", "1")
|
||||
.args(["--print=target-spec-json-schema", "-Zunstable-options"]);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
use crate::Compiler;
|
||||
use crate::core::builder::{Builder, ShouldRun, Step};
|
||||
use crate::core::config::TargetSelection;
|
||||
use crate::utils::exec::command;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub(crate) struct MirOptPanicAbortSyntheticTarget {
|
||||
|
|
@ -55,7 +54,7 @@ fn create_synthetic_target(
|
|||
return TargetSelection::create_synthetic(&name, path.to_str().unwrap());
|
||||
}
|
||||
|
||||
let mut cmd = command(builder.rustc(compiler));
|
||||
let mut cmd = builder.rustc_cmd(compiler);
|
||||
cmd.arg("--target").arg(base.rustc_target_arg());
|
||||
cmd.args(["-Zunstable-options", "--print", "target-spec-json"]);
|
||||
|
||||
|
|
|
|||
|
|
@ -722,10 +722,8 @@ impl Builder<'_> {
|
|||
// Build proc macros both for the host and the target unless proc-macros are not
|
||||
// supported by the target.
|
||||
if target != compiler.host && cmd_kind != Kind::Check {
|
||||
let mut rustc_cmd = command(self.rustc(compiler));
|
||||
self.add_rustc_lib_path(compiler, &mut rustc_cmd);
|
||||
|
||||
let error = rustc_cmd
|
||||
let error = self
|
||||
.rustc_cmd(compiler)
|
||||
.arg("--target")
|
||||
.arg(target.rustc_target_arg())
|
||||
.arg("--print=file-names")
|
||||
|
|
|
|||
|
|
@ -1591,6 +1591,14 @@ Alternatively, you can set `build.local-rebuild=true` and use a stage0 compiler
|
|||
}
|
||||
}
|
||||
|
||||
/// Gets a command to run the compiler specified, including the dynamic library
|
||||
/// path in case the executable has not been build with `rpath` enabled.
|
||||
pub fn rustc_cmd(&self, compiler: Compiler) -> BootstrapCommand {
|
||||
let mut cmd = command(self.rustc(compiler));
|
||||
self.add_rustc_lib_path(compiler, &mut cmd);
|
||||
cmd
|
||||
}
|
||||
|
||||
/// Gets the paths to all of the compiler's codegen backends.
|
||||
fn codegen_backends(&self, compiler: Compiler) -> impl Iterator<Item = PathBuf> {
|
||||
fs::read_dir(self.sysroot_codegen_backends(compiler))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue