diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2021-07-14 17:37:39 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2021-08-10 15:28:20 +0530 |
commit | 3868e833fcf08463d2bc2d5dee1209125b826b9e (patch) | |
tree | a2d24994cc382d8ab2702af5aa3c8c1fc4fc7b22 | |
parent | 6b6ddf9c4870978932833df276b19edec43d4d28 (diff) | |
download | meson-3868e833fcf08463d2bc2d5dee1209125b826b9e.zip meson-3868e833fcf08463d2bc2d5dee1209125b826b9e.tar.gz meson-3868e833fcf08463d2bc2d5dee1209125b826b9e.tar.bz2 |
gnome: Always pass absolute -L paths to g-ir-scanner
g-ir-scanner does not convert relative -L paths to runtime paths which
are added to -Wl,-rpath and LD_LIBRARY_PATH / DYLD_LIBRARY_PATH
/ PATH. This means that the local library will either not be found at
runtime (while building introspection data), or the system-wide
library will be picked instead.
See: giscanner/ccompiler.py:get_internal_link_flags() in
gobject-introspection for more details.
-rw-r--r-- | mesonbuild/modules/gnome.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 1b68f6c..3cc8ebd 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -640,14 +640,18 @@ class GnomeModule(ExtensionModule): # Because of https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/72 # we can't use the full path until this is merged. libpath = os.path.join(girtarget.get_subdir(), girtarget.get_filename()) + # Must use absolute paths here because g-ir-scanner will not + # add them to the runtime path list if they're relative. This + # means we cannot use @BUILD_ROOT@ + build_root = state.environment.get_build_dir() if isinstance(girtarget, build.SharedLibrary): # need to put our output directory first as we need to use the # generated libraries instead of any possibly installed system/prefix # ones. - ret += ["-L@BUILD_ROOT@/{}".format(os.path.dirname(libpath))] + ret += ["-L{}/{}".format(build_root, os.path.dirname(libpath))] libname = girtarget.get_basename() else: - libname = os.path.join(f"@BUILD_ROOT@/{libpath}") + libname = os.path.join(f"{build_root}/{libpath}") ret += ['--library', libname] # Needed for the following binutils bug: # https://github.com/mesonbuild/meson/issues/1911 |