This discussion is archived
14 Replies Latest reply: Oct 25, 2012 12:48 PM by 824871 RSS

Building GDAL with geoRaster support in Linux

638296 Newbie
Currently Being Moderated
Please forgive me if this has been posted before (I did search but did not find a match) or if considered off topic.

In the past I have only used GDAL + Oracle instant client + GeoRaster on the Windows platform. I’m looking to run it on Linux but have spent hours trying to build it... and it seems to be a straightforward process. (note I am trying to build on Ubuntu but will also be doing the same on RedHat based system). Using GDAL 1.7.2 and Oracle instant client 11.2

** Downloaded:
instantclient-basic-linux32-11.2.0.1.zip
instantclient-sdk-linux32-11.2.0.1.zip
instantclient-sqlplus-linux32-11.2.0.1.zip

and unzipped these.

** Set the following environment variables:

LD_LIBRARY_PATH=/home/matt/instantclient_11_2
ORACLE_HOME=/home/matt/instantclient_11_2
NLS_LANG=American_America.WE8ISO8859P1

** created symbolic links:

ln -s libclntsh.so.11.1 libclntsh.so
ln -s libocci.so.11.1 libocci.so

** run the ./configure script in GDAL directory from command line:

matt@bandicoot:~/gdal-1.7.2$ ./configure with-oci=/home/matt/instantclient_11_2 with-oci-include=/home/matt/instantclient_11_2/sdk/include --with-oci-lib=/home/matt/instantclient_11_2



Am I missing something?

