[Top][All Lists]

[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 (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 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 authldap.lo preauthldap.lo authldaplib.lo
generating symbol list for `'
/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/
cat .libs/libauthldap.exp | /usr/local/bin/sed -e "s/\(.*\)/\1;/" >> .libs/
echo "local: *; };" >> .libs/
/usr/ccs/bin/ld -G -M .libs/ -h -o .libs/ .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/ -lc
ld: fatal: library -llber: not found
ld: fatal: File processing errors. No output written to .libs/

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 configuration generated through libtool.

diff -ruN courier-authlib-0.60.2/
--- courier-authlib-0.60.2/  2007-10-13 20:20:08.000000000 -0400
+++ 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 \
libauthmysql_la_OBJECTS = $(am_libauthmysql_la_OBJECTS)


David Halik
Student Programmer
OSS/NBCS - OIT Rutgers

reply via email to

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