Skip to content

Commit e330d4b

Browse files
committed
Use target libraries instead of host libraries. Fixes #11243
1 parent 7fe8692 commit e330d4b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/librustpkg/context.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ impl Context {
163163
pub fn in_target(sysroot: &Path) -> bool {
164164
debug!("Checking whether {} is in target", sysroot.display());
165165
let mut p = sysroot.dir_path();
166-
p.set_filename(rustlibdir());
166+
p.pop();
167+
p.push(rustlibdir());
167168
p.is_dir()
168169
}
169170

src/librustpkg/path_util.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub use target::{OutputType, Main, Lib, Test, Bench, Target, Build, Install};
1717
pub use version::{Version, ExactRevision, NoVersion, split_version, split_version_general,
1818
try_parsing_version};
1919
pub use rustc::metadata::filesearch::rust_path;
20-
use rustc::metadata::filesearch::libdir;
20+
use rustc::metadata::filesearch::{libdir, relative_target_lib_path};
2121
use rustc::driver::driver::host_triple;
2222

2323
use std::libc;
@@ -213,10 +213,9 @@ pub fn library_in_workspace(path: &Path, short_name: &str, where: Target,
213213
library_in(short_name, version, &dir_to_search)
214214
}
215215

216-
// rustc doesn't use target-specific subdirectories
217216
pub fn system_library(sysroot: &Path, crate_id: &str) -> Option<Path> {
218217
let (lib_name, version) = split_crate_id(crate_id);
219-
library_in(lib_name, &version, &sysroot.join(libdir()))
218+
library_in(lib_name, &version, &sysroot.join(relative_target_lib_path(host_triple())))
220219
}
221220

222221
fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Option<Path> {

src/librustpkg/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ impl<'a> Visitor<()> for ViewItemVisitor<'a> {
459459
};
460460
debug!("Finding and installing... {}", lib_name);
461461
// Check standard Rust library path first
462-
let whatever = system_library(&self.context.sysroot(), lib_name);
462+
let whatever = system_library(&self.context.sysroot_to_use(), lib_name);
463463
debug!("system library returned {:?}", whatever);
464464
match whatever {
465465
Some(ref installed_path) => {

0 commit comments

Comments
 (0)