configure, libgimp: disable introspection when building libgimp with sanitizer.

The initial issue was that 3 leaks were detected when running the "DumpCompiler"
during g-ir-scanner phase. The failing command was apparently about running some
temp binary, which looks like would be called the DumpCompiler in g-ir-scanner
code:

> libgimp/tmp-introspectn8jg64to/Gimp-3.0 --introspect-dump=libgimp/tmp-introspectn8jg64to/functions.txt,libgimp/tmp-introspectn8jg64to/dump.xml

My first fix attempt was to try and play with build/link FLAGS so that this temp
binary is built without sanitizer. But the problem when I did this was that
libgimp itself is sanitized, so we are mixing a sanitized lib with a
non-sanitized binary:

> 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.

So it looks like I could still solve this with tweaking LD_PRELOAD, cf. this
sanitizer FAQ: https://github.com/google/sanitizers/wiki/AddressSanitizer#faq

Nevertheless it proved complex to do it right while not interfering with other
parts of the build and I found out that I risk encountering more issues down the
road with GIR + sanitizer:
https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/375

So I've decided that I didn't want to waste too much time on this and simply
disable introspection when sanitizing, as I guess what we care the most to
diagnose when sanitizing is core code anyway.
This commit is contained in:
Jehan 2023-02-22 12:02:13 +01:00
parent 0b75fbd91c
commit 36cc6c6e8a
1 changed files with 14 additions and 6 deletions

View File

@ -2306,12 +2306,8 @@ AC_ARG_ENABLE(force-gir-cross-compilation,
AC_MSG_CHECKING([if introspecting libgimp])
warning_gir=
build_gir=yes
if test "x$cross_compiling" != xyes ||
test "x$enable_force_gir_cross_compilation" = xyes; then
# When not-cross-compiling, we always build with introspection.
# It's the basic case.
GOBJECT_INTROSPECTION_REQUIRE(introspection_required_version)
else
if test "x$cross_compiling" = xyes &&
test "x$enable_force_gir_cross_compilation" != xyes; then
build_gir=no
warning_gir="
WARNING: GObject Introspection is disabled while cross-compiling because
@ -2321,6 +2317,18 @@ WARNING: GObject Introspection is disabled while cross-compiling because
this data natively.
To forcefully build with GObject Introspection, set:
--enable-force-gir-cross-compilation"
else
sanitizing=`echo "$CFLAGS $CXXFLAGS $LDFLAGS" | grep "fsanitize="`
if test $? -eq 0; then
build_gir=no
warning_gir="
WARNING: GObject Introspection is disabled when building with a sanitizer.
See: https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/375"
else
# When not-cross-compiling, we always build with introspection.
# It's the basic case.
GOBJECT_INTROSPECTION_REQUIRE(introspection_required_version)
fi
fi
AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$build_gir" != xno)
AC_MSG_RESULT([$build_gir])