When configuring samba-3.0.0 with kerberos, ldap and ads support on Solaris8,
the ldap libraries (libldap and liblber) gets added in the wrong order.
LDAP_LIBS gets the value "-llber -lldap" instead of "-lldap -llber". libldap
is dependent upon liblber and should be the first (leftmost) library of the two
on the commandline.
It seems that AC_CHECK_LIB_EXT (in aclocal.m4) does not prepend libraries, but
rather adds them at the end. The AC_CHECK_LIB standard autoconf macro prepends
libraries - shouldn't AC_CHECK_LIB_EXT do the same or have I missed something?
Here is a patch that fixes the problem.
diff -urN samba-3.0.0.orig/source/aclocal.m4 samba-3.0.0/source/aclocal.m4
--- samba-3.0.0.orig/source/aclocal.m4 2003-08-28 23:42:42.000000000 +0200
+++ samba-3.0.0/source/aclocal.m4 2003-09-25 16:09:20.000000000 +0200
@@ -179,7 +179,7 @@
- $2="$$2 -l$1"
+ $2="-l$1 $$2"
Metze, what do you think of this?
I think "-llber -lldap" is the right order.
Because libldap uses liblber...
and it was like that before.
Please donot apply this patch.
when this is a problem, I'll think about it a bit more.
From the manual page for gcc (version 3.2.1)
It makes a difference where in the command you write
this option; the linker searches and processes libraries
and object files in the order they are specified. Thus,
foo.o -lz bar.o searches library z after file foo.o but
before bar.o. If bar.o refers to functions in z, those
functions may not be loaded.
In other words, given the linker option "-llber -lldap", because libldap.a
references liblber.a, the link will fail, according to the last line cut from
the gcc manual page.
Anyway: On Solaris 8 with OpenLDAP compiled with static libraries, the Samba
3.0.0 source does not link without this patch. Also I would like to know why
AC_CHECK_LIB_EXT should add libraries in the reverse order of AC_CHECK_LIB.
My gut feeling here is that the new macro should apply libraries to the list in
the same order as the old one.
Yes, and that is what this patch is all about. It also makes the ordering
of libraries consistant with the way gcc (and other compiler I would imagine)
ok, apply it... I hope it will work with all kerberos lib...
but 3.0.0 is out and if this break something we can fix that latter.
I will apply the patch and see if it can last a few rounds in the build farm.
No problems seen on the build farm or user reports so I'm closing this bug as fixed.
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.