Hello. I have a problem with compiling openldap suite on AIX. I feel it has certainly trivial solution, but I'm not so skilled in C development, so I can't solve it.
After compiling, all binaries have hardcoded library dependencies:
# cd /home/horakmar/src/openldap-2.3.4 # servers/slapd/slapd Could not load program servers/slapd/slapd: Dependent module ../../libraries/libldap_r/.libs/libldap_r.a(libldap_r-2.3.so.0) could not be loaded. Could not load module ../../libraries/libldap_r/.libs/libldap_r.a(libldap_r- 2.3.so.0). System error: No such file or directory
# ldd servers/slapd/slapd servers/slapd/slapd needs: /lib/libs.a(shr.o) /lib/libpthreads.a(shr_comm.o) /lib/libpthreads.a(shr_xpg5.o) /home/qshorakmar/src/openldap-2.3.4 /libraries/liblber/.libs/liblber.a(liblber-2.3.so.0) Cannot find ../../libraries/libldap_r/.libs/libldap_r.a(libldap_r-2.3.so.0) /opt/freeware/lib/libcrypto.a(libcrypto.so.0.9.7) /unix /lib/libcrypt.a(shr.o) /lib/libc.a(shr.o) /lib/libc.a(shr_64.o) /lib/libcrypt.a(shr_64.o)
# dump -H servers/slapd/slapd
servers/slapd/slapd:
***Loader Section*** Loader Header Information VERSION# #SYMtableENT #RELOCent LENidSTR 0x00000001 0x00000183 0x0000226b 0x00000119
#IMPfilID OFFidSTR LENstrTBL OFFstrTBL 0x00000007 0x0001c16c 0x0000130c 0x0001c285
***Import File Strings*** INDEX PATH BASE MEMBER
0 /opt/freware/lib:/usr/lib:/lib 1 libs.a shr.o
2 libpthreads.a shr_comm.o
3 libpthreads.a shr_xpg5.o
4 /home/qshorakmar/src/openldap-2.3.4/libraries/liblber/.libs liblber.a liblber-2.3.so.0 5 ../../libraries/libldap_r/.libs libldap_r.a libldap_r- 2.3.so.0 6 libcrypto.a libcrypto.so.0.9.7
Client tools (e.g. ldapsearch) suffer from the same problem. When I install libraries into desired directories, program works. But dependency on directory in which it's being run is very unpleasant. Please do you have any idea, how to get rid of those: ../../libraries/libldap_r/.libs libldap_r.a /home/qshorakmar/src/openldap-2.3.4/libraries/liblber/.libs liblber.a ?
Thank you in advance, Martin Horak
Martin Horak horak.martin@gmail.com writes:
I have a problem with compiling openldap suite on AIX. I feel it has certainly trivial solution, but I'm not so skilled in C development, so I can't solve it.
After compiling, all binaries have hardcoded library dependencies:
This is why libtool in some platforms relinks the binaries after installation. Did you run make install?
On 6/8/07, Russ Allbery rra@stanford.edu wrote:
Martin Horak horak.martin@gmail.com writes:
I have a problem with compiling openldap suite on AIX. I feel it has certainly trivial solution, but I'm not so skilled in C development, so
I
can't solve it.
After compiling, all binaries have hardcoded library dependencies:
This is why libtool in some platforms relinks the binaries after installation. Did you run make install?
-- Russ Allbery (rra@stanford.edu) http://www.eyrie.org/~eagle/
Yes, I did, it does some relinking, but installed binaries have the same dependencies though. :-(
Martin
Hello Martin!
Thank you for your e-mail!
I have experienced exactly this -- both with an ancient version (2.1.30) as well as with a more recent (2.3) version. I've seen it in RPM versions of OpenLDAP for AIX available on the net, too.
I tried the latest ltmain.sh (libtool "core" file) -- needed for some obscure backup attempts of non-existent archive files during relinking. I tried changing "hardcode_into_libs=yes" to "hardcode_into_libs=no" in libtool (after running ./configure). But to no avail. The binaries still insist on the exact relative location of the libraries, just as you described it.
By the way -- the hardcode_into_libs trick is usually very neat -- and does the trick of getting rid of absolute paths inside libraries. I use it every now and then (for instance, in RPM .spec files). But it does not affect the binaries, as is the problem in this case...
I ended up running ./configure --enable-dynamic ; make depend ; make for getting the shared libraries, then a separate ./configure --enable-shared=no --enable-static ; make LTFLAGS=-static depend ; make LTFLAGS=-static for getting hold of static binaries. Static with regard to the OpenLDAP libraries -- other libraries such as OpenSSL might turn into dependencies for the binaries if they are not available statically on the system -- but with the hardcode_into_libs=no trick at least not with any paths embedded...
As I package my OpenLDAP (2.1.30 for certain SSL reasons) using RPM nowadays, I have applied all the needed work-arounds to the RPM .spec file so that a nice package (with shared libs and the static binaries) is the result. Nice to have until someone finally solves those problems which seem to have been around for years now. :-)
If you would like a copy of the source RPM (so that you can easily create an RPM version on your machine), just let me know.
Best regards, Björn
On Fri, 8 Jun 2007, Martin Horak wrote:
Date: Fri, 8 Jun 2007 14:20:30 +0200 From: Martin Horak horak.martin@gmail.com To: openldap-software@openldap.org Subject: Hardcoded libraries in Openldap binaries on AIX
Hello. I have a problem with compiling openldap suite on AIX. I feel it has certainly trivial solution, but I'm not so skilled in C development, so I can't solve it.
After compiling, all binaries have hardcoded library dependencies:
# cd /home/horakmar/src/openldap-2.3.4 # servers/slapd/slapd Could not load program servers/slapd/slapd: Dependent module ../../libraries/libldap_r/.libs/libldap_r.a(libldap_r-2.3.so.0) could not be loaded. Could not load module ../../libraries/libldap_r/.libs/libldap_r.a(libldap_r- 2.3.so.0). System error: No such file or directory
# ldd servers/slapd/slapd servers/slapd/slapd needs: /lib/libs.a(shr.o) /lib/libpthreads.a(shr_comm.o) /lib/libpthreads.a(shr_xpg5.o) /home/qshorakmar/src/openldap-2.3.4 /libraries/liblber/.libs/liblber.a(liblber-2.3.so.0) Cannot find ../../libraries/libldap_r/.libs/libldap_r.a(libldap_r-2.3.so.0) /opt/freeware/lib/libcrypto.a(libcrypto.so.0.9.7) /unix /lib/libcrypt.a(shr.o) /lib/libc.a(shr.o) /lib/libc.a(shr_64.o) /lib/libcrypt.a(shr_64.o)
# dump -H servers/slapd/slapd
servers/slapd/slapd:
***Loader Section*** Loader Header Information
VERSION# #SYMtableENT #RELOCent LENidSTR 0x00000001 0x00000183 0x0000226b 0x00000119
#IMPfilID OFFidSTR LENstrTBL OFFstrTBL 0x00000007 0x0001c16c 0x0000130c 0x0001c285
***Import File Strings***
INDEX PATH BASE MEMBER
0 /opt/freware/lib:/usr/lib:/lib 1 libs.a shr.o
2 libpthreads.a shr_comm.o
3 libpthreads.a shr_xpg5.o
4 /home/qshorakmar/src/openldap-2.3.4/libraries/liblber/.libs liblber.a liblber-2.3.so.0 5 ../../libraries/libldap_r/.libs libldap_r.a libldap_r- 2.3.so.0 6 libcrypto.a libcrypto.so.0.9.7
Client tools (e.g. ldapsearch) suffer from the same problem. When I install libraries into desired directories, program works. But dependency on directory in which it's being run is very unpleasant. Please do you have any idea, how to get rid of those: ../../libraries/libldap_r/.libs libldap_r.a /home/qshorakmar/src/openldap-2.3.4/libraries/liblber/.libs liblber.a ?
Thank you in advance, Martin Horak
openldap-software@openldap.org