1

I have a C application that was built on RHEL release 5.8 (Tikanga). We have a new box that is running RHEL release 6.3 (Santiago). Whenever I try to run the application on the new machine, I receive the following output:

myApp: error while loading shared libraries: libldap-2.3.so.0: cannot open shared object file: No such file or directory

I am gathering that this is because I compiled my application on a different RHEL release than what I am attempting to run it on, as RHEL release 6.3 (Santiago) has a different version of the LDAP libraries I need in /lib64, namely, libldap-2.4.so.2. Without simply installing the old libldap-2.3.so.0 library (there are administrative reasons why this is not possible), is there a way to abstract library dependence so that I can compile code that is not dependent on a specific version of a library?

Vistian
  • 29
  • 3
  • Can you just rebuild it on the target platform? – kmort Dec 27 '13 at 17:04
  • It would be ideal to not have to compile the application more than once. Rebuilding on the target platform is the option we will go with if abstraction is not possible. – Vistian Dec 27 '13 at 17:26
  • Can you link to libldap.so and let the links in /usr/lib work it out? – mpez0 Dec 27 '13 at 20:48
  • 1
    How are you actually linking? Can you show us the command? – kmort Dec 27 '13 at 20:52
  • See [this answer](http://stackoverflow.com/a/20804529/841108) to a very similar question.... – Basile Starynkevitch Dec 28 '13 at 03:52
  • I don't think LDAP libraries are part of the core components of the Red Hat distribution which means they're not guaranteed to be binary compatible between major releases (they are compatible between minor releases ie. 5.1 and 5.8 for example). See https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Developer_Guide/lib.compatibility.html . –  Dec 30 '13 at 06:21
  • gcc -DLINUX -m64 -ggdb -dD -DDEBUG -D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -I/home/mc751696/code/SWAK/backend/header/ -I/opt/oracle/product/11.2.0.2-64//rdbms/public -I/opt/oracle/product/11.2.0.2-64//plsql/public -I/opt/oracle/product/11.2.0.2-64//network/public -I/usr/include/libxml2 -I/usr/share/gsoap -L/opt/oracle/product/11.2.0.2-64/lib -L/opt/oracle/product/11.2.0.2-64/rdbms/lib/ myApp.c -o myApp libngsComn.a -locci -lclntsh -lpthread -lldap -llber -lssl -lcrypto -lz -lrt -lxml2 – Vistian Dec 30 '13 at 18:17
  • I believe that I am accurately linking libldap.so in my compilation command above. – Vistian Dec 30 '13 at 18:20
  • Do you have a static version of the LDAP library? If so, you can just link statically and see if it works. It might not because there might be things in `libc` that change that the LDAP libary is expecting... but give it a try. http://stackoverflow.com/questions/725472/static-link-of-shared-library-function-in-gcc and http://stackoverflow.com/questions/847179/multiple-glibc-libraries-on-a-single-host/851229#851229 – kmort Dec 30 '13 at 21:04

0 Answers0