From 64319fcb6e44b7db1cd487bcb892cea8dfa737ae Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Tue, 8 Nov 2022 15:04:35 +0100 Subject: [PATCH] Pre-build glib-2.0 libraries with TSAN enabled (#23519) --- .../docker/images/chip-build/Dockerfile | 17 +++++++++++++++++ integrations/docker/images/chip-build/version | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/integrations/docker/images/chip-build/Dockerfile b/integrations/docker/images/chip-build/Dockerfile index 782aa74f64afea..d53978c727c8f3 100644 --- a/integrations/docker/images/chip-build/Dockerfile +++ b/integrations/docker/images/chip-build/Dockerfile @@ -49,6 +49,7 @@ RUN set -x \ libusb-dev \ libxml2-dev \ make \ + meson \ net-tools \ ninja-build \ openjdk-8-jdk \ @@ -131,3 +132,19 @@ RUN set -x \ && cd .. \ && rm -rf node_js \ && : # last line + +# Build glib-2.0 from source with enabled thread sanitizer. This is needed for +# running CHIP tests with TSAN enabled. When running applications with TSAN +# all shared libraries should be built with TSAN enabled, otherwise TSAN might +# report false positives. This case is most prominent with glib-2.0, which has +# a lot of threads-related APIs. +ENV LD_LIBRARY_PATH_TSAN=/usr/lib/x86_64-linux-gnu-tsan +RUN set -x \ + && mkdir -p $LD_LIBRARY_PATH_TSAN \ + && GLIB_VERSION=$(pkg-config --modversion glib-2.0) \ + && git clone --depth=1 --branch=$GLIB_VERSION https://github.com/GNOME/glib.git \ + && CFLAGS="-O2 -g -fsanitize=thread" meson glib/build glib \ + && DESTDIR=../build-image ninja -C glib/build install \ + && mv glib/build-image/usr/local/lib/x86_64-linux-gnu/lib* $LD_LIBRARY_PATH_TSAN \ + && rm -rf glib \ + && : # last line diff --git a/integrations/docker/images/chip-build/version b/integrations/docker/images/chip-build/version index 31a9e441a4fc04..00402354e9ff3b 100644 --- a/integrations/docker/images/chip-build/version +++ b/integrations/docker/images/chip-build/version @@ -1 +1 @@ -0.6.06 Version bump reason: [Telink] Update Telink Docker. +0.6.07 Version bump reason: Build glib-2.0 libs with TSAN