[mutter] meson: Let the linker create RPATH instead of RUNPATH tag



commit a76542e191944083f5cdf61ea98bdc1d21aa4cf7
Author: Sebastian Wick <sebastian wick redhat com>
Date:   Tue Feb 22 23:22:38 2022 +0100

    meson: Let the linker create RPATH instead of RUNPATH tag
    
    Running meson test from the build directory in a jhbuild environment
    picks up libraries which have been installed previously because
    LD_LIBRARY_PATH takes precendence over RUNPATH. Make the linker generate
    the RPATH tag again.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2307>

 meson.build | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/meson.build b/meson.build
index 404885404c..898a67fa0f 100644
--- a/meson.build
+++ b/meson.build
@@ -59,6 +59,20 @@ i18n  = import('i18n')
 fs = import('fs')
 cc = meson.get_compiler('c')
 
+add_project_link_arguments(
+  cc.get_supported_link_arguments(
+    # meson automatically adds -rpath to targets and strips them when they
+    # are installed. ld adds a RUNPATH tag for -rpath arguments by default.
+    # This makes ld add a RPATH tag instead (as it did some time ago).
+    # The reason why we want RPATH and not RUNPATH is that LD_LIBRARY_PATH
+    # takes precedence over RUNPATH but not over RPATH. Since we usually run
+    # development builds in jhbuild which sets up LD_LIBRARY_PATH this can
+    # result in wrong dependencies being picked up by the linker.
+    '-Wl,--disable-new-dtags',
+  ),
+  language : 'c',
+)
+
 prefix = get_option('prefix')
 
 bindir = join_paths(prefix, get_option('bindir'))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]