From b1a0422b7601a11bc392639d50d6c559457a9bce Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Sat, 23 Dec 2017 13:22:23 -0800 Subject: [PATCH] Fix linking with clang++ on linux if install_rpath. --- mesonbuild/compilers/compilers.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 011c222c4..ce96c60e6 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -860,7 +860,12 @@ class Compiler: # Not needed on Windows or other platforms that don't use RPATH # https://github.com/mesonbuild/meson/issues/1897 lpaths = ':'.join([os.path.join(build_dir, p) for p in rpath_paths]) - args += ['-Wl,-rpath-link,' + lpaths] + + # clang expands '-Wl,rpath-link,' to ['-rpath-link'] instead of ['-rpath-link',''] + # This eats the next argument, which happens to be 'ldstdc++', causing link failures. + # We can dodge this problem by not adding any rpath_paths if the argument is empty. + if lpaths.strip() != '': + args += ['-Wl,-rpath-link,'+lpaths] return args