This guide covers some tweaks that are needed to install oracle client (full client, not instant) to Ubuntu. Oracle does not support Ubuntu and installation does not work out of the box, however it is still possible to do it with a couple workarounds.
Note: this is not about the instant client. For instant client, read other guides, typically involving conversion of rpm packages into deb.
- Run the installer. It will warn you that the OS is not supported. You can ignore this warning and continue.
- The installer will give you an error. Once it does, go to $ORACLE_HOME/lib/ and create new
compat_resolv.cfile like this:
#define _GNU_SOURCE
#include <resolv.h>
#include <arpa/nameser.h>
int __res_nsearch(res_state statp, const char *dname, int class, int type,
unsigned char *answer, int anslen) {
return res_nsearch(statp, dname, class, type, answer, anslen);
}
int __dn_expand(const unsigned char *msg, const unsigned char *eom,
const unsigned char *src, char *dest, int space) {
return dn_expand(msg, eom, src, dest, space);
}
int __dn_skipname(const unsigned char *comp_dn, const unsigned char *eom) {
return dn_skipname(comp_dn, eom);
}- Compile the file with
gcc -fPIC -shared -o libresolv_compat.so compat_resolv.c -lresolv - Open
$ORACLE_HOME/bin/orald, find the following lines at the start of the code:
if [ -z "$BASH_VERSION" -o -n "$ORALD_USE_GCC" ] ; then
exec gcc "$@"
exit 1
fiAnd add -L/usr/lib/x86_64-linux-gnu -fno-PIE -no-pie -Wl,--copy-dt-needed-entries -Wl,--no-as-needed -lresolv_compat between exec and "$@":
if [ -z "$BASH_VERSION" -o -n "$ORALD_USE_GCC" ] ; then
exec gcc -L/usr/lib/x86_64-linux-gnu -fno-PIE -no-pie -Wl,--copy-dt-needed-entries -Wl,--no-as-needed -lresolv_compat "$@"
exit 1
fi- Save the file, then go back to the installer and hit "Repeat", now it should complete successfully.
Oracle’s build scripts assume the RHEL/Oracle Linux toolchain: libpthread_nonshared.a lives in /usr/lib64, gcc defaults to non-PIE links, and glibc still exports the private resolver symbols (__res_nsearch, __dn_expand, __dn_skipname). Ubuntu’s layout differs: the pthread archive is under x86_64-linux-gnu, gcc enables PIE by default, and glibc ≥2.34 hides those resolver internals, so Oracle’s precompiled objects can’t link out of the box.
To make the link succeed on Ubuntu we:
- Added -L/usr/lib/x86_64-linux-gnu so ld could see libpthread_nonshared.a.
- Disabled PIE hardening (-fno-PIE -no-pie) to satisfy Oracle’s non-PIC static libraries.
- Forced dependent libs to stay on the command line despite Ubuntu’s --as-needed default (-Wl,--no-as-needed, -Wl,--copy-dt-needed-entries).
- Implemented a small resolver shim defining
__res_nsearch,__dn_expand, and__dn_skipname, compiled it, and linked the resulting object solibclntsh.socould resolve those now-hidden glibc symbols.