1

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

Josh Barton
  • 148
  • 11

1 Answers1

1

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.

Community
  • 1
  • 1
Josh Barton
  • 148
  • 11
  • Do not expect to be able to link that library into programs compiled with GCC and have it work. See https://community.oracle.com/thread/1994953?start=0&tstart=0 – Andrew Henle Feb 04 '16 at 11:20
  • It has been working just fine so far, my server has been able to correctly connect to an oracle database where it was previously unable to do so. Is there any cause for concern. My first attempt I actually did attempt to use sun's cc but the makefile ignored it and linked correctly, if there is good reason I would definitely be willing to go back and recompile with Sun CC. – Josh Barton Feb 04 '16 at 17:37