Andrea Formica
2013-03-30 07:05:27 UTC
Dear all, I had a problem trying to compile soci on Macosx Lion using cmake, and activating the oracle backend following the instructions
provided in the documentation.
I would like to understand if it is only that documentation is not clear enough (for cmake beginners) or if it could be a bug in the cmake scripts.
The problem was related to the path of oracle libraries. I do not know exactly what was wrong, but basically cmake did not recognize
my command line options, when I was trying to set the path to includes and libs.
I have ORACLE_HOME defined in my environment.
Then I try to do
cmake -DWITH_ORACLE=ON -DORACLE_INCLUDE_DIR=/Users/formica/MyApp/Library/oracle/instantclient_10_2/sdk/include -DORACLE_LIBRARIES=/Users/formica/MyApp/Library/oracle/instantclient_10_2
This results in libraries not being found.
Looking inside the cmake/modules/FindOracle.cmake file, I saw that there is a sort of "automatic" discovery for libraries when the ORACLE_HOME is set.
Unfortunately, the automatic discovery fails for libraries (it works though for includes)....here is the set of instructions that was causing a problem,
which is the part trying to find includes and libs.
set(ORACLE_OCI_NAMES clntsh libclntsh oci)
set(ORACLE_NNZ_NAMES nnz10 libnnz10 nnz11 libnnz11 ociw32)
set(ORACLE_OCCI_NAMES libocci occi oraocci10 oraocci11)
set(ORACLE_LIB_DIR
${ORACLE_HOME} ===========>>>>> This line was missing !!
${ORACLE_HOME}/lib
${ORACLE_HOME}/OCI/lib/MSVC) # Oracle XE on Windows
find_library(ORACLE_OCI_LIBRARY NAMES ${ORACLE_OCI_NAMES} PATHS ${ORACLE_LIB_DIR})
find_library(ORACLE_OCCI_LIBRARY NAMES ${ORACLE_OCCI_NAMES} PATHS ${ORACLE_LIB_DIR})
find_library(ORACLE_NNZ_LIBRARY NAMES ${ORACLE_NNZ_NAMES} PATHS ${ORACLE_LIB_DIR})
set(ORACLE_LIBRARY ${ORACLE_OCI_LIBRARY} ${ORACLE_OCCI_LIBRARY} ${ORACLE_NNZ_LIBRARY})
I'm not claiming that this is a "bug" in the installation procedure, but for a "beginner" of cmake (like me ;-) ) it means that at least the installation instructions
are not so clear, because it looks that the options for the library path that the user can provide are in reality ignored when ORACLE_HOME is set.
Is there something else I should have done instead of hacking the cmake script ?
Is there a problem with the location of the instant client that I have been using ?
As an alternative solution I could also create a "lib" dir under ORACLE_HOME and put there links to every library without hacking your script obviously.
Btw, this is what I ended up to do for installation using homebrew.
Thanks in advance for your comments
Andrea
provided in the documentation.
I would like to understand if it is only that documentation is not clear enough (for cmake beginners) or if it could be a bug in the cmake scripts.
The problem was related to the path of oracle libraries. I do not know exactly what was wrong, but basically cmake did not recognize
my command line options, when I was trying to set the path to includes and libs.
I have ORACLE_HOME defined in my environment.
Then I try to do
cmake -DWITH_ORACLE=ON -DORACLE_INCLUDE_DIR=/Users/formica/MyApp/Library/oracle/instantclient_10_2/sdk/include -DORACLE_LIBRARIES=/Users/formica/MyApp/Library/oracle/instantclient_10_2
This results in libraries not being found.
Looking inside the cmake/modules/FindOracle.cmake file, I saw that there is a sort of "automatic" discovery for libraries when the ORACLE_HOME is set.
Unfortunately, the automatic discovery fails for libraries (it works though for includes)....here is the set of instructions that was causing a problem,
which is the part trying to find includes and libs.
set(ORACLE_OCI_NAMES clntsh libclntsh oci)
set(ORACLE_NNZ_NAMES nnz10 libnnz10 nnz11 libnnz11 ociw32)
set(ORACLE_OCCI_NAMES libocci occi oraocci10 oraocci11)
set(ORACLE_LIB_DIR
${ORACLE_HOME} ===========>>>>> This line was missing !!
${ORACLE_HOME}/lib
${ORACLE_HOME}/OCI/lib/MSVC) # Oracle XE on Windows
find_library(ORACLE_OCI_LIBRARY NAMES ${ORACLE_OCI_NAMES} PATHS ${ORACLE_LIB_DIR})
find_library(ORACLE_OCCI_LIBRARY NAMES ${ORACLE_OCCI_NAMES} PATHS ${ORACLE_LIB_DIR})
find_library(ORACLE_NNZ_LIBRARY NAMES ${ORACLE_NNZ_NAMES} PATHS ${ORACLE_LIB_DIR})
set(ORACLE_LIBRARY ${ORACLE_OCI_LIBRARY} ${ORACLE_OCCI_LIBRARY} ${ORACLE_NNZ_LIBRARY})
I'm not claiming that this is a "bug" in the installation procedure, but for a "beginner" of cmake (like me ;-) ) it means that at least the installation instructions
are not so clear, because it looks that the options for the library path that the user can provide are in reality ignored when ORACLE_HOME is set.
Is there something else I should have done instead of hacking the cmake script ?
Is there a problem with the location of the instant client that I have been using ?
As an alternative solution I could also create a "lib" dir under ORACLE_HOME and put there links to every library without hacking your script obviously.
Btw, this is what I ended up to do for installation using homebrew.
Thanks in advance for your comments
Andrea