提交 2f340a4d 编写于 作者: B Brian Anderson

rpath the path to the runtime

We don't currently rpath native libs, but we do know where rustrt is
located and everything needs to link to it.
上级 3d5471f6
...@@ -20,10 +20,14 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> [str] { ...@@ -20,10 +20,14 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> [str] {
let sysroot = sess.filesearch().sysroot(); let sysroot = sess.filesearch().sysroot();
let output = out_filename; let output = out_filename;
let libs = cstore::get_used_crate_files(sess.get_cstore()); let libs = cstore::get_used_crate_files(sess.get_cstore());
// We don't currently rpath native libraries, but we know
// where rustrt is and we know every rust program needs it
let libs = libs + [get_sysroot_absolute_rt_lib(sess)];
let target_triple = sess.get_opts().target_triple; let target_triple = sess.get_opts().target_triple;
let rpaths = get_rpaths(cwd, sysroot, output, libs, target_triple); let rpaths = get_rpaths(cwd, sysroot, output, libs, target_triple);
rpaths_to_flags(rpaths); rpaths_to_flags(rpaths);
[] // FIXME: activate RPATH! [] // FIXME: Activate RPATH!
} }
#[cfg(target_os="win32")] #[cfg(target_os="win32")]
...@@ -31,6 +35,15 @@ fn get_rpath_flags(_sess: session::session, _out_filename: str) -> [str] { ...@@ -31,6 +35,15 @@ fn get_rpath_flags(_sess: session::session, _out_filename: str) -> [str] {
[] []
} }
fn get_sysroot_absolute_rt_lib(sess: session::session) -> fs::path {
let path = [sess.filesearch().sysroot()]
+ filesearch::relative_target_lib_path(
sess.get_opts().target_triple)
+ [os::dylib_filename("rustrt")];
check vec::is_not_empty(path);
fs::connect_many(path)
}
fn rpaths_to_flags(rpaths: [str]) -> [str] { fn rpaths_to_flags(rpaths: [str]) -> [str] {
vec::map({ |rpath| #fmt("-Wl,-rpath,%s",rpath)}, rpaths) vec::map({ |rpath| #fmt("-Wl,-rpath,%s",rpath)}, rpaths)
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册