Question

Could you help me figure out what's missing here?
I'm trying to compile a c++ program using the OTL 4 library but I'm getting an error.

Environment Details:

  • I've installed Oracle DB XE 10G on an Ubuntu 11.04 VM.
  • SQL*Plus and the server itself is running as it should be.

Compile code is:

g++ -o <output>.exe <source>.cpp -I$ORACLE_HOME/rdbms/public -I$ORACLE_HOME/rdbms/demo -L$ORACLE_HOME/lib -lclntsh

Error is:

/usr/bin/ld: warning: libnnz10.so, needed by /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so, not found (try using -rpath or -rpath-link)  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `nztSetAppDefaultLocation'  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `nzos_DisableClientAuthentication'  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `nzos_Create_Ctx'  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `_intel_fast_memcpy'  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `nzgbllsm_location_shared_memory'  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `__intel_cpu_indicator'  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `nzosSCCS_SetCRLCacheSize'  
...a whole lot more undefined references...   
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `nzssGSL_GetSecretLength'  
collect2: ld returned 1 exit status  

Notes on the error:
When I checked, the libnnz10.so exists when I looked into my $ORACLE_HOME/lib directory.

Was it helpful?

Solution

I was able to figure it out this afternoon and I got it to compile now.
So in case someone stumbles with the same problem as I did here's the solution:

Add the $ORACLE_HOME/lib path to your $LD_LIBRARY_PATH

For convenience you may also add this to your .bashrc profile like so:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH  

That's it!

PS:
I was trying to post this earlier but it seemed that I still lack in rep points
in order to answer my own question sooner than 8 hours.

OTHER TIPS

Not sure why it would be necessary, but you could try just adding -lnnz10 to your command.

(Google shows people using that extra argument, but couldn't quickly see anyone explaining why; other options seem to be to set LD_LIBRARY path or add $ORACLE_HOME/lib to /etc/ld.so.conf...)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top