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.