diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2019-05-25 19:01:44 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-05-28 20:25:37 +0300 |
commit | 20eb948b974a96b3933d42db524fd584cb60c8b7 (patch) | |
tree | cb2f852c349b661b827e803a661d45e74a40368a /mesonbuild/modules/gnome.py | |
parent | 949187868196edc4fa3ba21b033f8a08a2b391d6 (diff) | |
download | meson-20eb948b974a96b3933d42db524fd584cb60c8b7.zip meson-20eb948b974a96b3933d42db524fd584cb60c8b7.tar.gz meson-20eb948b974a96b3933d42db524fd584cb60c8b7.tar.bz2 |
gnome: make sure the target build directory is passed first for linking
determine_rpath_dirs() can return paths to external dependencies not
in the build dir and passing them first as a link path leads to
g-ir-scanner for example linking against the already installed library
instead of the just built one.
This was reported in g-i: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/272
and comes up quite often when a library adds some new symbols which aren't present in the
system library, which then makes linking fail.
The first place where the order is changed is _scan_gir_targets(), which looks like an unintentional
change in the refactoring in 8377ea45aa61efbe8e1a75b74
The second place in _get_link_args() has always been that way and only the rpath order is changed,
but it looks to me as if the same rules should apply here too.
Diffstat (limited to 'mesonbuild/modules/gnome.py')
-rw-r--r-- | mesonbuild/modules/gnome.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index e20bae6..a223b78 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -299,6 +299,9 @@ class GnomeModule(ExtensionModule): if isinstance(lib, build.SharedLibrary): libdir = os.path.join(state.environment.get_build_dir(), state.backend.get_target_dir(lib)) link_command.append('-L' + libdir) + if include_rpath: + link_command.append('-Wl,-rpath,' + libdir) + depends.append(lib) # Needed for the following binutils bug: # https://github.com/mesonbuild/meson/issues/1911 # However, g-ir-scanner does not understand -Wl,-rpath @@ -308,9 +311,6 @@ class GnomeModule(ExtensionModule): link_command.append('-L' + d) if include_rpath: link_command.append('-Wl,-rpath,' + d) - if include_rpath: - link_command.append('-Wl,-rpath,' + libdir) - depends.append(lib) if gir_has_option(self.interpreter, '--extra-library') and use_gir_args: link_command.append('--extra-library=' + lib.name) else: @@ -553,6 +553,11 @@ class GnomeModule(ExtensionModule): libname = girtarget.get_basename() else: libname = os.path.join("@PRIVATE_OUTDIR_ABS_%s@" % girtarget.get_id(), girtarget.get_filename()) + ret += ['--library', libname] + # 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@PRIVATE_OUTDIR_ABS_%s@" % girtarget.get_id()] # Needed for the following binutils bug: # https://github.com/mesonbuild/meson/issues/1911 # However, g-ir-scanner does not understand -Wl,-rpath @@ -560,11 +565,6 @@ class GnomeModule(ExtensionModule): for d in state.backend.determine_rpath_dirs(girtarget): d = os.path.join(state.environment.get_build_dir(), d) ret.append('-L' + d) - ret += ['--library', libname] - # 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@PRIVATE_OUTDIR_ABS_%s@" % girtarget.get_id()] return ret |