post-patch blues with db3, db4, db41

Matthias Andree ma at dt.e-technik.uni-dortmund.de
Tue Jun 8 08:16:09 GMT 2004


On Sat, 05 Jun 2004, Sean McNeil wrote:

> There are post-patch targets for these ports that are causing issues
> with the libraries built.  The target:
> 
> post-patch:
>         @${REINPLACE_CMD} -Ee \
>                 's|-l?pthread|${PTHREAD_LIBS}|g' ${WRKSRC}/${CONFIGURE_SCRIPT}
> 
> causes the library to be linked with libpthread.so.  This is a

And how would this cause the link with libpthread if the original
BDB configure script didn't request that in the first place?

I've tried ldd and readelf -d and objdump -p and see no reference to
pthread whatsoever in spite of libdb41_cxx.so.1 using pthread functions,
I'd expect a NEEDED tag. SONAME is there however.

The original script might however need to replace -pthread with -lc_r or
-lpthread on FreeBSD 5.

> dependency that we do not want.  It will in turn cause issues with
> nss_ldap and db doesn't use any threading.

No threads but mutexes. The CXX variant also defines some local weak
thread-related symbols.

> It is thread safe, but that
> doesn't mean it should be linked with pthread.

What FreeBSD version and machine are you running on? I only have freebsd
4.10 release and 5-CURRENT on x86 (i386).

Berkeley DB appears to use POSIX mutexes on the non-x86 machines, and
GCC assembly mutextes on x86 machines (and in the db41 port for amd64
machines, too, see http://www.freebsd.org/cgi/query-pr.cgi?pr=64886 ).

BerkeleyDB uses autoconf and some tests to figure if it should use some
native implementation, POSIX mutexes (in -lpthread) or UI mutexes (for
instance on Solaris, -lthread).

> I took out that target from my build of db41 and all is well for me. 
> With it in, nss_ldap ends up causing all sorts of bad things to happen

What sorts?

> because it uses db41 (via openldap and sasl) and it in turn pulls in
> pthread when it shouldn't.

Please show details.

> Could this target be removed from the ports mentioned?

It will break the compile for some of the versions, and I recently fixed
mutex related bugs for one of the newer db ports (db42 IIRC) for amd64,
by forcing x86/gcc-assembly mutexes for amd64.

-- 
Matthias Andree

Encrypted mail welcome: my GnuPG key ID is 0x052E7D95


More information about the freebsd-ports mailing list