From: Michael Olbrich Date: Mon, 18 Mar 2019 10:42:15 +0100 Subject: [PATCH] don't add rpaths for build directories when cross-compiling The binaries cannot be executed anyways, so this just increases the binary size unnecessarily. Signed-off-by: Michael Olbrich --- mesonbuild/compilers/compilers.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index b188788b915a..aafabd4f7a1b 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1277,7 +1277,10 @@ class Compiler: # Need to deduplicate rpaths, as macOS's install_name_tool # is *very* allergic to duplicate -delete_rpath arguments # when calling depfixer on installation. - all_paths = OrderedSet([os.path.join(origin_placeholder, p) for p in processed_rpaths]) + if not self.is_cross: + all_paths = OrderedSet([os.path.join(origin_placeholder, p) for p in processed_rpaths]) + else: + all_paths = OrderedSet() # Build_rpath is used as-is (it is usually absolute). if build_rpath != '': all_paths.add(build_rpath) @@ -1304,7 +1307,8 @@ class Compiler: paths = padding else: paths = paths + ':' + padding - args.append('-Wl,-rpath,' + paths) + if paths: + args.append('-Wl,-rpath,' + paths) if mesonlib.is_sunos(): return args