Skip to content

Commit e7a71e8

Browse files
committed
rustc_driver: Use the target tools PATH
When cross-compiling the PATH for the target should be favored (instead of the host) because if we're going to run some custom tools then we likely want to run the custom tools from the target, not the host (e.g. if GNU windows is compiling to MSVC windows).
1 parent 0d73d53 commit e7a71e8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/librustc_driver/driver.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,8 @@ pub fn phase_6_link_output(sess: &Session,
761761
trans: &trans::CrateTranslation,
762762
outputs: &OutputFilenames) {
763763
let old_path = env::var_os("PATH").unwrap_or(OsString::new());
764-
let mut new_path = sess.host_filesearch(PathKind::All).get_tools_search_paths();
764+
let mut new_path = sess.target_filesearch(PathKind::All)
765+
.get_tools_search_paths();
765766
new_path.extend(env::split_paths(&old_path));
766767
env::set_var("PATH", &env::join_paths(new_path.iter()).unwrap());
767768

0 commit comments

Comments
 (0)