build: Ignore ASAN link order errors when generating typelib files

Without this when compiling GLib with address sanitizer enabled, we'd
end up failing with this error:

  ==375535==ASan runtime does not come first in initial library list;
  you should either link runtime to your application or manually preload
  it with LD_PRELOAD.

Now, given that addressing the fix implies doing more radical changes,
it's just fine here to ignore ASAN to work on tools we use for building
gir files.
This commit is contained in:
Marco Trevisan (Treviño) 2023-12-20 21:35:40 +01:00
parent 083322c0db
commit b82d28141d

View File

@ -7,6 +7,13 @@ gi_gen_shared_sources = [
gmodule_visibility_h, gmodule_visibility_h,
] ]
gi_gen_env_variables = environment()
if get_option('b_sanitize') != ''
gi_gen_env_variables.append(
'ASAN_OPTIONS', 'verify_asan_link_order=0', separator: ',')
endif
# GLib # GLib
glib_gir = gnome.generate_gir(libglib, glib_gir = gnome.generate_gir(libglib,
sources: [ sources: [
@ -32,6 +39,7 @@ glib_gir = gnome.generate_gir(libglib,
dependencies: [ dependencies: [
libgobject_dep, libgobject_dep,
], ],
env: gi_gen_env_variables,
extra_args: gir_args + [ extra_args: gir_args + [
'-DGLIB_COMPILATION', '-DGLIB_COMPILATION',
'-DGETTEXT_PACKAGE="dummy"', '-DGETTEXT_PACKAGE="dummy"',
@ -57,6 +65,7 @@ gobject_gir = gnome.generate_gir(libgobject,
header: 'glib-object.h', header: 'glib-object.h',
includes: [ glib_gir[0] ], includes: [ glib_gir[0] ],
install: true, install: true,
env: gi_gen_env_variables,
extra_args: gir_args + [ extra_args: gir_args + [
'-DGOBJECT_COMPILATION', '-DGOBJECT_COMPILATION',
'--symbol-prefix=gobject', '--symbol-prefix=gobject',
@ -84,6 +93,7 @@ gmodule_gir = gnome.generate_gir(libgmodule,
dependencies: [ dependencies: [
libglib_dep, libglib_dep,
], ],
env: gi_gen_env_variables,
extra_args: gir_args + [ extra_args: gir_args + [
'-DGMODULE_COMPILATION', '-DGMODULE_COMPILATION',
'-DGETTEXT_PACKAGE="dummy"', '-DGETTEXT_PACKAGE="dummy"',
@ -144,5 +154,6 @@ gio_gir = gnome.generate_gir(libgio,
libgobject_dep, libgobject_dep,
libgmodule_dep, libgmodule_dep,
], ],
env: gi_gen_env_variables,
extra_args: gir_args + gio_gir_args, extra_args: gir_args + gio_gir_args,
) )