Version 2 (modified by darkblueB, 11 years ago) (diff)


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):

% cd gdal
% ./configure
% make
% su
Password: ********
# make install
# exit

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.

Some caveats:

  • 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.
  • GDAL shouldn't have many pre-requisite packages. It 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.
  • 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.
  • 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, or override the python module output directory at configure time with the --with-pymodir=directory

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 external script languages, like Python, you MUST install SWIG 1.3

for Python support (recommeded) install Python Dev and optionally NumPy? dev