Oracle DB access

Hello,

I am trying to configure ROOT in order to access a Oracle DB.
I am running OS X 10.10.3, ROOT 6.04.16.
Here below the steps I followed:

-) Downloaded ORACLE Instant Client (basic, sdk, sqlplus, JDBC)
-) Soft links between libraries (i.e. libocci.dylib -> libocci.dylib.11.1 )
-) Added the path to .profile

export DYLD_LIBRARY_PATH=/Users/edo/Documents/Oracle_instantclient_11_2/:$DYLD_LIBRARY_PATH
-) Configured ROOT as follows:

I obtain the following output (which seems promising):

-- Looking for MySQL -- Found MYSQL: /usr/local/mysql/include -- Looking for Oracle -- Found sqlplus version: 11.2.0.3.0 -- Guessed ORACLE_OCI_VERSION value: 11G -- Found Oracle: /Users/edo/Documents/Oracle_instantclient_11_2/libocci.dylib;/Users/edo/Documents/Oracle_instantclient_11_2/libclntsh.dylib;/Users/edo/Documents/Oracle_instantclient_11_2/libnnz10.dylib
-) I compile and I get the following error:

Linking CXX shared library ../../lib/libOracle.so Undefined symbols for architecture x86_64: "oracle::occi::getVector(oracle::occi::ResultSet*, unsigned int, std::__1::vector<oracle::occi::Number, std::__1::allocator<oracle::occi::Number> >&)", referenced from: TOracleStatement::GetVLong(int, std::__1::vector<long, std::__1::allocator<long> >&) in TOracleStatement.cxx.o ... ...

It seems that it can’t link against the libraries.
Am I missing something?
I tried the same on SLC6, no problem has occurred.
Any suggestion is more than welcome.

Thanks,
Best.

Edoardo Farina

Hi Edoardo, I think the problem is that Oracle has build the libraries (occi) not using libc++ but libstdc++. By default ROOT builds using libc++ on MacOSX.

Hello,
Thanks a lot for your feedback.
I tried to add the following line

How can I replace the default flag? Now at compile stage I see both set…

I still get the same error, here below with some more verbosity:

Linking CXX shared library ../../lib/libOracle.so Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn) Target: x86_64-apple-darwin14.3.0 Thread model: posix "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -dylib -arch x86_64 -dylib_install_name @rpath/libOracle.so -macosx_version_min 10.10.0 -single_module -o ../../lib/libOracle.so -headerpad_max_install_names -dead_strip_dylibs CMakeFiles/Oracle.dir/G__Oracle.cxx.o CMakeFiles/Oracle.dir/src/TOracleResult.cxx.o CMakeFiles/Oracle.dir/src/TOracleRow.cxx.o CMakeFiles/Oracle.dir/src/TOracleServer.cxx.o CMakeFiles/Oracle.dir/src/TOracleStatement.cxx.o ../../lib/libCore.so /Users/edo/Documents/Oracle_instantclient_11_2/libocci.dylib /Users/edo/Documents/Oracle_instantclient_11_2/libclntsh.dylib /Users/edo/Documents/Oracle_instantclient_11_2/libnnz10.dylib ../../lib/libNet.so ../../lib/libRIO.so ../../lib/libThread.so ../../lib/libMathCore.so ../../lib/libCore.so -rpath /Users/edo/Documents/ROOT_NEW/root-build/lib -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/lib/darwin/libclang_rt.osx.a Scanning dependencies of target Tree Undefined symbols for architecture x86_64: "oracle::occi::getVector(oracle::occi::ResultSet*, unsigned int, std::__1::vector<oracle::occi::Number, std::__1::allocator<oracle::occi::Number> >&)", referenced from: TOracleStatement::GetVLong(int, std::__1::vector<long, std::__1::allocator<long> >&) in TOracleStatement.cxx.o TOracleStatement::GetVLong64(int, std::__1::vector<long long, std::__1::allocator<long long> >&) in TOracleStatement.cxx.o

Thanks,
Best.

Edoardo

Hi Edoardo. I have tried a more specific workaround and add -stdlib=libstdc++ only for the oracle plugin but I run into problems compiling c++11 classes like . So far I have no solution.

Dear Mato,

My apologies if I resume this topic.
As far as I understand, it is not possible at the moment to link against ROOT and Oracle libraries at the same time on my OS X system.
I made a very simple stand-alone program, linking only against Oracle libocci library and everything works.
As soon as I link against ROOT I obtain segmentation faults and, running gdb, I get the following message:

[code]Starting program: /Users/edo/Downloads/instantclient_11_2-4/a.out
dyld: Library not loaded: /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
Referenced from: /Users/edo/Downloads/instantclient_11_2-4/a.out
Reason: image not found

Program received signal SIGTRAP, Trace/breakpoint trap.[/code]
Sorry, I am not very experienced in this kind of problems. Is this due to the different libraries used at the compilation stage? Is there a way to compile the Oracle libraries differently?

Thanks a lot for you help,
Best.
Edoardo Farina

Dear Edoardo,

You need to set the DYLD_LIBRARY_PATH to the installation of the oracle instant client libraries. The location where libclntsh.dylib.11.1 is found.
Pere

Unfortunately I have set DYLD_LIBRARY_PATH already.
If I don’t add ROOT classes to my code everything runs smoothly and I can connect to Oracle w/o problems.

I am not sure that I understand. Can you du the following in your shell:

otool -L /Users/edo/Downloads/instantclient_11_2-4/a.out 
echo $DYLD_LIBRARY_PATH

I have a stand-alone program only linking against Oracle which I compile with the following command:

Everything runs fine.
If I add ROOT libraries and I compile with the following:

I get runtime seg fault. (no warning during compilation)
I think it is due to libc++/libstd++ incompatibility as you suggested at the beginning.

Here below the output of the shell command you asked:

[code]$ otool -L /Users/edo/Downloads/instantclient_11_2-4/a.out

/Users/edo/Downloads/instantclient_11_2-4/a.out:
/ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1 (compatibility version 0.0.0, current version 0.0.0)
/ade/b/3071542110/oracle/rdbms/lib/libocci.dylib.11.1 (compatibility version 0.0.0, current version 0.0.0)
@rpath/libGui.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libCore.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libRIO.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libNet.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libHist.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libGraf.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libGraf3d.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libGpad.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libTree.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libRint.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libPostscript.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libMatrix.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libPhysics.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libMathCore.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libThread.so (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
@rpath/libGeom.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libMinuit.so (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)[/code]

$ echo $DYLD_LIBRARY_PATH /usr/local/mysql/lib:/Users/edo/Documents/Oracle_instantclient_11_2:/Users/edo/Documents/Geant4/geant4.10.01-install/lib:/Users/edo/Documents/root6/lib

Thanks,

Are the Oraclelibraries actually in /Users/edo/Documents/Oracle_instantclient_11_2? they are not under a /lib directory?

Yes, they are in that directory…

Yes, the segmentation fault if due to this certainly.