Cheers,
MH
  • 1. Re: Building GDAL with geoRaster support in Linux
    615755 Newbie
    Currently Being Moderated
    To make "configure" aware of Oracle and to make it build with support for GeoRaster all will need is a valid ORACLE_HOME variable. All those "--with-oci" are related to the OGR/OCI driver that supports SDO_GEOMETRY. What is exactly the problem you are having?
  • 2. Re: Building GDAL with geoRaster support in Linux
    638296 Newbie
    Currently Being Moderated
    Ivan,

    Thanks for the quick reply. Yes, even with the ORACLE_HOME set, it is reporting:

    GEORASTER support: no

    My ORACLE_HOME is set to: /home/matt/instantclient_11_2

    Note, the header files are in /home/matt/instantclient_11_2/sdk/include
    The lib files are in /home/matt/instantclient_11_2

    Is this the structure expected? This is the structure of the zip files (instant client) downloaded from Oracle.

    Cheers,
    Matt
  • 3. Re: Building GDAL with geoRaster support in Linux
    615755 Newbie
    Currently Being Moderated
    Matt,

    I never used the instant client but I can see on GDAL/m4/ax_oracle_oci.m4 that one attempt is made to find the folder "/sdk/include" based on ORACLE_HOME, see: [source code|http://trac.osgeo.org/gdal/browser/trunk/gdal/m4/ax_oracle_oci.m4]

    Can you please check the ./configure message log for lines like that:

    checking for Oracle OCI headers in /home/oracle/product/11gR2/db/rdbms/public... yes
    checking for Oracle OCI libraries in /home/oracle/product/11gR2/db/lib... yes

    or

    checking if Oracle support is enabled... no
  • 4. Re: Building GDAL with geoRaster support in Linux
    638296 Newbie
    Currently Being Moderated
    I have the following from the log file:

    configure:19846: checking for Oracle OCI headers in
    configure:19879: g++ -c -g -O2 -I/usr/lib/oracle/11.2/client/rdbms/public -I/usr/lib/oracle/11.2/client/rdbms/demo -I/usr/lib/oracle/11.2/client/sdk/include conftest.cpp >&5
    conftest.cpp:57:29: error: oci.h: No such file or directory
    conftest.cpp:70:4: error: #error Oracle oci.h header not found
    configure:19879: $? = 1
    configure: failed program was:
    | /* confdefs.h */
    | #define PACKAGE_NAME ""
    | #define PACKAGE_TARNAME ""
    | #define PACKAGE_VERSION ""
    | #define PACKAGE_STRING ""
    | #define PACKAGE_BUGREPORT ""
    | #define PACKAGE_URL ""
    | #define STDC_HEADERS 1
    | #define HAVE_SYS_TYPES_H 1
    | #define HAVE_SYS_STAT_H 1
    | #define HAVE_STDLIB_H 1
    | #define HAVE_STRING_H 1
    | #define HAVE_MEMORY_H 1
    | #define HAVE_STRINGS_H 1
    | #define HAVE_INTTYPES_H 1
    | #define HAVE_STDINT_H 1
    | #define HAVE_UNISTD_H 1
    | #define HAVE_DLFCN_H 1
    | #define LT_OBJDIR ".libs/"
    | #define HAVE_LIBDL 1
    | #define HAVE_LIBRT 1
    | #define HAVE_LIBM 1
    | #define STDC_HEADERS 1
    | #define HAVE_ASSERT_H 1
    | #define HAVE_FCNTL_H 1
    | #define HAVE_UNISTD_H 1
    | #define HAVE_DLFCN_H 1
    | #define HAVE_STDINT_H 1
    | #define HAVE_LIMITS_H 1
    | #define HAVE_LOCALE_H 1
    | #define HAVE_VALUES_H 1
    | #define HAVE_FLOAT_H 1
    | #define HAVE_ERRNO_H 1
    | #define HAVE_LONG_LONG 1
    | #define UNIX_STDIO_64 1
    | #define VSI_LARGE_API_SUPPORTED 1
    | #define VSI_FTELL64 ftello64
    | #define VSI_FSEEK64 fseeko64
    | #define VSI_STAT64 stat64
    | #define VSI_STAT64_T stat64
    | #define VSI_FOPEN64 fopen64
    | #define SIZEOF_INT 4
    | #define SIZEOF_UNSIGNED_LONG 4
    | #define SIZEOF_VOIDP 4
    | #define HAVE_IEEEFP 1
    | #define HOST_FILLORDER FILLORDER_LSB2MSB
    | #define HAVE_VPRINTF 1
    | #define HAVE_SNPRINTF 1
    | #define HAVE_VSNPRINTF 1
    | #define HAVE_ATOLL 1
    | #define HAVE_STRTOF 1
    | #define HAVE_GETCWD 1
    | #define HAVE_DECL_STRTOF 1
    | #define HAVE_GCC_ATOMIC_BUILTINS 1
    | /* end confdefs.h. */
    |
    | #include <oci.h>
    | int
    | main ()
    | {
    |
    | #if defined(OCI_MAJOR_VERSION)
    | #if OCI_MAJOR_VERSION == 10 && OCI_MINOR_VERSION == 2
    | // Oracle 10.2 detected
    | #endif
    | #elif defined(OCI_V7_SYNTAX)
    | // OK, older Oracle detected
    | // TODO - mloskot: find better macro to check for older versions;
    | #else
    | # error Oracle oci.h header not found
    | #endif
    |
    |
    | ;
    | return 0;
    | }
    configure:19898: result: header not found
    configure:20041: checking if Oracle support is enabled
    configure:20055: result: no



    configure:21294: checking if Oracle support is enabled
    configure:21308: result: no

    ---------

    Note that on the system I am using, the oci.h file is in /usr/include/oracle/11.2/client

    Is the configure script looking for a "certain" directory structure?

    I'm surprised that you haven't tried the instant client before, it is a very popular that people often use on a machine separate from the database machine.

    Cheers,
  • 5. Re: Building GDAL with geoRaster support in Linux
    638296 Newbie
    Currently Being Moderated
    when I realized it was just sticking /sdk/include on the end of $ORACLE_HOME i just changed it to the instant client directory. Note: with the instant client download, you can either install the RPMs to the /usr directories, OR just unzip the files and keep 'em in a regular folder. The directory structures are different depending on which option you decide on.

    anyway, this helped and i got a bit further:

    checking for Oracle OCI headers in /home/matt/instantclient_11_2/sdk/include... yes
    checking for Oracle OCI libraries in /home/matt/instantclient_11_2/lib... library not found
  • 6. Re: Building GDAL with geoRaster support in Linux
    615755 Newbie
    Currently Being Moderated
    Please try that:

    export ORACLE_HOME=/home/matt/instantclient_11_2

    ./configure with-oci-include=/home/matt/instantclient_11_2/sdk/include with-oci-lib=/home/matt/instantclient_11_2

    or

    ./configure with-oci-include=/home/matt/instantclient_11_2/client with-oci-lib=/home/matt/instantclient_11_2
  • 7. Re: Building GDAL with geoRaster support in Linux
    638296 Newbie
    Currently Being Moderated
    Success. Thanks for your help.

    A few tips for others looking to do this:

    - you don't have to install the instant client into the various /usr/... locations. It will work fine in a directory of your choosing. e.g. /home/matt/instantclient_11_2
    - oracle instant client has downloads for both RPMs and ZIP files. Note the RPMs will install into the /usr/... locations. The ZIPs have a structure where everything is in a single directory.
    - installing into a single directory in a user home avoids issues with permissions. Note that using "su" versus "sudo" can have implications for file permissions if you do ever install oracle instant client to the /usr/... directories as a regular user.

    These steps worked for me on a Fedora system:

    1.) download the 3 files related to oracle instant client:
    instantclient-basic-linux32-11.2.0.1.zip
    instantclient-sqlplus-linux32-11.2.0.1.zip
    instantclient-sdk-linux32-11.2.0.1.zip

    2.) unzip to a user location, e.g. /home/matt/instantclient_11_2

    3.) export ORACLE_HOME=/home/matt/instantclient_11_2

    4.) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/matt/instantclient_11_2

    5.) export PATH=$PATH:$ORACLE_HOME

    6.) export NLS_LANG=American.America.WE8ISO8859P1 (this may not be essential)

    7.) create symbolic links:
    ln -s libclntsh.so.11.1 libclntsh.so
    ln -s libocci.so.11.1 libocci.so

    8.) run the configure script (from your GDAL directory, e.g. /home/matt/gdal-1.7.2):
    ./configure with-oci-include=/home/matt/instantclient_11_2/sdk/include with-oci-lib=/home/matt/instantclient_11_2

    9.) run "make" from the same GDAL directory:
    make

    10.) su
    Password: ********

    11.) make install

    12.) exit (no need to be root anymore)

    13.) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib (this may not be essential)


    That's it. This should GEORASTER support for GDAL. The sqlplus application should also work.


    Cheers,
    Matt

    Edited by: mattyj on Sep 15, 2010 3:04 PM
  • 8. Re: Building GDAL with geoRaster support in Linux
    638296 Newbie
    Currently Being Moderated
    follow up to this, depending on your linux system you may need to install g++ for compiling.

    In Fedora, this can be done (as root) using:

    yum install gcc-c++
  • 9. Re: Building GDAL with geoRaster support in Linux
    840269 Newbie
    Currently Being Moderated
    Hello,

    I want to do the same thing in the same environment but when I try to configure I have the message library not found for Oracle OCI libraries.

    I have download the three files, unzip in my /home/xxx/oracle_instant_11_2

    instantclient-basic-linux32-11.2.0.1.zip
    instantclient-sdk-linux32-11.2.0.1.zip
    instantclient-sqlplus-linux32-11.2.0.1.zip

    Set this :
    LD_LIBRARY_PATH=/home/xxx/instantclient_11_2
    ORACLE_HOME=/home/xxx/instantclient_11_2

    created symbolic links:

    ln -s libclntsh.so.11.1 libclntsh.so
    ln -s libocci.so.11.1 libocci.so

    and when I run ./configure with-oci-include=/home/xxx/instantclient_11_2/sdk/include with-oci-lib=/home/xxx/instantclient_11_2

    I have this :

    checking for Oracle OCI headers in /home/matt/instantclient_11_2/sdk/include... yes
    checking for Oracle OCI libraries in /home/matt/instantclient_11_2/lib... library not found

    Thanks for your help
  • 10. Re: Building GDAL with geoRaster support in Linux
    824871 Newbie
    Currently Being Moderated
    Please note a similar thread on gdal-dev forum:

    Re: Building GDAL with geoRaster support in Linux

    Please let us know if that doesn't work for you.

    Regards,

    Ivan
  • 11. Re: Building GDAL with geoRaster support in Linux
    935791 Newbie
    Currently Being Moderated
    Hello!

    I don't know why it want lib dir...?
    I've created symbolic link:

    ln -s /home/xxx/oracle/instantclient_11_2/ lib
  • 12. Re: Building GDAL with geoRaster support in Linux
    824871 Newbie
    Currently Being Moderated
    What Ubuntu version are you using?

    - Ubuntu Desktop 12.04 LTS 64
    - Ubuntu Desktop 12.04 LTS 32
    - Ubuntu Server 12.04 LTS 64
    - Ubuntu Server 12.04 LTS 32
  • 13. Re: Building GDAL with geoRaster support in Linux
    user123456789 Newbie
    Currently Being Moderated
    I was having the same problem and I was able to make it work by adding "LIBS=$ORACLE_HOME/lib/libclntsh.so". It looks like it was not finding the library correctly?

    So my final command was

    ./configure with-oci-include=$ORACLE_HOME/include with-oci-lib=$ORACLE_HOME/lib LIBS=$ORACLE_HOME/lib/libclntsh.so
  • 14. Re: Building GDAL with geoRaster support in Linux
    824871 Newbie
    Currently Being Moderated
    Matt,

    I did some experiment on Ubutun32 running on Oracle VM VirtualBox and found that some of the instructions suggested on GDAL's wiki are conflicting with each other.

    Since I have a fresh installed system, at some point my problem was that I didn't have "g++" or the "libaio" installed.

    But with those problem fixed I tried to follow the suggestion but noticed that when environment variable ORACLE_HOME is defined, it doesn't matter what you enter as a parameter in with-oci-lib and with-oci-include. I can see that on my file config.log.

    So I think that it is correct to created the symbolic, as suggested. I am puzzled by the "LIBS=" suggestion, without it the configuration file is capable to find the libraries but it cannot find the function inside it.

    But by resetting ORACLE_HOME and entering the full path for instantClient into all the parameters, I finally got it to work.
    $ ln -s libclntsh.so.11.1 libclntsh.so
    $ ln -s libocci.so.11.1 libocci.so
    $ unset ORACLE_HOME
    $ ./configure --with-oci-include=/home/some-folder/instantclient_11_2/sdk/include --with-oci-lib=/home/some-folder/instantclient_11_2 LIBS=/home/some-folder/instantclient_11_2/libclntsh.so
    The configuration file in <gdal src>/m4/ax_oracle_oci.m4 has a provision to deal with instantClient and I am going to see if there is something that can be done to improve and make the process of compiling for InstantClient as smoothy as it is for Server and Client.

    Regards,
    Ivan

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points