Mailing List Archive

gpgme: [PATCH] tests: Fix pthread linking error.
Second revision since I forgot to add ax_pthread.m4.

--
Ben Kibbey
Re: gpgme: [PATCH] tests: Fix pthread linking error. [ In reply to ]
Ben Kibbey <bjk@luxsci.net> wrote:
> Fixes linking issue for Android on arm64 and possibly others.

Thank you for the report.

I think that this is an issue of libc/libpthread usage.

In fact, newer GNU C library has similar issue, as pthreads
implementation is now integraged into libc (no need for -lpthread).

In GnuPG libraries, we handled this issue in libgpg-error.

Because GPGME uses libgpg-error, I change tests/Makefile.am to fix.

Please test if it works for your case.

--

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8950e965..e4346576 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -37,8 +37,9 @@ noinst_PROGRAMS = $(TESTS) run-keylist run-export run-import run-sign \
run-verify run-encrypt run-identify run-decrypt run-genkey \
run-keysign run-tofu run-swdb run-threaded

-run_threaded_LDADD = ../src/libgpgme.la -lpthread @GPG_ERROR_LIBS@ \
- @LDADD_FOR_TESTS_KLUDGE@
+run_threaded_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_MT_CFLAGS@
+run_threaded_LDADD = ../src/libgpgme.la \
+ @GPG_ERROR_MT_LIBS@ @LDADD_FOR_TESTS_KLUDGE@

if RUN_GPG_TESTS
gpgtests = gpg json

_______________________________________________
Gnupg-devel mailing list
Gnupg-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Re: gpgme: [PATCH] tests: Fix pthread linking error. [ In reply to ]
On Thu, Nov 11, 2021 at 10:26:54AM +0900, NIIBE Yutaka wrote:
> Ben Kibbey <bjk@luxsci.net> wrote:
> > Fixes linking issue for Android on arm64 and possibly others.
>
> Thank you for the report.
>
> I think that this is an issue of libc/libpthread usage.
>
> In fact, newer GNU C library has similar issue, as pthreads
> implementation is now integraged into libc (no need for -lpthread).
>
> In GnuPG libraries, we handled this issue in libgpg-error.

That's good to know.

> Because GPGME uses libgpg-error, I change tests/Makefile.am to fix.
>
> Please test if it works for your case.

Thanks. The build is good now except the forgotten tests/gpg tests:

diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am
index bab9dd9a..00613b48 100644
--- a/tests/gpg/Makefile.am
+++ b/tests/gpg/Makefile.am
@@ -68,10 +68,18 @@ BUILT_SOURCES = gpg.conf gpg-agent.conf pubring-stamp \
AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@
AM_LDFLAGS = -no-install
LDADD = ../../src/libgpgme.la @LDADD_FOR_TESTS_KLUDGE@
-t_thread1_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@
-t_thread_keylist_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@
-t_thread_keylist_verify_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@
-t_cancel_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@
+t_thread1_CPPFLAGS = @GPG_ERROR_MT_CFLAGS@
+t_thread1_LDADD = ../../src/libgpgme.la @GPG_ERROR_MT_LIBS@ \
+ @LDADD_FOR_TESTS_KLUDGE@
+t_thread_keylist_CPPFLAGS = @GPG_ERROR_MT_CFLAGS@
+t_thread_keylist_LDADD = ../../src/libgpgme.la @GPG_ERROR_MT_LIBS@ \
+ @LDADD_FOR_TESTS_KLUDGE@
+t_thread_keylist_verify_CPPFLAGS = @GPG_ERROR_MT_CFLAGS@
+t_thread_keylist_verify_LDADD = ../../src/libgpgme.la @GPG_ERROR_MT_LIBS@ \
+ @LDADD_FOR_TESTS_KLUDGE@
+t_cancel_CPPFLAGS = @GPG_ERROR_MT_CFLAGS@
+t_cancel_LDADD = ../../src/libgpgme.la @GPG_ERROR_MT_LIBS@ \
+ @LDADD_FOR_TESTS_KLUDGE@

# We don't run t-genkey and t-cancel in the test suite, because it
# takes too long

--
Ben Kibbey