gnome.generate_gir(): Fix linking to libasan if sanitizer enabled

This is a bit of a workaround linking directly to it but it is
at least functional unlike before.

Fixes #1910
pull/1948/head
Patrick Griffis 8 years ago
parent 604adce33f
commit ccb253189a
  1. 9
      mesonbuild/modules/gnome.py

@ -444,6 +444,7 @@ class GnomeModule(ExtensionModule):
'Gir includes must be str, GirTarget, or list of them')
cflags = []
ldflags = []
for lang, compiler in girtarget.compilers.items():
# XXX: Can you use g-i with any other language?
if lang in ('c', 'cpp', 'objc', 'objcpp', 'd'):
@ -459,6 +460,11 @@ class GnomeModule(ExtensionModule):
if 'b_sanitize' in compiler.base_options:
sanitize = state.environment.coredata.base_options['b_sanitize'].value
cflags += compilers.sanitizer_compile_args(sanitize)
if sanitize == 'address':
ldflags += ['-lasan']
# FIXME: Linking directly to libasan is not recommended but g-ir-scanner
# does not understand -f LDFLAGS. https://bugzilla.gnome.org/show_bug.cgi?id=783892
# ldflags += compilers.sanitizer_link_args(sanitize)
if kwargs.get('symbol_prefix'):
sym_prefix = kwargs.pop('symbol_prefix')
if not isinstance(sym_prefix, str):
@ -521,9 +527,10 @@ class GnomeModule(ExtensionModule):
# ldflags will be misinterpreted by gir scanner (showing
# spurious dependencies) but building GStreamer fails if they
# are not used here.
dep_cflags, ldflags, gi_includes = self._get_dependencies_flags(deps, state, depends,
dep_cflags, dep_ldflags, gi_includes = self._get_dependencies_flags(deps, state, depends,
use_gir_args=True)
cflags += list(dep_cflags)
ldflags += list(dep_ldflags)
scan_command += ['--cflags-begin']
scan_command += cflags
scan_command += ['--cflags-end']

Loading…
Cancel
Save