From 9880dba15c25ff8d1ca59a255a538b8fb881962c Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Fri, 26 Jul 2024 10:53:52 +0200 Subject: [PATCH] package/cairo: fix build without threads Fix the following build failure without threads raised since switch to meson-package in commit 1fa58814c09a71444f961b61a9a2c399b9163fc2 which wrongly removed -DCAIRO_NO_MUTEX=1: In file included from ../src/cairo-mutex-type-private.h:45, from ../src/cairo-scaled-font-private.h:45, from ../src/cairoint.h:415, from ../src/cairo-arc.c:37: ../src/cairo-mutex-impl-private.h:231:3: error: #error "XXX: No mutex implementation found. Cairo will not work with multiple threads. Define CAIRO_NO_MUTEX to 1 to acknowledge and accept this limitation and compile cairo without thread-safety support." 231 | # error "XXX: No mutex implementation found. Cairo will not work with multiple threads. Define CAIRO_NO_MUTEX to 1 to acknowledge and accept this limitation and compile cairo without thread-safety support." | ^~~~~ Note that prior to 1fa58814c09a71444f961b61a9a2c399b9163fc2, the condition was: ifeq ($(BR2_TOOLCHAIN_HAS_THREADS_NPTL),) CAIRO_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -DCAIRO_NO_MUTEX=1" endif but that was in fact wrong, because it meant that toolchain with linuxthreads (not NPTL) would have thread support, but a thread-unsafe cairo library. The condition was changed from BR2_TOOLCHAIN_HAS_THREADS to BR2_TOOLCHAIN_HAS_THREADS_NPTL in an older commit, 92f14307ba670058d0b3692fb8e82753d6ad6868, but now cairo's mutex support builds fine with linuxthreads, so we can use CAIRO_NO_MUTEX=1 only when thread support is not available at all. Fixes: 1fa58814c09a71444f961b61a9a2c399b9163fc2 - http://autobuild.buildroot.org/results/a123355b6d315d2fcda646d3f1c7b588cba78258 Signed-off-by: Fabrice Fontaine Signed-off-by: Thomas Petazzoni --- package/cairo/cairo.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/cairo/cairo.mk b/package/cairo/cairo.mk index 4ace04ebbe..ba25620f8d 100644 --- a/package/cairo/cairo.mk +++ b/package/cairo/cairo.mk @@ -20,6 +20,10 @@ ifeq ($(BR2_m68k_cf),y) CAIRO_CFLAGS += -mxgot endif +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),) +CAIRO_CFLAGS += -DCAIRO_NO_MUTEX=1 +endif + # cairo can use C++11 atomics when available, so we need to link with # libatomic for the architectures who need libatomic. ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)