opendkim-testkey needs pthreads

From: Daniel Black <daniel.subs_at_internode.on.net>
Date: Thu, 20 Mar 2014 13:00:54 +1100

fedora-19 compile failure:


make[3]: Entering directory `/home/dan/software_projects/opendkim/opendkim'
/bin/sh ../libtool --tag=CC --mode=link gcc -std=gnu99 -g -O2
       -o opendkim-testkey opendkim_testkey-config.o
opendkim_testkey-opendkim-crypto.o opendkim_testkey-opendkim-db.o
opendkim_testkey-opendkim-dns.o opendkim_testkey-opendkim-lua.o
opendkim_testkey-opendkim-testkey.o opendkim_testkey-util.o
../libopendkim/libopendkim.la -lssl -lcrypto -lresolv -lbsd
libtool: link: gcc -std=gnu99 -g -O2 -o .libs/opendkim-testkey
opendkim_testkey-config.o opendkim_testkey-opendkim-crypto.o
opendkim_testkey-opendkim-db.o opendkim_testkey-opendkim-dns.o
opendkim_testkey-opendkim-lua.o opendkim_testkey-opendkim-testkey.o
opendkim_testkey-util.o ../libopendkim/.libs/libopendkim.so -lssl
-lcrypto -lresolv -lbsd -Wl,-rpath -Wl,/usr/local/lib
/usr/bin/ld: opendkim_testkey-opendkim-crypto.o: undefined reference to
symbol 'pthread_setspecific_at__at_GLIBC_2.2.5'
/usr/bin/ld: note: 'pthread_setspecific_at__at_GLIBC_2.2.5' is defined in DSO
/lib64/libpthread.so.0 so try adding it to the linker command line
/lib64/libpthread.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[3]: *** [opendkim-testkey] Error 1
make[3]: Leaving directory `/home/dan/software_projects/opendkim/opendkim'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/dan/software_projects/opendkim/opendkim'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dan/software_projects/opendkim'


As opendkim-testkey is making direct use of pthreads by linking to
opendkim-crypo.c the pthread linking is unconditional on wheither
libopendkim needs it.

As such the following patch works:

diff --git a/opendkim/Makefile.am b/opendkim/Makefile.am
index 40615a7..3a76c74 100644
--- a/opendkim/Makefile.am
+++ b/opendkim/Makefile.am
_at_@ -106,15 +106,11 @@ endif
 endif

 opendkim_testkey_SOURCES = config.c config.h opendkim-crypto.c
opendkim-crypto.h opendkim-db.c opendkim-db.h opendkim-dns.c opendkim-dns.h
+opendkim_testkey_CC = $(PTHREAD_CC)
 opendkim_testkey_CPPFLAGS = -I$(srcdir)/../libopendkim
$(LIBCRYPTO_CPPFLAGS)
-opendkim_testkey_CFLAGS = $(LIBCRYPTO_CFLAGS) $(COV_CFLAGS)
+opendkim_testkey_CFLAGS = $(LIBCRYPTO_CFLAGS) $(COV_CFLAGS)
$(PTHREAD_CFLAGS)
 opendkim_testkey_LDFLAGS = $(LIBCRYPTO_LIBDIRS) $(COV_LDFLAGS)
-opendkim_testkey_LDADD = ../libopendkim/libopendkim.la
$(LIBCRYPTO_LIBS) $(LIBRESOLV) $(COV_LIBADD)
-if LIBOPENDKIM_NEEDS_PTHREADS
-opendkim_testkey_CC = $(PTHREAD_CC)
-opendkim_testkey_CFLAGS += $(PTHREAD_CFLAGS)
-opendkim_testkey_LDADD += $(PTHREAD_LIBS)
-endif
+opendkim_testkey_LDADD = ../libopendkim/libopendkim.la
$(LIBCRYPTO_LIBS) $(LIBRESOLV) $(COV_LIBADD) $(PTHREAD_LIBS)
 if LUA
 opendkim_testkey_CPPFLAGS += $(LIBLUA_INCDIRS) $(LIBMILTER_INCDIRS)
 opendkim_testkey_LDFLAGS += $(LIBLUA_LIBDIRS)
Received on Thu Mar 20 2014 - 02:01:48 PST

This archive was generated by hypermail 2.3.0 : Thu Mar 20 2014 - 02:09:02 PST