@@ -71,7 +71,7 @@ fn get_rpaths(os: session::os, cwd: fs::path, sysroot: fs::path,
71
71
let abs_rpaths = get_absolute_rpaths ( cwd, libs) ;
72
72
73
73
// And a final backup rpath to the global library location.
74
- let fallback_rpaths = [ get_install_prefix_rpath ( target_triple) ] ;
74
+ let fallback_rpaths = [ get_install_prefix_rpath ( cwd , target_triple) ] ;
75
75
76
76
fn log_rpaths ( desc : str , rpaths : [ str ] ) {
77
77
log #fmt( "%s rpaths:" , desc) ;
@@ -166,7 +166,7 @@ fn get_absolute(cwd: fs::path, lib: fs::path) -> fs::path {
166
166
}
167
167
}
168
168
169
- fn get_install_prefix_rpath ( target_triple : str ) -> str {
169
+ fn get_install_prefix_rpath ( cwd : fs :: path , target_triple : str ) -> str {
170
170
let install_prefix = #env ( "CFG_PREFIX" ) ;
171
171
172
172
if install_prefix == "" {
@@ -176,7 +176,7 @@ fn get_install_prefix_rpath(target_triple: str) -> str {
176
176
let path = [ install_prefix]
177
177
+ filesearch:: relative_target_lib_path ( target_triple) ;
178
178
check vec:: is_not_empty ( path) ;
179
- fs:: connect_many ( path)
179
+ get_absolute ( cwd , fs:: connect_many ( path) )
180
180
}
181
181
182
182
fn minimize_rpaths ( rpaths : [ str ] ) -> [ str ] {
@@ -219,8 +219,15 @@ mod test {
219
219
220
220
#[ test]
221
221
fn test_prefix_rpath ( ) {
222
- let res = get_install_prefix_rpath ( "triple" ) ;
223
- assert res == #env ( "CFG_PREFIX" ) + "/lib/rustc/triple/lib" ;
222
+ let res = get_install_prefix_rpath ( "/usr/lib" , "triple" ) ;
223
+ assert str:: ends_with ( res, #env ( "CFG_PREFIX" )
224
+ + "/lib/rustc/triple/lib" ) ;
225
+ }
226
+
227
+ #[ test]
228
+ fn test_prefix_rpath_abs ( ) {
229
+ let res = get_install_prefix_rpath ( "/usr/lib" , "triple" ) ;
230
+ assert str:: starts_with ( res, "/" ) ;
224
231
}
225
232
226
233
#[ test]
0 commit comments