diff mbox series

[1/1] package/cairo: fix build without NPTL

Message ID 20240726085352.1238297-1-fontaine.fabrice@gmail.com
State Accepted
Headers show
Series [1/1] package/cairo: fix build without NPTL | expand

Commit Message

Fabrice Fontaine July 26, 2024, 8:53 a.m. UTC
Fix the following build failure without NPTL 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."
      |   ^~~~~

Fixes: 1fa58814c09a71444f961b61a9a2c399b9163fc2
 - http://autobuild.buildroot.org/results/a123355b6d315d2fcda646d3f1c7b588cba78258

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/cairo/cairo.mk | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Thomas Petazzoni July 27, 2024, 4:36 p.m. UTC | #1
On Fri, 26 Jul 2024 10:53:52 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS_NPTL),)
> +CAIRO_CFLAGS += -DCAIRO_NO_MUTEX=1
> +endif

Not your fault because it was already like this before, but I believe
92f14307ba670058d0b3692fb8e82753d6ad6868 was wrong. Indeed, it means
that when thread support is enabled, but not with NPTL, we disable
mutex support in cairo. This means that a multi-threaded application
that uses cairo will be using a version of cairo without mutexes, which
seems very wrong.

Not be honest, I am unsure on how to proceed with this. Add a
BR2_TOOLCHAIN_HAS_THREADS_NPTL dependency to cairo?

Maybe retry if toolchains with threads not provided by NPTL continue to
fail building the mutex code? (Though I doubt anything has changed in
this area). Or maybe uClibc-ng has been improved to the point where the
mutex code now builds correctly with !NPTL threads?

Thomas
Thomas Petazzoni Aug. 2, 2024, 5:28 p.m. UTC | #2
Hello Fabrice,

On Fri, 26 Jul 2024 10:53:52 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS_NPTL),)

As pointed out during my review, and clarified by Waldemar, uClibc
linuxthreads now has everything needed to build the cairo mutex code.
So I changed this to:

ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)

and updated the commit log accordingly.

Applied with this change. Thanks!

Best regards,

Thomas
diff mbox series

Patch

diff --git a/package/cairo/cairo.mk b/package/cairo/cairo.mk
index 4ace04ebbe..3cfc182d09 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_NPTL),)
+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)