OK, this one is a bit tricky. It seems to emerge fine, however result of ldd -r /usr/lib/libldap_r.so is: undefined symbol: pthread_create (/usr/lib/libldap_r.so) undefined symbol: pthread_setconcurrency (/usr/lib/libldap_r.so) undefined symbol: pthread_kill (/usr/lib/libldap_r.so) undefined symbol: pthread_attr_setstacksize (/usr/lib/libldap_r.so) undefined symbol: pthread_mutex_trylock (/usr/lib/libldap_r.so) undefined symbol: pthread_join (/usr/lib/libldap_r.so) undefined symbol: pthread_getconcurrency (/usr/lib/libldap_r.so) As openldap does not use automake, I've yet to figure out where it should be fixed. BTW, is there some easy way to check all of the system libraries for this (undefined symbol) issue ?
Hrm whole system is as-needed here and no such bug, though looks like some dependent lib doesn't get the dep to pthread right
Libraries are allowed to have undefined symbols and they commonly have them undefined. -lpthread should be used when linking of executables against libldap_r.so. There is no bug in OpenLDAP.
Did some some digging and I'm thinking the whole situation is FUBAR. libldap_r.so seems to be easy to fix, however there are a lot more issues. The worst I found till now is following: backend_connection_init is a symbol of slapd, however libslapi.so uses this symbol and is a dependancy of slapd, so we get a circular dependency. And I think comment #2 is wrong. pthread should be linked to libldap_r.so, if only for the effect of having it mentioned in libldap_r.la.
I was wrong the first time - it's NOT an --as-needed bug, it's a "developer's choice" bug. Now that I've done some googling, it seems that this is something that was noticed by both debian and fedora and fixed there (if only for pthread symbols) in the same way I fixed it for myself. Below I attach the patch that fixes undefined pthread symbols that I use (as far as I know debian and fedora use almost the same).
Created attachment 134495 [details, diff] fixes some pthread symbols (all for libldap_r.so)
One more thing, I don't know if I'm actually using openldap, I noticed this problem while building wine. It was failing to detect ldap because of those unresolved symbols ( it was checking for libldap_r.so using standard configure lib check).
OK, as some of the as needed bugs had been given more attention lately, I'm raising this issue again. While some of my claims here are invalid, the pthread part is not. If pthread is not linked into libldap_r.so, it will cause problems with any further linking and WILL cause the standard configure check to fail. Why does this part get rejected, while other distros accepted this as a bug ?
I'm withdrawing the second and third sentence in Comment #2.
Fixed in 2.3.43-r1 and 2.4.11-r1.
*** Bug 275739 has been marked as a duplicate of this bug. ***