From 53ea59ad8455277797117d225f326851fe7d369c Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Thu, 9 Nov 2023 20:18:19 +0100 Subject: [PATCH] clike: Deduplicate rpath linker flags [why] On Apple clang 15.0.0 linker (i.e. ld64 1015.7) giving the same rpath multiple times raises a warning: ld: warning: duplicate -rpath '/local/lib' ignored This can frequently happen when linking several dependencies that all have that rpath in e.g. pkgconfig. [how] Deduplicate all rpath arguments. [note] I'm not sure how the code handles --start/end-group, but for rpath that should not make any difference as that is not bound to a group. Signed-off-by: Fini Jastrow --- mesonbuild/compilers/mixins/clike.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index ca909998b..ad8fa2747 100644 --- a/mesonbuild/compilers/mixins/clike.py +++ b/mesonbuild/compilers/mixins/clike.py @@ -1,4 +1,4 @@ -# Copyright 2012-2022 The Meson development team +# Copyright 2012-2023 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ class CLikeCompilerArgs(arglist.CompilerArgs): # NOTE: not thorough. A list of potential corner cases can be found in # https://github.com/mesonbuild/meson/pull/4593#pullrequestreview-182016038 - dedup1_prefixes = ('-l', '-Wl,-l', '-Wl,--export-dynamic') + dedup1_prefixes = ('-l', '-Wl,-l', '-Wl,--export-dynamic', '-Wl,-rpath') dedup1_suffixes = ('.lib', '.dll', '.so', '.dylib', '.a') dedup1_args = ('-c', '-S', '-E', '-pipe', '-pthread')