Skip to content

Instantly share code, notes, and snippets.

@eholk
Created June 17, 2011 18:15
Show Gist options
  • Save eholk/1031941 to your computer and use it in GitHub Desktop.
Save eholk/1031941 to your computer and use it in GitHub Desktop.
An initial look at rpath for rust in linux.
iff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs
index e0a6d28..aa2a226 100644
--- a/src/comp/driver/rustc.rs
+++ b/src/comp/driver/rustc.rs
@@ -418,6 +418,13 @@ fn main(vec[str] args) {
case (session::os_linux) {
shared_cmd = "-shared";
gcc_args = common_args + ["-march=i686", "-O2", "-m32"];
+
+ auto opts = sess.get_opts();
+ for (str path in opts.library_search_paths) {
+ path = fs::make_absolute(path);
+ log_err "Adding " + path + " to rpath.";
+ gcc_args += ["-Xlinker", "-rpath=" + path];
+ }
}
}
if (sopts.shared) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment