Skip to content

Commit

Permalink
Use target libraries instead of host libraries. Fixes #11243
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Jan 11, 2014
1 parent 7fe8692 commit e330d4b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/librustpkg/context.rs
Expand Up @@ -163,7 +163,8 @@ impl Context {
pub fn in_target(sysroot: &Path) -> bool {
debug!("Checking whether {} is in target", sysroot.display());
let mut p = sysroot.dir_path();
p.set_filename(rustlibdir());
p.pop();
p.push(rustlibdir());
p.is_dir()
}

Expand Down
5 changes: 2 additions & 3 deletions src/librustpkg/path_util.rs
Expand Up @@ -17,7 +17,7 @@ pub use target::{OutputType, Main, Lib, Test, Bench, Target, Build, Install};
pub use version::{Version, ExactRevision, NoVersion, split_version, split_version_general,
try_parsing_version};
pub use rustc::metadata::filesearch::rust_path;
use rustc::metadata::filesearch::libdir;
use rustc::metadata::filesearch::{libdir, relative_target_lib_path};
use rustc::driver::driver::host_triple;

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

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

fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Option<Path> {
Expand Down
2 changes: 1 addition & 1 deletion src/librustpkg/util.rs
Expand Up @@ -459,7 +459,7 @@ impl<'a> Visitor<()> for ViewItemVisitor<'a> {
};
debug!("Finding and installing... {}", lib_name);
// Check standard Rust library path first
let whatever = system_library(&self.context.sysroot(), lib_name);
let whatever = system_library(&self.context.sysroot_to_use(), lib_name);
debug!("system library returned {:?}", whatever);
match whatever {
Some(ref installed_path) => {
Expand Down

5 comments on commit e330d4b

@bors
Copy link
Contributor

@bors bors commented on e330d4b Jan 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at jhasse@e330d4b

@bors
Copy link
Contributor

@bors bors commented on e330d4b Jan 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging jhasse/rust/patch-rustpkgtarget = e330d4b into auto

@bors
Copy link
Contributor

@bors bors commented on e330d4b Jan 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jhasse/rust/patch-rustpkgtarget = e330d4b merged ok, testing candidate = db9ef28

@bors
Copy link
Contributor

@bors bors commented on e330d4b Jan 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on e330d4b Jan 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = db9ef28

Please sign in to comment.