libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sun Studio linking issues in Solaris 9


From: David Halik
Subject: Sun Studio linking issues in Solaris 9
Date: Sun, 11 Nov 2007 13:03:21 -0500
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)


I bounced this off of the courier mailing list, since that was what I was building at the time, but one of the developers named Sam asked that I go here since his Makefile.in has libtool generated parts that are what I'm having an issue with. Anyways, to the meat of the problem....

I ran into this when building courier-authlib 0.60.2 in Solaris 9 with Sun Studio, the Makefile attempts to link with the required libraries before knowing where to go for them. See below:

/bin/bash ./libtool --tag=CC --mode=link cc -I.. -I./.. -module -rpath /usr/local/lib/courier-authlib -export-symbols-regex 'courier_auth.*_init' -lldap -llber -lresolv -lsocket -lnsl -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/local/lib -R/usr/local/lib -L/usr/local/lib/courier-authlib -R/usr/local/lib/courier-authlib -o libauthldap.la authldap.lo preauthldap.lo authldaplib.lo libcourierauthcommon.la
generating symbol list for `libauthldap.la'
/usr/ccs/bin/nm -p .libs/authldap.o .libs/preauthldap.o .libs/authldaplib.o | sed -n -e 's/^.*[ ]\([BDRT][BDRT]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | /usr/local/bin/sed 's/.* //' | sort | uniq > .libs/libauthldap.exp /usr/local/gnu/bin/grep -E -e "courier_auth.*_init" ".libs/libauthldap.exp" > ".libs/libauthldap.expT"
mv -f ".libs/libauthldap.expT" ".libs/libauthldap.exp"
echo "{ global:" > .libs/libauthldap.so.0.0.0.exp
cat .libs/libauthldap.exp | /usr/local/bin/sed -e "s/\(.*\)/\1;/" >> .libs/libauthldap.so.0.0.0.exp
echo "local: *; };" >> .libs/libauthldap.so.0.0.0.exp
/usr/ccs/bin/ld -G -M .libs/libauthldap.so.0.0.0.exp -h libauthldap.so.0 -o .libs/libauthldap.so.0.0.0 .libs/authldap.o .libs/preauthldap.o .libs/authldaplib.o -R/usr/local/src/rpm-packages/BUILD/courier-authlib-0.60.2/.libs -R/usr/local/lib/courier-authlib -R/usr/local/ssl/lib -R/usr/local/lib -L/usr/local/src/rpm-packages/BUILD/courier-authlib-0.60.2/.libs -lldap -llber -lresolv -lsocket -lnsl -L/usr/local/ssl/lib -L/usr/local/lib -L/usr/local/lib/courier-authlib ./.libs/libcourierauthcommon.so -lc
ld: fatal: library -llber: not found
ld: fatal: File processing errors. No output written to .libs/libauthldap.so.0.0.0

The problem lies in the fact that the autoresolved -l dependencies are put down before the user added -L/-R paths are specified. Initially this is given to the libtool argument and then passed automatically with libtool on to Sun LD, which chokes. Adding $LDFLAGS before the automatically generated libs solves the problem. I've attached a patch below that switches the order, but there might be a "more correct" way to fix this with libtool dependency generation. All the patch does is switch the order libtool receives the arguments, and of course spits them back out to LD. As long as LDFLAGS is added after the internal linkage there will never be a match since it doesn't yet know where to look. I was assuming this is a courier problem, but the developer Sam says this Makefile.in configuration generated through libtool.

diff -ruN courier-authlib-0.60.2/Makefile.in courier-authlib-0.60.2.new/Makefile.in
--- courier-authlib-0.60.2/Makefile.in  2007-10-13 20:20:08.000000000 -0400
+++ courier-authlib-0.60.2.new/Makefile.in 2007-11-08 15:34:48.537428000 -0500
@@ -92,7 +92,7 @@
libauthldap_la_OBJECTS = $(am_libauthldap_la_OBJECTS)
libauthldap_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
      $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-       $(libauthldap_la_LDFLAGS) $(LDFLAGS) -o $@
+       $(LDFLAGS) $(libauthldap_la_LDFLAGS) -o $@
am_libauthmysql_la_OBJECTS = authmysql.lo preauthmysql.lo \
      authmysqllib.lo
libauthmysql_la_OBJECTS = $(am_libauthmysql_la_OBJECTS)


Thanks,
-Dave

--
================================
David Halik
Student Programmer
OSS/NBCS - OIT Rutgers
address@hidden
================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]