Oracle\'s instructions specify setting LD_LIBRARY_PATH. This makes my application dependent on random users\' configuration and is very troublesome to set up.
How can I
Oracle's instructions regarding setting the LD_LIBRARY_PATH are suboptimal.
On ELF platforms like Linux or Solaris there is really no need to require setting the LD_LIBRARY_PATH because the correct library search path (a.k.a. runpath) can be written into the binary, at build-time, relative to the location of the binary. Thus, with such binaries, the runtime linker is always able to find the packaged libraries, even if the installed subtree is copied around.
Unfortunately, Oracle doesn't create the Linux 'Instant Client' binaries like that. But, it is possible to fix them with patchelf.
For example:
patchelf --set-rpath '$ORIGIN/..' /path/to/instantclient_11_2/sdk/proc
patchelf --set-rpath '$ORIGIN' /path/to/instantclient_11_2/sqlplus
patchelf --set-rpath '$ORIGIN' /path/to/instantclient_11_2/libclntsh.so.11.1
After those changes the runtime linker is able to find all needed libraries without any LD_LIBRARY_PATH environment variable.
On Solaris there is elfedit - but IIRC at least some Oracle DB packages for Solaris already come with a sufficient runpath. One can verify that via e.g. elfdump /path/to/sqlplus | grep PATH.
For more details on elfedit and other good alternatives to LD_LIBRARY_PATH (that don't involve changing the binary itself) see also my article LD_LIBRARY_PATH considered harmful.