Hello list
Has anyone tried compiling OpenLDAP with static SASL library? If so, what were the necessary changes you did (Makefile.in, configure, ...)?
Thanks in advance Zohar
On Oct 15, 2007, at 1:15 PM, Zohar Lev Shani wrote:
Has anyone tried compiling OpenLDAP with static SASL library? If so, what were the necessary changes you did (Makefile.in, configure, ...)?
That's what I do, but I don't need to modify any of these files, for Red Hat Linux or NetBSD. I build my own Cyrus SASL library, static only, and simply specify its location in the LDFLAGS environment variable when I invoke the OpenLDAP configure.
Having trouble with it?
Donn Cave, donn@u.washington.edu
Unfortunately, I do.
Below is what I did and the problems I encounter.
Some details: cyrus-sasl: cyrus-sasl-2.1.22 OpenLDAP: openldap-2.3.24 OS: Red Hat Enterprise Linux ES release 4 (Nahant Update 3)
I configured and compiled cyrus-sasl like this: $ ./configure --enable-static --prefix=/home/zohar/dev/cyrus-sasl-2.1.22 $ make
Then I configured and compiled OpenLDAP like this: $ ./configure --prefix=/home/zohar/dev/openldap-2.3.24 LDFLAGS=/home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a $ make depend $ make
I got the following error: cc -shared .libs/bind.o .libs/open.o .libs/result.o .libs/error.o .libs/compare.o .libs/search.o .libs/controls.o .libs/messages.o .libs/references.o .libs/extended.o .libs/cyrus.o .libs/modify.o .libs/add.o .libs/modrdn.o .libs/delete.o .libs/abandon.o .libs/sasl.o .libs/sbind.o .libs/kbind.o .libs/unbind.o .libs/cancel.o .libs/filter.o .libs/free.o .libs/sort.o .libs/passwd.o .libs/whoami.o .libs/getdn.o .libs/getentry.o .libs/getattr.o .libs/getvalues.o .libs/addentry.o .libs/request.o .libs/os-ip.o .libs/url.o .libs/sortctrl.o .libs/vlvctrl.o .libs/init.o .libs/options.o .libs/print.o .libs/string.o .libs/util-int.o .libs/schema.o .libs/charray.o .libs/tls.o .libs/os-local.o .libs/dnssrv.o .libs/utf-8.o .libs/utf-8-conv.o .libs/turn.o .libs/groupings.o .libs/txn.o .libs/ppolicy.o .libs/version.o -Wl,--rpath -Wl,/home/zohar/dev/openldap-2.3.24/libraries/liblber/.libs -Wl,--rpath -Wl,/home/zohar/dev/openldap-2.3.24/lib /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a ../../libraries/liblber/.libs/liblber.so -lresolv -lsasl2 -lssl -lcrypto -Wl,-soname -Wl,libldap-2.3.so.0 -o .libs/libldap-2.3.so.0.2.12 /usr/bin/ld: /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(client.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a: could not read symbols: Bad value
So I went back to cyrus-sasl and re-configured it like this: $ ./configure --enable-static=yes --prefix=/home/zohar/dev/cyrus-sasl-2.1.22 CFLAGS=-fPIC LDFLAGS=-L/usr/lib64 $ make
And recompile OpenLDAP. Now I got this error: cc -g -O2 -o ldapsearch ldapsearch.o common.o ldsversion.o /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a ../../libraries/liblutil/liblutil.a ../../libraries/libldap/.libs/libldap.a /home/zohar/dev/openldap-2.3.24/libraries/liblber/.libs/liblber.a ../../libraries/liblber/.libs/liblber.a -lsasl2 -lssl -lcrypto -lresolv ../../libraries/libldap/.libs/libldap.a(os-ip.o)(.text+0x69b): In function `ldap_connect_to_host': /home/zohar/dev/openldap-2.3.24/libraries/libldap/os-ip.c:194: warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead ../../libraries/libldap/.libs/libldap.a(os-ip.o)(.text+0x68f):/home/zohar/dev/openldap-2.3.24/libraries/libldap/os-ip.c:194: warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(db_berkeley.o)(.text+0xa5): In function `berkeleydb_open': : undefined reference to `db_create' /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(db_berkeley.o)(.text+0x131): In function `berkeleydb_open': : undefined reference to `db_strerror' /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(db_berkeley.o)(.text+0x1cc): In function `berkeleydb_close': : undefined reference to `db_strerror' /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(db_berkeley.o)(.text+0x43c): In function `_sasldb_getdata': : undefined reference to `db_strerror' /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(db_berkeley.o)(.text+0x704): In function `_sasldb_putdata': : undefined reference to `db_strerror' /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(db_berkeley.o)(.text+0x789): In function `_sasldb_putdata': : undefined reference to `db_strerror' collect2: ld returned 1 exit status
So I went back again re-configured and compiled OpenLDAP with the libraries defined in libsasl2.la: $ make distclean $ ./configure --prefix=/home/zohar/dev/openldap-2.3.24 LDFLAGS="/home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a -L/usr/lib64 -ldl -lresolv -lcrypto -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lcrypt -ldb-4.2 " $ make depend $ make
That part compiles, but when I checked the dependencies I saw this: $ ldd servers/slapd/slapd libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 (0x0000003ed6c00000) libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x0000003ed6800000) libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x0000003ed6a00000) libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000003ed6600000) libdb-4.2.so => /usr/lib64/tls/libdb-4.2.so (0x0000003ed4200000) libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x0000003ed3e00000) libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x0000003ed8800000) libdl.so.2 => /lib64/libdl.so.2 (0x0000003ed3300000) libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003ed4600000) libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003ed8c00000) libssl.so.4 => /lib64/libssl.so.4 (0x0000003ed8600000) libcrypto.so.4 => /lib64/libcrypto.so.4 (0x0000003ed6e00000) libc.so.6 => /lib64/tls/libc.so.6 (0x0000003ed3500000) /lib64/ld-linux-x86-64.so.2 (0x0000003ed3100000) libz.so.1 => /usr/lib64/libz.so.1 (0x0000003ed3a00000)
As you can see, the system sasl2 is linked to slapd, the problem arise from the configure script where it is defined there the -lsasl2 and -lsasl, that is why I asked about configure and Makefile.
Any help will be appreciated.
Zohar
On 10/16/07, Donn Cave donn@u.washington.edu wrote:
On Oct 15, 2007, at 1:15 PM, Zohar Lev Shani wrote:
Has anyone tried compiling OpenLDAP with static SASL library? If so, what were the necessary changes you did (Makefile.in, configure, ...)?
That's what I do, but I don't need to modify any of these files, for Red Hat Linux or NetBSD. I build my own Cyrus SASL library, static only, and simply specify its location in the LDFLAGS environment variable when I invoke the OpenLDAP configure.
Having trouble with it?
Donn Cave, donn@u.washington.edu
On Oct 18, 2007, at 3:57 AM, Zohar Lev Shani wrote:
[... re static sasl build ...]
Below is what I did and the problems I encounter.
Naturally, the gcc error message pointed you in the wrong direction, I think. To start with, I think you should `make clean' your cyrus-sasl and build it again the first way (without -fPIC.) If it's the same to you, I would add --disable-shared at this point, but at any rate, the installed lib/ directory should have only the .a static library, no .so.
Then use LDFLAGS to specify that location: -L/home/zohar/dev/cyrus- sasl-2.1.22/lib
If I'm right, the problem is that `configure' has added an -lsasl2, and the first library found to satisfy that is /usr/lib/libsasl2.so - gcc didn't notice that you specified another version of this library as a file path. Of course I haven't tested this theory.
When all else fails, I have in the past copied the gcc command at issue out of my make log, and edited out the configure problems. That isn't likely to be a satisfactory solution, but it can at least give you an idea of what magic combination will work, and then you can apply your efforts to making configure produce that configuration.
Donn Cave, donn@u.washington.edu
cyrus-sasl: cyrus-sasl-2.1.22 OpenLDAP: openldap-2.3.24 OS: Red Hat Enterprise Linux ES release 4 (Nahant Update 3)
I configured and compiled cyrus-sasl like this: $ ./configure --enable-static --prefix=/home/zohar/dev/cyrus- sasl-2.1.22 $ make
Then I configured and compiled OpenLDAP like this: $ ./configure --prefix=/home/zohar/dev/openldap-2.3.24 LDFLAGS=/home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a $ make depend $ make
I got the following error: cc -shared .libs/bind.o .libs/open.o .libs/result.o .libs/error.o .libs/compare.o .libs/search.o .libs/controls.o .libs/messages.o .libs/references.o .libs/extended.o .libs/cyrus.o .libs/modify.o .libs/add.o .libs/modrdn.o .libs/delete.o .libs/abandon.o .libs/sasl.o .libs/sbind.o .libs/kbind.o .libs/unbind.o .libs/cancel.o .libs/filter.o .libs/free.o .libs/sort.o .libs/passwd.o .libs/whoami.o .libs/getdn.o .libs/getentry.o .libs/getattr.o .libs/getvalues.o .libs/addentry.o .libs/request.o .libs/os-ip.o .libs/url.o .libs/sortctrl.o .libs/vlvctrl.o .libs/init.o .libs/options.o .libs/print.o .libs/string.o .libs/util-int.o .libs/schema.o .libs/charray.o .libs/tls.o .libs/os-local.o .libs/dnssrv.o .libs/utf-8.o .libs/utf-8-conv.o .libs/turn.o .libs/groupings.o .libs/txn.o .libs/ppolicy.o .libs/version.o -Wl,--rpath -Wl,/home/zohar/dev/openldap-2.3.24/libraries/liblber/.libs -Wl,--rpath -Wl,/home/zohar/dev/openldap-2.3.24/lib /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a ../../libraries/liblber/.libs/liblber.so -lresolv -lsasl2 -lssl -lcrypto -Wl,-soname -Wl,libldap-2.3.so.0 -o .libs/libldap-2.3.so.0.2.12 /usr/bin/ld: /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a (client.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a: could not read symbols: Bad value
So I went back to cyrus-sasl and re-configured it like this: $ ./configure --enable-static=yes --prefix=/home/zohar/dev/cyrus-sasl-2.1.22 CFLAGS=-fPIC LDFLAGS=-L/usr/lib64 $ make
And recompile OpenLDAP. Now I got this error: cc -g -O2 -o ldapsearch ldapsearch.o common.o ldsversion.o /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a ../../libraries/liblutil/liblutil.a ../../libraries/libldap/.libs/libldap.a /home/zohar/dev/openldap-2.3.24/libraries/liblber/.libs/liblber.a ../../libraries/liblber/.libs/liblber.a -lsasl2 -lssl -lcrypto -lresolv ../../libraries/libldap/.libs/libldap.a(os-ip.o)(.text+0x69b): In function `ldap_connect_to_host': /home/zohar/dev/openldap-2.3.24/libraries/libldap/os-ip.c:194: warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead ../../libraries/libldap/.libs/libldap.a(os-ip.o)(.text+0x68f):/home/ zohar/dev/openldap-2.3.24/libraries/libldap/os-ip.c:194: warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(db_berkeley.o) (.text+0xa5): In function `berkeleydb_open': : undefined reference to `db_create' /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(db_berkeley.o) (.text+0x131): In function `berkeleydb_open': : undefined reference to `db_strerror' /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(db_berkeley.o) (.text+0x1cc): In function `berkeleydb_close': : undefined reference to `db_strerror' /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(db_berkeley.o) (.text+0x43c): In function `_sasldb_getdata': : undefined reference to `db_strerror' /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(db_berkeley.o) (.text+0x704): In function `_sasldb_putdata': : undefined reference to `db_strerror' /home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a(db_berkeley.o) (.text+0x789): In function `_sasldb_putdata': : undefined reference to `db_strerror' collect2: ld returned 1 exit status
So I went back again re-configured and compiled OpenLDAP with the libraries defined in libsasl2.la: $ make distclean $ ./configure --prefix=/home/zohar/dev/openldap-2.3.24 LDFLAGS="/home/zohar/dev/cyrus-sasl-2.1.22/lib/libsasl2.a -L/usr/lib64 -ldl -lresolv -lcrypto -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lcrypt -ldb-4.2 " $ make depend $ make
That part compiles, but when I checked the dependencies I saw this: $ ldd servers/slapd/slapd libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 (0x0000003ed6c00000) libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x0000003ed6800000) libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x0000003ed6a00000) libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000003ed6600000) libdb-4.2.so => /usr/lib64/tls/libdb-4.2.so (0x0000003ed4200000) libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x0000003ed3e00000) libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x0000003ed8800000) libdl.so.2 => /lib64/libdl.so.2 (0x0000003ed3300000) libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003ed4600000) libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003ed8c00000) libssl.so.4 => /lib64/libssl.so.4 (0x0000003ed8600000) libcrypto.so.4 => /lib64/libcrypto.so.4 (0x0000003ed6e00000) libc.so.6 => /lib64/tls/libc.so.6 (0x0000003ed3500000) /lib64/ld-linux-x86-64.so.2 (0x0000003ed3100000) libz.so.1 => /usr/lib64/libz.so.1 (0x0000003ed3a00000)
As you can see, the system sasl2 is linked to slapd, the problem arise from the configure script where it is defined there the -lsasl2 and -lsasl, that is why I asked about configure and Makefile.
Any help will be appreciated.
Zohar
On 10/16/07, Donn Cave donn@u.washington.edu wrote:
On Oct 15, 2007, at 1:15 PM, Zohar Lev Shani wrote:
Has anyone tried compiling OpenLDAP with static SASL library? If so, what were the necessary changes you did (Makefile.in, configure, ...)?
That's what I do, but I don't need to modify any of these files, for Red Hat Linux or NetBSD. I build my own Cyrus SASL library, static only, and simply specify its location in the LDFLAGS environment variable when I invoke the OpenLDAP configure.
Having trouble with it?
Donn Cave, donn@u.washington.edu
Donn Cave, donn@u.washington.edu
openldap-software@openldap.org