title: OCCI linkage: Undefined symbols
body: <p>I have been working in a solution with Oracle database access and C/C++.
  I'm using OCCI but we are in trouble to link in Solaris 11.
  Solution works "like a charm" in Linux (OpenSUSE and Mint), but doesn't in Solaris 11.</p>
  
  <p>Here environment informations:</p>
  
  <ol>
  <li>I downloaded instantclient_11_2 (sun sparc version) and unpacked it in a Solaris folder</li>
  <li><p>I created symbolic links to libclntsh.so.11.1 called libclntsh.so, and for libocci.so.11.1 called libocci.so. Bellow a "ls -l" showing files:</p>
  
  <ul>
  <li>-rwxrwxr-x   1 f780333  desenv     23792 Aug 22  2013 adrci</li>
  <li>-rw-rw-r--   1 f780333  desenv       414 Aug 22  2013 BASIC_README</li>
  <li>-rwxrwxr-x   1 f780333  desenv     41464 Aug 22  2013 genezi</li>
  <li>lrwxrwxrwx   1 f780333  desenv        17 Apr  5 14:21 <strong>libclntsh.so -> libclntsh.so.11.1</strong></li>
  <li>-rwxrwxr-x   1 f780333  desenv   50268448 Aug 22  2013 <strong>libclntsh.so.11.1</strong></li>
  <li>-r-xr-xr-x   1 f780333  desenv   8653320 Aug 22  2013 libnnz11.so</li>
  <li>lrwxrwxrwx   1 f780333  desenv        15 Apr  5 14:22 <strong>libocci.so ->   libocci.so.11.1</strong></li>
  <li>-rwxrwxr-x   1 f780333  desenv   1545008 Aug 22  2013 <strong>libocci.so.11.1</strong></li>
  <li>-rwxrwxr-x   1 f780333  desenv   118735824 Aug 22  2013 libociei.so</li>
  <li>-r-xr-xr-x   1 f780333  desenv    121800 Aug 22  2013 libocijdbc11.so</li>
  <li>-r--r--r--   1 f780333  desenv   2091135 Aug 22  2013 ojdbc5.jar</li>
  <li>-r--r--r--   1 f780333  desenv   2739616 Aug 22  2013 ojdbc6.jar</li>
  <li>drwxrwxr-x   4 f780333  desenv         7 Aug 22  2013 sdk</li>
  <li>-rwxrwxr-x   1 f780333  desenv    177680 Aug 22  2013 uidrvci</li>
  <li>-rw-rw-r--   1 f780333  desenv     66779 Aug 22  2013 xstreams.jar</li>
  </ul></li>
  <li><p>I created another folder that contens symbolic links to important needs libraries from Solaris.I am linking project with options -m64 -lCstd -lrt -lsocket. m64 to force 64bits, it was necessary. Cstd, rt and socket due the fact that these libraries are used indirectly.</p></li>
  <li><p>I am using Netbeans and compile remotely in Solaris 11</p></li>
  </ol>
  
  <p>Compilation works fine.
  Compilation command patterns is showed bellow:</p>
  
  <p>g++ -m64   -c -g -I/home/f780333/paineldaemon/lib/indra_clib/include -I/home/f780333/paineldaemon/lib/instantclient_11_2/sdk/include -std=c++98 -MMD -MP -MF "build/Debug/GNU-Solaris-Sparc/main.o.d" -o build/Debug/GNU-Solaris-Sparc/main.o main.cpp</p>
  
  <p><strong>/home/f780333/paineldaemon/lib/indra_clib/include</strong> is a folder with a static library used by program. This library is mine and is necessary for project.</p>
  
  <p><strong>/home/f780333/paineldaemon/lib/instantclient_11_2/sdk/include</strong> is a folder from instantclient sdk, that includes *.h from OCCI.</p>
  
  <p>But when linkage process starts, all head pain starts too:</p>
  
  <p>(first) Linkage command:</p>
  
  <pre><code>g++ -o &lt;all files here&gt; -L/home/f780333/paineldaemon/lib/sun -L/home/f780333/paineldaemon/lib -L/home/f780333/paineldaemon/lib/instantclient_11_2 -R'/home/f780333/paineldaemon/lib/sun' -R'/home/f780333/paineldaemon/lib' -R'/home/f780333/paineldaemon/lib/instantclient_11_2' -lclntsh -locci /home/f780333/paineldaemon/lib/libindra_clib.a -m64 -lCstd -lrt -lsocket
  </code></pre>
  
  <p>And finally the linker <strong>ERROR MESSAGE</strong>:</p>
  
  <pre><code>Undefined           first referenced
    symbol                in file
  oracle::occi::Date::~Date()         build/Debug/GNU-Solaris-Sparc/MessageBuilderATM.o
  oracle::occi::Date::Date()          build/Debug/GNU-Solaris-Sparc/MessageBuilderATM.o
  oracle::occi::Number::operator=(oracle::occi::Number const&amp;) build/Debug/GNU-Solaris-Sparc/MessageBuilderATM.o
  oracle::occi::Number::Number(double) build/Debug/GNU-Solaris-Sparc/MessageBuilder.o
  oracle::occi::Number::Number(long)  build/Debug/GNU-Solaris-Sparc/MessageBuilder.o
  oracle::occi::Number::Number()      build/Debug/GNU-Solaris-Sparc/MessageBuilderATM.o
  oracle::occi::Number::~Number()     build/Debug/GNU-Solaris-Sparc/MessageBuilderATM.o
  oracle::occi::Environment::createEnvironment(oracle::occi::Environment::Mode, void*, void* (*)(void*, unsigned long), void* (*)(void*, void*, unsigned long), void (*)(void*, void*)) build/Debug/GNU-Solaris-Sparc/DatabaseOperation.o
  oracle::occi::Date::operator=(oracle::occi::Date const&amp;) build/Debug/GNU-Solaris-Sparc/MessageBuilderATM.o
  oracle::occi::Environment::terminateEnvironment(oracle::occi::Environment*) build/Debug/GNU-Solaris-Sparc/DatabaseOperation.o
  oracle::occi::Date::Date(oracle::occi::Environment const*, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) build/Debug/GNU-Solaris-Sparc/MessageBuilder.o
  ld: fatal: symbol referencing errors
  collect2: error: ld returned 1 exit status
  gmake[2]: *** [dist/Debug/GNU-Solaris-Sparc/paineldaemon] Error 1
  gmake[2]: Leaving directory `/home/f780333/.netbeans/remote/172.16.160.172/sylvia-Linux-x86_64/home/eduardo/Indra/Cartoes/repo/paineldaemon'
  gmake[1]: *** [.build-conf] Error 2
  gmake[1]: Leaving directory `/home/f780333/.netbeans/remote/172.16.160.172/sylvia-Linux-x86_64/home/eduardo/Indra/Cartoes/repo/paineldaemon'
  gmake: *** [.build-impl] Error 2
  </code></pre>
  
  <p>I am crazy with this problem, any help will be much apreciate.</p>