GDAL has been successfully built on Linux, IRIX, Solaris, BSD, and MacOS X. On Unix platforms you might be able to build it as follows (assuming it is unpacked or checked out of subversion as gdal):
System install :
% cd gdal % ./configure [options] % make % su Password: ******** # make install # exit
Install in non-root directory :
% cd gdal % ./configure --prefix=/path/to/install/prefix [options] % make % make install % export PATH=/path/to/install/prefix/bin:$PATH % export LD_LIBRARY_PATH=/path/to/install/prefix/lib:$LD_LIBRARY_PATH % export GDAL_DATA=/path/to/install/prefix/share/gdal # Test % gdalinfo --version # See below for installation of Python bindings
In order to run GDAL after installing it is necessary for the shared library to be findable. This can often be accomplished by setting LD_LIBRARY_PATH to include /usr/local/lib.
- GDAL depends on GNUmake on Unix platforms. Just get and install it if you don't already have it. On Linux it is the default make.
- A basic GDAL build shouldn't have many pre-requisite packages. GDAL includes built-in versions of libz, libtiff, libgeotiff, libpng, libgif, and libjpeg if pre-installed versions are not available (or not desirable).
- There are quite a few optional drivers that depend on "external libraries". Use configure --help to see the configure options. Some optional libraries include those for GRASS, FITS, OGDI, HDF4, JPEG2000 and ECW. Specific issues about some drivers are addressed in pages listed at BuildHints.
- When using "pre-packaged" versions of dependencies like curl, Python, or HDF4, it is often necessary to install the -dev version of the package. For instance on Ubuntu having libcurl3-gnutls is not sufficient. The libcur3-gnutls-dev package is also required. Configure may seem to succeed but later include files will come up missing during the build.
- Check the output of configure carefully if there are any problems. The summary shows clearly what will be included in the build. The tests above can provide clues to an unexpected result.
- The shared library building is pretty specific to the GNU tool chain. If you are using something different than GNU C++, then you will likely finding that the .so files isn't built successfully. You could just link against the static libraries (normally gdal/gdal.a) or you could hack LD_SHARED command in gdal/GDALmake.opt to work on your platform. For the SGI a value of c++ -shared -all is often suitable.
- GDAL, and it's utilities should now build on Cygwin and other platforms where shared libraries are not supported. However, to build your own applications against it, you will need to link against a more extensive set of libraries. The gdal-config --libs command can be used to determine the library set.
- The "autoconf" logic that checks for libtiff, libpng and libjpeg isn't too savvy about versions. If it is using pre-installed versions of these libraries and this support isn't working, rerun configure with "--with-png=internal", "--with-jpeg=internal", "--with-geotiff=internal" or "--with-libtiff=internal" instead.
- To build on IRIX it is generally necessary to hand modify the GDALmake.opt file resulting from configure, and change "ld -shared" to "ld -shared -all".
- If you find build problems with one of the format drivers that you don't care about, just remove the format from the GDAL_FORMATS line at the bottom of gdal/GDALmake.opt, do a make clean, and make. This will drop it from the build and default runtime registration.
- With GDAL 2.0 or previous version, if you are trying to install as other than root (to your own tree set with --prefix), you will likely have problems with the python since it always tries to install under the site-packages directory for the installed python tree. If you don't need python support you can suppress it at configure using --without-python. If you need them,
(from GDAL source root) cd swig/python python setup.py build mkdir -p /path/to/install/prefix/lib/python2.7/site-packages (replace python2.7 by appropriate version in all below commands) PYTHONPATH=/path/to/install/prefix/lib/python2.7/site-packages setup.py install --prefix=/path/to/install/prefix # Check that this works with : PYTHONPATH=/path/to/install/prefix/lib/python2.7/site-packages:$PYTHONPATH python -c "from osgeo import gdal; print(gdal.__version__)"
- Static builds of GDAL are possible. Here is one route that worked for me on Ubuntu 10.04 at about revision 23504 (you may want to take caution and figure out if there is a better way). This example has java and mdb but shouldn't be required. openjdk-6-jre and openjdk-6-jdk must be installed if you want --with-java. ./configure --with-java=yes --with-mdb=yes --without-ld-shared --disable-shared --enable-static. Then copy just /usr/bin/ogrinfo and ogr2ogr to another machine with similar environment (minus compiling tools, etc), follow mdb format page if you are using mdb.
A Working Example - Ubuntu 7.1 w/ GDAL 1.5
- to add curl support, install the curl dev package in addition to the existing curl
- for Python support you MUST install Python Dev and optionally NumPy dev (recommeded) see GdalOgrInPython for details
OCI without installing Oracle
- 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-184.108.40.206.zip instantclient-sqlplus-linux32-220.127.116.11.zip instantclient-sdk-linux32-18.104.22.168.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 ne