[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: Solaris 10 and openldap - help needed.



Maybe. Is the symbol actually in your libldap.a? e.g.

$ nm /usr/local/lib/libldap.a | grep _dn2ad_
[118]   |       134|      21|OBJT |GLOB |0    |5      |$XBGxIqAd5tbFHwZ.ldap_dn2ad_canonical.__func__
[117]   |      3136|     124|FUNC |GLOB |0    |2      |ldap_dn2ad_canonical

If you're seeing good results with --enable-shared=yes, maybe try different config lines that build both the static and shared. I don't immedately see how that would matter, but autoconf might be turning off some part you need. Bottom line, I can get your sample program to compile (I don't have static libsasl2.a, it'd be fairly meaningless), as below.
I'd also be wary that your .a file is a real archive and not some magical libtool wrapper, and that it didn't get borked by a program like GNU strip (which, historically at least, has been very dangerous on Solaris).


$ /opt/SUNWspro/bin/cc -I/usr/local/include -{L,R}/usr/local/lib foo.c /usr/local/lib/lib{ldap,lber}.a /usr/local/ssl/lib/libssl.a /usr/local/ssl/lib/libcrypto.a -lsasl2 -lnsl -lsocket -lresolv -o foo
"foo.c", line 4: warning: old-style declaration or incorrect type for: main
$ ldd foo # no libldap.so
libsasl2.so.2 => /usr/local/lib/libsasl2.so.2
libnsl.so.1 => /usr/lib/libnsl.so.1
libsocket.so.1 => /usr/lib/libsocket.so.1
libresolv.so.2 => /usr/lib/libresolv.so.2
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
libmp.so.2 => /usr/lib/libmp.so.2
/usr/platform/SUNW,Sun-Fire-V210/lib/libc_psr.so.1


$ gcc -R/usr/local/lib foo.c /usr/local/lib/lib{ldap,lber}.a /usr/local/ssl/lib/libssl.a /usr/local/ssl/lib/libcrypto.a -lsasl2 -lnsl -lsocket -lresolv -o foo
$ ldd foo
libsasl2.so.2 => /usr/local/lib/libsasl2.so.2
libnsl.so.1 => /usr/lib/libnsl.so.1
libsocket.so.1 => /usr/lib/libsocket.so.1
libresolv.so.2 => /usr/lib/libresolv.so.2
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
libmp.so.2 => /usr/lib/libmp.so.2
/usr/platform/SUNW,Sun-Fire-V210/lib/libc_psr.so.1



On Thu, 7 Dec 2006, Robert Bannocks wrote:

I *am* trying to use static libraries.  Appols for the confusion over
the -L and -l.  I am now trying things more directly:

$ /usr/sfw/bin/gcc -I/usr/local/opt/openldap/openldap-2.3.27/include
/usr/local/opt/openldap/openldap-2.3.27/lib/libldap.a
/usr/local/opt/openldap/openldap-2.3.27/lib/liblber.a  ldaptest.c
Undefined                       first referenced
symbol                             in file
ldap_dn2ad_canonical                /var/tmp//ccUaa9gP.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

Doing this with 2.3.30 is no help either:

$ /usr/sfw/bin/gcc -I/usr/local/opt/openldap/openldap-2.3.30/include
/usr/local/opt/openldap/openldap-2.3.30/lib/libldap.a
/usr/local/opt/openldap/openldap-2.3.30/lib/liblber.a  ldaptest.c
Undefined                       first referenced
symbol                             in file
ldap_dn2ad_canonical                /var/tmp//cc2EWpQ9.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

Why is this symbol not found with the static libraries?
With the dynamic ones things go fine:

$ /usr/sfw/bin/gcc -I/usr/local/opt/openldap/openldap-2.3.27/include
/usr/local/opt/openldap/openldap-2.3.27/lib/libldap.so
/usr/local/opt/openldap/openldap-2.3.27/lib/liblber.so  ldaptest.c
$ ldd a.out
       libldap-2.3.so.0 =>      (file not found)
       liblber-2.3.so.0 =>      (file not found)
       libc.so.1 =>     /lib/libc.so.1
       libm.so.2 =>     /lib/libm.so.2

I believe that this is an openldap issue not a Solaris one.

Regards,

Rob


-----Original Message-----
From: Aaron Richton [mailto:richton@nbcs.rutgers.edu]
Sent: 06 December 2006 22:46
To: Robert Bannocks
Cc: openldap-software@openldap.org; Quanah Gibson-Mount
Subject: Re: Solaris 10 and openldap - help needed.

With the command line
/usr/sfw/bin/gcc -I/usr/local/opt//openldap/openldap-2.3.27/include
-L/usr/local/opt/openldap/openldap-2.3.27/lib/libldap.a
-L/usr/local/opt/openldap-2.3.27/lib/liblber.a ldaptest.c

Your paths on your -L lines don't match.

For that matter, I think you're confusing big L with little l.
Typically
you'd, assuming those paths are right,

gcc -I/usr/local/opt/openldap/openldap-2.3.27/include -
L/usr/local/opt/openldap/openldap-2.3.27/lib -lldap -llber ldaptest.c

big L is search path, little l is library name (-lfoo =>
libfoo.{a,so})


Looks like you're trying to use .a static libraries. If you use .so
shared
libraries, you'll probably want an RPATH. You can Google for that or
ask
the Solaris community for help.