Skip to content

Commit 008dfb3

Browse files
committed
compilers: add Rustup libdir even if there is no other rpath argument
RustCompiler.build_rpath_args works by appending the directory to the arguments computed by self.linker.build_rpath_args. This does not work if there is no argument to begin with, which happens for example in program crates. Use the new extra_paths argument to force inclusion of the libdir into the rpath of the binary, even in that case. Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 8db4fc9 commit 008dfb3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mesonbuild/compilers/rust.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,15 @@ def get_optimization_args(self, optimization_level: str) -> T.List[str]:
203203
def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
204204
rpath_paths: T.Tuple[str, ...], build_rpath: str,
205205
install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
206-
args, to_remove = super().build_rpath_args(env, build_dir, from_dir, rpath_paths,
207-
build_rpath, install_rpath)
206+
# add rustc's sysroot to account for rustup installations
207+
args, to_remove = self.linker.build_rpath_args(env, build_dir, from_dir, rpath_paths,
208+
build_rpath, install_rpath,
209+
[self.get_target_libdir()])
208210

209-
# ... but then add rustc's sysroot to account for rustup
210-
# installations
211211
rustc_rpath_args = []
212212
for arg in args:
213213
rustc_rpath_args.append('-C')
214-
rustc_rpath_args.append(f'link-arg={arg}:{self.get_target_libdir()}')
214+
rustc_rpath_args.append('link-arg=' + arg)
215215
return rustc_rpath_args, to_remove
216216

217217
def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str],

0 commit comments

Comments
 (0)