I have an executable and a .so file which use different versions of the Oracle Instant Client libraries. They are compatible with different versions and I have to use both.
The executable is using version 11 - it is linked to a .so file which is using "libclntsh.so.11.1" -- the version is hard coded and I can't modify the .so file.
ldd Executable_name
linux-vdso.so.1 => (0x00007ffffe7fe000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fbb33e80000)
libdx_t.so => not found
libudr_t.so => not found
libnsl.so.1 => /lib64/libnsl.so.1 (0x00007fbb33c66000)
**libclntsh.so.11.1** => not found
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fbb3395e000)
libm.so.6 => /lib64/libm.so.6 (0x00007fbb3365c000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fbb33445000)
libc.so.6 => /lib64/libc.so.6 (0x00007fbb33084000)
/lib64/ld-linux-x86-64.so.2 (0x00007fbb340aa000)
The .so file is using version 12 and it is using dlopen
.
ldd libOracleClient.so
linux-vdso.so.1 => (0x00007fff705a2000)
libclntsh.so.12.1 => not found
libocci.so.12.1 => not found
libnnz12.so => not found
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fe8d6d49000)
libm.so.6 => /lib64/libm.so.6 (0x00007fe8d6a46000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fe8d6830000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe8d646f000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe8d72e4000)
I have successfully compiled my code. I have created two directories for both the versions of Oracle Instant Client, and added both to LD_LIBRARY_PATH.
The problem is that in the two Oracle Instant Client 11 and 12 directories there are some .so files which having the same name.
Oracle Instant Client 11 libraries :-
libclntsh.so libclntsh.so.11.1 libnnz11.so libocci.so libocci.so.11.1 libociei.so libocijdbc11.so ojdbc5.jar ojdbc6.jar xstreams.jar
Oracle Instant Client 12 libraries :-
libclntshcore.so.12.1 libclntsh.so.12.1 libmql1.so libocci.so.12.1 libociei.so libons.so ojdbc6.jar xstreams.jar libclntsh.so libipc1.so libnnz12.so libocci.so_bkp libocijdbc12.so liboramysql12.so ojdbc7.jar
Libraries having same name: libociei.so etc.
Now, the situation is a .so file from the Oracle 12 client internally calls a .so file which is present in the Oracle 11 client directory. Which .so would be used, because in LD_LIBRARY_PATH both are present?