]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
libgcrypt: fix compile error for t-thread-local
authorHiago De Franco <hiago.franco@toradex.com>
Mon, 2 Jun 2025 20:55:46 +0000 (17:55 -0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 5 Jun 2025 10:01:23 +0000 (11:01 +0100)
Currently the libgcrypt-native build is failing with the following
error:

| ld: t_thread_local-t-thread-local.o: in function `main':
| t-thread-local.c:(.text.startup+0x187): undefined reference to `pthread_create'
| ld: t-thread-local.c:(.text.startup+0x1d0): undefined reference to `pthread_join'

Backport the fix from upstream and add "-lpthread" to
"t_thread_local_CFLAGS" to make the compilation successfull, similar to
what 0004-tests-Makefile.am-fix-undefined-reference-to-pthread.patch
does.

Signed-off-by: Hiago De Franco <hiago.franco@toradex.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-support/libgcrypt/files/0001-tests-Fix-link-errors-for-t-thread-local.patch [new file with mode: 0644]
meta/recipes-support/libgcrypt/libgcrypt_1.11.1.bb

diff --git a/meta/recipes-support/libgcrypt/files/0001-tests-Fix-link-errors-for-t-thread-local.patch b/meta/recipes-support/libgcrypt/files/0001-tests-Fix-link-errors-for-t-thread-local.patch
new file mode 100644 (file)
index 0000000..5ebc383
--- /dev/null
@@ -0,0 +1,34 @@
+From 746dc1c3837546c1085102e546a83da8d1c773e1 Mon Sep 17 00:00:00 2001
+From: Collin Funk <collin.funk1@gmail.com>
+Date: Thu, 1 May 2025 22:20:58 -0700
+Subject: [PATCH] tests: Fix link errors for t-thread-local.
+
+On platforms where pthread_create is not in libc t-thread-local fails to
+link.  Issue found on NetBSD 10.0.
+* tests/Makefile.am (t_thread_local_LDADD): Add $(standard_ldadd),
+$(GPG_ERROR_MT_LIBS), and @LDADD_FOR_TESTS_KLUDGE@.
+(t_thread_local_CFLAGS): Add $(GPG_ERROR_MT_CFLAGS).
+
+--
+
+Upstream-Status: Backport [793eda7b258a562757b51c96044b103b638f1a63]
+GnuPG-bug-id: 7634
+Signed-off-by: Collin Funk <collin.funk1@gmail.com>
+Signed-off-by: Hiago De Franco <hiago.franco@toradex.com>
+---
+ tests/Makefile.am | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 9a9e1c2c264a..b80f266f97c2 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -94,6 +94,8 @@ t_secmem_LDADD = $(standard_ldadd) @LDADD_FOR_TESTS_KLUDGE@
+ testapi_LDADD = $(standard_ldadd) @LDADD_FOR_TESTS_KLUDGE@
+ t_lock_LDADD = $(standard_ldadd) $(GPG_ERROR_MT_LIBS) @LDADD_FOR_TESTS_KLUDGE@
+ t_lock_CFLAGS = $(GPG_ERROR_MT_CFLAGS) -lpthread
++t_thread_local_LDADD = $(standard_ldadd) $(GPG_ERROR_MT_LIBS) @LDADD_FOR_TESTS_KLUDGE@
++t_thread_local_CFLAGS = $(GPG_ERROR_MT_CFLAGS) -lpthread
+ testdrv_LDADD = $(LDADD_FOR_TESTS_KLUDGE)
+ # Build a version of the test driver for the build platform.
index e51a20e5bfb1025560e62c67e77164018f6ad04e..5574e8c821ef0d29246c0adbf9b37f32904338a6 100644 (file)
@@ -21,6 +21,7 @@ UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html"
 SRC_URI = "${GNUPG_MIRROR}/libgcrypt/libgcrypt-${PV}.tar.bz2 \
            file://0001-libgcrypt-fix-m4-file-for-oe-core.patch \
            file://0004-tests-Makefile.am-fix-undefined-reference-to-pthread.patch \
+           file://0001-tests-Fix-link-errors-for-t-thread-local.patch \
            file://no-native-gpg-error.patch \
            file://no-bench-slope.patch \
            file://run-ptest \