I have been trying to compile the oracle driver for naviserver (nsoracle). It compiles just fine but when I start up the server it complains during module load of nsoracle.so.
Error: modload: /usr/local/ns/bin/nsoracle.so: couldn't load file "/usr/local/ns/bin/nsoracle.so": ld.so.1: nsd: fatal: relocation error: file /usr/local/ns/bin/nsoracle.so: symbol OCIServerDetach: referenced symbol not found
The library/linking line in the Makefile looks like this:
MODLIBS += -R$(ORACLE_HOME}:${ORACLE_HOME}/lib:$NSHOME/bin:$NSHOME/lib -L$(ORACLE_HOME):$(ORACLE_HOME)/lib:$(NSHOME)/lib -L$(ORACLE_HOME):$(ORACLE_HOME)/lib:$(NSHOME)/lib -locci -lclntsh -lnnz11
ORACLE_HOME contains libocci.so.11.1 libclntsh.11.1 libociei.so libnnz11.so lib
As it turns out oracle compiles it's instant client libraries using SunStudio using libraries not present in illumos(I run OmniOS) or GNU gcc distributions.
libCrun.so and libCstd.so are required to properly link instantclient (specifically libocci.so.11.1) against nsoracle or other projects.
You can use a source like the pkg install command for omnios
pkg install sunstudio12.1
Also check here for other options for obtaining Sun Studio
The gmake command I finally used that worked for me:
gmake MODLIBS+="-L/opt/sunstudio12.1/lib/amd64 -L$ORACLE_HOME/lib -L/usr/local/ns/lib -R/opt/sunstudio12.1/lib/amd64 -R$ORACLE_HOME/lib -R/usr/local/ns/lib -lCrun -lCstd -locci -lclntsh -lociei -lnnz11 -lnsthread -lnsdb -lnsd -ltcl8.5"
You would change /opt/sunstudio12.1/lib/amd64 to /opt/sunstudio12.1/lib if performing a 32 bit compile.