Skip to contentSkip to conversation

package/cairo: fix pthread detection

PATCH In review Fabrice Fontaine 3 participants 5 messages Feb 23, 2023 – Sep 11, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/cairo: fix pthread detection

pthreads detection fails if a warning is emitted resulting in the following build failure with some toolchains:

onfigure:34189: checking for cairo's pthread feature
configure:34300: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2 -D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c -lrt -latomic -lexecinfo -lm -lpthread >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
configure:34300: $? = 0
configure:34419: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2 -pthread -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c -lrt -latomic -lexecinfo -lm >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
configure:34419: $? = 0
configure:34500: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2 -D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c -lrt -latomic -lexecinfo -lm >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
configure:34500: $? = 0
configure:34555: checking whether cairo's pthread feature could be enabled
configure:34557: result: no (can't link with -lpthread or -pthread)

[...]

In file included from cairo-mutex-type-private.h:45,

                 from cairo-scaled-font-private.h:45,
                 from cairoint.h:434,
                 from cairo-analysis-surface.c:37:
cairo-mutex-impl-private.h:262: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."
  262 | # 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."
      |   ^~~~~

To avoid this build failure, add a patch that overrides this broken mechanism

Fixes:
- http://autobuild.buildroot.org/results/5420beaf94855e47eeb08627e8e3c169dc00419a

---
 ...e.ac.pthread-respect-enable-pthreads.patch | 59 +++++++++++++++++++
 package/cairo/cairo.mk                        | 13 ++--
 2 files changed, 68 insertions(+), 4 deletions(-)
 create mode 100644 package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch
package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch new file +59 -0
new file mode 100644
index 0000000000..c350c596cf
@@ -0,0 +1,59 @@
+From 243fe7f3d51c23159e25f36adee7e953fee29f6c Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Thu, 23 Feb 2023 16:07:04 +0100
+Subject: [PATCH] build/configure.ac.pthread: respect --enable-pthreads
+
+Respect --enable-pthreads as pthreads detection fails if a warning is
+emitted resulting in the following build failure with some toolchains:
+
+onfigure:34189: checking for cairo's pthread feature
+configure:34300: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2  -D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  conftest.c -lrt -latomic -lexecinfo -lm -lpthread >&5
+/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack
+/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
+configure:34300: $? = 0
+configure:34419: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2  -pthread -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  conftest.c -lrt -latomic -lexecinfo -lm  >&5
+/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack
+/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
+configure:34419: $? = 0
+configure:34500: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2  -D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  conftest.c -lrt -latomic -lexecinfo -lm  >&5
+/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack
+/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
+configure:34500: $? = 0
+configure:34555: checking whether cairo's pthread feature could be enabled
+configure:34557: result: no (can't link with -lpthread or -pthread)
+
+[...]
+
+In file included from cairo-mutex-type-private.h:45,
+                 from cairo-scaled-font-private.h:45,
+                 from cairoint.h:434,
+                 from cairo-analysis-surface.c:37:
+cairo-mutex-impl-private.h:262: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."
+  262 | # 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:
+ - http://autobuild.buildroot.org/results/5420beaf94855e47eeb08627e8e3c169dc00419a
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ build/configure.ac.pthread | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/build/configure.ac.pthread b/build/configure.ac.pthread
+index 29c930da9..084445587 100644
+--- a/build/configure.ac.pthread
++++ b/build/configure.ac.pthread
+@@ -244,7 +244,8 @@ AC_DEFUN([CAIRO_CONFIGURE_PTHREAD],[dnl
+ 
+ 	dnl Make sure we scored some pthreads.
+ 	if test "x$enable_pthread" = "xyes" -a "x$have_pthread" != "xyes"; then
+-		AC_MSG_ERROR([pthread requested but not found])
++		AC_MSG_WARN([pthread requested but not found])
++		have_pthread=yes
+ 	fi
+ 
+ 	dnl Set the output variables for CAIRO_ENABLE.
+-- 
+2.39.1
+
package/cairo/cairo.mk +9 -4
index e8a704c7da..9034068403 100644
@@ -11,6 +11,8 @@ CAIRO_LICENSE_FILES = COPYING COPYING-LGPL-2.1 COPYING-MPL-1.1
 CAIRO_CPE_ID_VENDOR = cairographics
 CAIRO_SITE = http://cairographics.org/releases
 CAIRO_INSTALL_STAGING = YES
+# We're patching build/configure.ac.pthread
+CAIRO_AUTORECONF = YES
 
 # 0002-ft-Use-FT_Done_MM_Var-instead-of-free-when-available-in-cairo_ft_apply_variation.patch
 CAIRO_IGNORE_CVES += CVE-2018-19876
@@ -26,10 +28,6 @@ ifeq ($(BR2_m68k_cf),y)
 CAIRO_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -mxgot"
 endif
 
-ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)
-CAIRO_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -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)
@@ -70,6 +68,13 @@ HOST_CAIRO_DEPENDENCIES = \
 	host-pixman \
 	host-pkgconf
 
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+CAIRO_CONF_OPTS += --enable-pthread
+else
+CAIRO_CONF_OPTS += --disable-pthread
+CAIRO_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -DCAIRO_NO_MUTEX=1"
+endif
+
 # DirectFB svg support rely on Cairo and Cairo DirectFB support depends on
 # DirectFB. Break circular dependency by disabling DirectFB support in Cairo
 # (which is experimental)
Signature · 6 lines
2.39.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 40 lines · Fabrice Fontaine

pthreads detection fails if a warning is emitted resulting in the following build failure with some toolchains:

onfigure:34189: checking for cairo's pthread feature
configure:34300:
/home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc

(quoted diff) +0 -3
-o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2  -D_REENTRANT
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

conftest.c -lrt -latomic -lexecinfo -lm -lpthread >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld:
warning:
/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o:
missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld:
NOTE: This behaviour is deprecated and will be removed in a future version
of the linker
configure:34300: $? = 0
configure:34419:
/home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc

(quoted diff) +0 -3
-o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2  -pthread
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

conftest.c -lrt -latomic -lexecinfo -lm >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld:
warning:
/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o:
missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld:
NOTE: This behaviour is deprecated and will be removed in a future version
of the linker
configure:34419: $? = 0
configure:34500:
/home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc

(quoted diff) +0 -3
-o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2  -D_REENTRANT
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

conftest.c -lrt -latomic -lexecinfo -lm >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld:
warning:

Quoted 9 lines

/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o:
missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld:
NOTE: This behaviour is deprecated and will be removed in a future version
of the linker
configure:34500: $? = 0
configure:34555: checking whether cairo's pthread feature could be enabled
configure:34557: result: no (can't link with -lpthread or -pthread)

It should be noted that shellinabox has the same kind of issue, a warning is preventing the correct detection of ptsname_r:
http://autobuild.buildroot.org/results/287/2872b26253ecb5a1550268fcbcefe8fd974ff70d//shellinabox-2.20/config.log

So there is something fishy with those recent autobuilder failures.

Quoted 175 lines

[...]

In file included from cairo-mutex-type-private.h:45,

                 from cairo-scaled-font-private.h:45,
                 from cairoint.h:434,
                 from cairo-analysis-surface.c:37:

cairo-mutex-impl-private.h:262: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."
262 | # 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."

      |   ^~~~~

To avoid this build failure, add a patch that overrides this broken mechanism

Fixes:
-
http://autobuild.buildroot.org/results/5420beaf94855e47eeb08627e8e3c169dc00419a

---
 ...e.ac.pthread-respect-enable-pthreads.patch | 59 +++++++++++++++++++
 package/cairo/cairo.mk                        | 13 ++--
 2 files changed, 68 insertions(+), 4 deletions(-)
 create mode 100644

package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch

diff --git a/package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch b/package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch new file mode 100644
index 0000000000..c350c596cf
--- /dev/null
+++
b/package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch

package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch new file +10 -0
@@ -0,0 +1,59 @@
+From 243fe7f3d51c23159e25f36adee7e953fee29f6c Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Thu, 23 Feb 2023 16:07:04 +0100
+Subject: [PATCH] build/configure.ac.pthread: respect --enable-pthreads
+
+Respect --enable-pthreads as pthreads detection fails if a warning is
+emitted resulting in the following build failure with some toolchains:
+
+onfigure:34189: checking for cairo's pthread feature
+configure:34300:

/home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc

(quoted diff) +0 -3
-o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2  -D_REENTRANT
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

conftest.c -lrt -latomic -lexecinfo -lm -lpthread >&5 +/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld:
warning:
/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o:
missing .note.GNU-stack section implies executable stack +/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld:
NOTE: This behaviour is deprecated and will be removed in a future version
of the linker

(quoted diff) +2 -0
+configure:34300: $? = 0
+configure:34419:

/home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc

(quoted diff) +0 -3
-o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2  -pthread
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

conftest.c -lrt -latomic -lexecinfo -lm >&5 +/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld:
warning:
/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o:
missing .note.GNU-stack section implies executable stack +/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld:
NOTE: This behaviour is deprecated and will be removed in a future version
of the linker

(quoted diff) +2 -0
+configure:34419: $? = 0
+configure:34500:

/home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc

(quoted diff) +0 -3
-o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2  -D_REENTRANT
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

conftest.c -lrt -latomic -lexecinfo -lm >&5 +/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld:
warning:
/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o:
missing .note.GNU-stack section implies executable stack +/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld:
NOTE: This behaviour is deprecated and will be removed in a future version
of the linker

package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch new file +11 -0
+configure:34500: $? = 0
+configure:34555: checking whether cairo's pthread feature could be enabled
+configure:34557: result: no (can't link with -lpthread or -pthread)
+
+[...]
+
+In file included from cairo-mutex-type-private.h:45,
+                 from cairo-scaled-font-private.h:45,
+                 from cairoint.h:434,
+                 from cairo-analysis-surface.c:37:
+cairo-mutex-impl-private.h:262: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."
+ 262 | # 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."

package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch new file +4 -0
+      |   ^~~~~
+
+Fixes:
+ -

http://autobuild.buildroot.org/results/5420beaf94855e47eeb08627e8e3c169dc00419a

package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch new file +14 -0
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ build/configure.ac.pthread | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/build/configure.ac.pthread b/build/configure.ac.pthread
+index 29c930da9..084445587 100644
+--- a/build/configure.ac.pthread
++++ b/build/configure.ac.pthread
+@@ -244,7 +244,8 @@ AC_DEFUN([CAIRO_CONFIGURE_PTHREAD],[dnl
+
+       dnl Make sure we scored some pthreads.
+       if test "x$enable_pthread" = "xyes" -a "x$have_pthread" != "xyes";

then

+-              AC_MSG_ERROR([pthread requested but not found])
++              AC_MSG_WARN([pthread requested but not found])
++              have_pthread=yes
package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch new file +6 -0
+       fi
+
+       dnl Set the output variables for CAIRO_ENABLE.
+--
+2.39.1
+
package/cairo/cairo.mk +0 -0
index e8a704c7da..9034068403 100644
@@ -11,6 +11,8 @@ CAIRO_LICENSE_FILES = COPYING COPYING-LGPL-2.1

COPYING-MPL-1.1
CAIRO_CPE_ID_VENDOR = cairographics
CAIRO_SITE = http://cairographics.org/releases
CAIRO_INSTALL_STAGING = YES

package/cairo/cairo.mk +2 -0
+# We're patching build/configure.ac.pthread
+CAIRO_AUTORECONF = YES
 
 #

0002-ft-Use-FT_Done_MM_Var-instead-of-free-when-available-in-cairo_ft_apply_variation.patch
CAIRO_IGNORE_CVES += CVE-2018-19876

package/cairo/cairo.mk +7 -4
@@ -26,10 +28,6 @@ ifeq ($(BR2_m68k_cf),y)
 CAIRO_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -mxgot"
 endif
 
-ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)
-CAIRO_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -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)
@@ -70,6 +68,13 @@ HOST_CAIRO_DEPENDENCIES = \
        host-pixman \
        host-pkgconf
 
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+CAIRO_CONF_OPTS += --enable-pthread
+else
+CAIRO_CONF_OPTS += --disable-pthread
+CAIRO_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -DCAIRO_NO_MUTEX=1"
+endif
+
 # DirectFB svg support rely on Cairo and Cairo DirectFB support depends on
 # DirectFB. Break circular dependency by disabling DirectFB support in
Quoted 6 lines

Cairo
# (which is experimental)
--
2.39.1

Best Regards,

Fabrice

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Fabrice Fontaine

Hello,

Quoted 8 lines · On Thu, 23 Feb 2023 16:32:36 +0100 Fabrice Fontaine…

pthreads detection fails if a warning is emitted resulting in the following build failure with some toolchains:

onfigure:34189: checking for cairo's pthread feature
configure:34300: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2 -D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c -lrt -latomic -lexecinfo -lm -lpthread >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
configure:34300: $? = 0

So this returns success.

Quoted 4 lines

configure:34419: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2 -pthread -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c -lrt -latomic -lexecinfo -lm >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
configure:34419: $? = 0

This as well.

Quoted 4 lines

configure:34500: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2 -D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c -lrt -latomic -lexecinfo -lm >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
configure:34500: $? = 0

This as well.

Quoted 2 lines

configure:34555: checking whether cairo's pthread feature could be enabled configure:34557: result: no (can't link with -lpthread or -pthread)

So why does it conclude that thread support is not available?

package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch line 53

Quoted 5 lines
package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch new file +5 -0
+ 	dnl Make sure we scored some pthreads.
+ 	if test "x$enable_pthread" = "xyes" -a "x$have_pthread" != "xyes"; then
+-		AC_MSG_ERROR([pthread requested but not found])
++		AC_MSG_WARN([pthread requested but not found])
++		have_pthread=yes

This looks odd because you're basically "ignoring" the detection/validation of thread support.

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
Quoted 28 lines · Thomas Petazzoni via buildroot

Hello,

Quoted 8 lines · On Thu, 23 Feb 2023 16:32:36 +0100 Fabrice Fontaine…

pthreads detection fails if a warning is emitted resulting in the following build failure with some toolchains:

onfigure:34189: checking for cairo's pthread feature
configure:34300: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2 -D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c -lrt -latomic -lexecinfo -lm -lpthread >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
configure:34300: $? = 0

So this returns success.

Quoted 4 lines

configure:34419: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2 -pthread -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c -lrt -latomic -lexecinfo -lm >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
configure:34419: $? = 0

This as well.

Quoted 4 lines

configure:34500: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2 -D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c -lrt -latomic -lexecinfo -lm >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
configure:34500: $? = 0

Quoted 6 lines

This as well.

Quoted 2 lines

configure:34555: checking whether cairo's pthread feature could be enabled configure:34557: result: no (can't link with -lpthread or -pthread)

So why does it conclude that thread support is not available?

Because the configure script is stupid. Extract from the script:

Quoted 6 lines

ac_fn_c_try_compile ()
{
[...]
(eval "$ac_compile") 2>conftest.err
ac_status=$?
if test -s conftest.err; then

Quoted 8 lines

grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err

           ^^^^^^^^^^^^^^^^^^^^^^

This test will fail (conftest.err is not empty).

Quoted 10 lines
       } && test -s conftest.$ac_objext; then :

ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
[...]
} # ac_fn_c_try_compile

Quoted 8 lines

package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch line 53

Quoted 5 lines
package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch new file +5 -0
+ 	dnl Make sure we scored some pthreads.
+ 	if test "x$enable_pthread" = "xyes" -a "x$have_pthread" != "xyes"; then
+-		AC_MSG_ERROR([pthread requested but not found])
++		AC_MSG_WARN([pthread requested but not found])
++		have_pthread=yes

This looks odd because you're basically "ignoring" the detection/validation of thread support.

Yeah, the alternative is to patch host-autoconf to not do that stupid check of
conftest.err. Which is perhaps a better idea, because it solves things globally. But who knows, maybe some checks actually rely on this?

Or alternative, do something with binutils 2.39 (which is the one that
introduced the warning) to suppress the warning. It probably won't fix external toolchains then though.

Note that cairo upstream has moved to meson four years ago, we just haven't
updated cairo in a long time.

Regards,
Arnout

Quoted 4 lines

Best regards,

Thomas

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
In reply to Fabrice Fontaine
Quoted 35 lines · On Thu, 23 Feb 2023 16:32:36 +0100 Fabrice Fontaine…

pthreads detection fails if a warning is emitted resulting in the following build failure with some toolchains:

onfigure:34189: checking for cairo's pthread feature
configure:34300: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2 -D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c -lrt -latomic -lexecinfo -lm -lpthread >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
configure:34300: $? = 0
configure:34419: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2 -pthread -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c -lrt -latomic -lexecinfo -lm >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
configure:34419: $? = 0
configure:34500: /home/buildroot/autobuild/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -O0 -g2 -D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c -lrt -latomic -lexecinfo -lm >&5 /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: warning: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/crtend.o: missing .note.GNU-stack section implies executable stack /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/11.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
configure:34500: $? = 0
configure:34555: checking whether cairo's pthread feature could be enabled
configure:34557: result: no (can't link with -lpthread or -pthread)

[...]

In file included from cairo-mutex-type-private.h:45,

                 from cairo-scaled-font-private.h:45,
                 from cairoint.h:434,
                 from cairo-analysis-surface.c:37:
cairo-mutex-impl-private.h:262: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."
  262 | # 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."
      |   ^~~~~

To avoid this build failure, add a patch that overrides this broken mechanism

Fixes:
- http://autobuild.buildroot.org/results/5420beaf94855e47eeb08627e8e3c169dc00419a

Quoted 6 lines
---
 ...e.ac.pthread-respect-enable-pthreads.patch | 59 +++++++++++++++++++
 package/cairo/cairo.mk                        | 13 ++--
 2 files changed, 68 insertions(+), 4 deletions(-)
 create mode 100644 package/cairo/0005-build-configure.ac.pthread-respect-enable-pthreads.patch

This has been fixed directly in gcc by:

https://gitlab.com/buildroot.org/buildroot/-/commit/ab4f3fafaa839593b3efd9ea12c8ee5d9340cdeb

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot