Mailing List Archive

[PATCH] tests: Fix undefined reference to 'pthread_create'
* configure.ac (HAVE_PTHREAD): Expose as AM_CONDITIONAL for use in
Makefile.am
* tests/Makefile.am: Link against pthread for tests that use it

--

Compilation on CentOS 8 Stream failed without this.

Signed-off-by: Clemens Lang <cllang@redhat.com>
---
configure.ac | 1 +
tests/Makefile.am | 5 +++++
2 files changed, 6 insertions(+)

diff --git a/configure.ac b/configure.ac
index a9350c9c..9034194a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -812,6 +812,7 @@ if test "$have_w32_system" != yes; then
AC_DEFINE(HAVE_PTHREAD, 1 ,[Define if we have pthread.])
fi
fi
+AM_CONDITIONAL(HAVE_PTHREAD, test "$have_w32_system" != yes && test "$have_pthread" = yes)


# Solaris needs -lsocket and -lnsl. Unisys system includes
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e6953fd3..a4ad267f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -98,6 +98,11 @@ t_kdf_LDADD = $(standard_ldadd) $(GPG_ERROR_MT_LIBS) @LDADD_FOR_TESTS_KLUDGE@
t_kdf_CFLAGS = $(GPG_ERROR_MT_CFLAGS)
endif

+if HAVE_PTHREAD
+t_lock_LDADD += -lpthread
+t_kdf_LDADD += -lpthread
+endif
+
# xcheck uses our new testdrv instead of the automake test runner.
.PHONY: xcheck xtestsuite
xcheck: testdrv$(EXEEXT)
--
2.34.1


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@lists.gnupg.org
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: [PATCH] tests: Fix undefined reference to 'pthread_create' [ In reply to ]
Hello,

Thank you for your report.

Clemens Lang wrote:
> * configure.ac (HAVE_PTHREAD): Expose as AM_CONDITIONAL for use in
> Makefile.am
> * tests/Makefile.am: Link against pthread for tests that use it
>
> --
>
> Compilation on CentOS 8 Stream failed without this.

Could you please show us the build log (on that OS) for libgpg-error?

When -lpthread is needed, GPG_ERROR_MT_LIBS should have that.
(Or else, it may also fail in other places like compiling GnuPG.)

For the build, libgcrypt depends on gpg-error.pc of libgpg-error, and
uses GPG_ERROR_MT_CFLAGS and GPG_ERROR_MT_LIBS. It is generated by the
build of libgpg-error using Gnulib's M4 script m4/threadlib.m4.

If something goes wrong, we need to fix libgpg-error.
--

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@lists.gnupg.org
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: [PATCH] tests: Fix undefined reference to 'pthread_create' [ In reply to ]
Hello,

> On 14. Feb 2022, at 06:57, NIIBE Yutaka <gniibe@fsij.org> wrote:
>
> Could you please show us the build log (on that OS) for libgpg-error?

Please see https://gitlab.com/redhat-crypto/libgcrypt/libgcrypt-mirror/-/jobs/2067433059.


> When -lpthread is needed, GPG_ERROR_MT_LIBS should have that.
> (Or else, it may also fail in other places like compiling GnuPG.)
>
> For the build, libgcrypt depends on gpg-error.pc of libgpg-error, and
> uses GPG_ERROR_MT_CFLAGS and GPG_ERROR_MT_LIBS. It is generated by the
> build of libgpg-error using Gnulib's M4 script m4/threadlib.m4.
>
> If something goes wrong, we need to fix libgpg-error.

I think the problem here is that this used libgpg-error 1.31, which does not ship a pkgconfig file.

What is the minimum version of libgpg-error required by libgcrypt?


--
Clemens Lang
RHEL Crypto Team
Red Hat




_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@lists.gnupg.org
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: [PATCH] tests: Fix undefined reference to 'pthread_create' [ In reply to ]
Hello,

I think I located the cause. It is a bug in m4/gpg-error.m4 (from
libgpg-error). I'm going to push a fix to master (of libgcrypt). Then,
I'll fix libgpg-error.

Clemens Lang wrote:
> I think the problem here is that this used libgpg-error 1.31, which does not ship a pkgconfig file.
>
> What is the minimum version of libgpg-error required by libgcrypt?

It is 1.27. It doesn't provide gpg-error.pc, but it supports
gpg-error-config script.

(Unified config script gpgrt-config and gpg-error.pc is since version
1.33.)

libgpg-error 1.27 has old version of gpgrt-config, which is not unified
version. This older gpgrt-config confuses the m4 script of
m4/gpg-error.m4.
--

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@lists.gnupg.org
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel