bootstrap: do not rely on LIBRARY_PATH env variable · rust-lang/rust@7f743c7 (original) (raw)

`@@ -24,8 +24,8 @@ use crate::core::config::flags::{Subcommand, get_completion};

`

24

24

`use crate::utils::build_stamp::{self, BuildStamp};

`

25

25

`use crate::utils::exec::{BootstrapCommand, command};

`

26

26

`use crate::utils::helpers::{

`

27

``

`-

self, LldThreads, add_link_lib_path, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var,

`

28

``

`-

linker_args, linker_flags, t, target_supports_cranelift_backend, up_to_date,

`

``

27

`+

self, LldThreads, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var, linker_args,

`

``

28

`+

linker_flags, t, target_supports_cranelift_backend, up_to_date,

`

29

29

`};

`

30

30

`use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests};

`

31

31

`use crate::{CLang, DocTests, GitRepo, Mode, PathSet, envify};

`

`@@ -1975,11 +1975,17 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the

`

1975

1975

`` // Tests that use compiler libraries may inherit the -lLLVM link

``

1976

1976

`` // requirement, but the -L library path is not propagated across

``

1977

1977

`// separate compilations. We can add LLVM's library path to the

`

1978

``

`-

// platform-specific environment variable as a workaround.

`

``

1978

`+

// rustc args as a workaround.

`

1979

1979

`if !builder.config.dry_run() && suite.ends_with("fulldeps") {

`

1980

1980

`let llvm_libdir =

`

1981

1981

`command(&llvm_config).arg("--libdir").run_capture_stdout(builder).stdout();

`

1982

``

`-

add_link_lib_path(vec![llvm_libdir.trim().into()], &mut cmd);

`

``

1982

`+

let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default();

`

``

1983

`+

if target.is_msvc() {

`

``

1984

`+

rustflags.push_str(&format!("-Clink-arg=-LIBPATH:{llvm_libdir}"));

`

``

1985

`+

} else {

`

``

1986

`+

rustflags.push_str(&format!("-Clink-arg=-L{llvm_libdir}"));

`

``

1987

`+

}

`

``

1988

`+

cmd.env("RUSTFLAGS", rustflags);

`

1983

1989

`}

`

1984

1990

``

1985

1991

`if !builder.config.dry_run() && matches!(mode, "run-make" | "coverage-run") {

`