Make rpath work on mac

This commit is contained in:
Brian Anderson 2011-10-06 13:09:00 -07:00
parent 9c037d2194
commit d8a85f0758
4 changed files with 16 additions and 5 deletions

View file

@ -567,6 +567,13 @@ fn link_binary(sess: session::session,
if sess.get_opts().library {
gcc_args += [lib_cmd];
// On mac we need to tell the linker to let this library
// be rpathed
if sess.get_targ_cfg().os == session::os_macos {
gcc_args += ["-Wl,-install_name,@rpath/"
+ fs::basename(saved_out_filename)];
}
} else {
// FIXME: why do we hardcode -lm?
gcc_args += ["-lm", main];