Skip to content

Commit ba7ae7c

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 e30bc27 commit ba7ae7c

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
@@ -202,15 +202,15 @@ def get_optimization_args(self, optimization_level: str) -> T.List[str]:
202202
def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
203203
rpath_paths: T.Tuple[str, ...], build_rpath: str,
204204
install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
205-
args, to_remove = super().build_rpath_args(env, build_dir, from_dir, rpath_paths,
206-
build_rpath, install_rpath)
205+
# add rustc's sysroot to account for rustup installations
206+
args, to_remove = self.linker.build_rpath_args(env, build_dir, from_dir, rpath_paths,
207+
build_rpath, install_rpath,
208+
[self.get_target_libdir()])
207209

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

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

0 commit comments

Comments
 (0)