/*!
\page gdal_building
Building GDAL From Source
Building on Unix
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 CVS as gdal):
% cd gdal
% ./configure
% make
Some caveats are:
- I depend on GNUmake on Unix platforms. Just get and install it if
you don't already have it.
- 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.
- 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 gdal/ogr/ogr.a
gdal/frmts/o/ *.a gdal/gdal.a gdal/port/cpl.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.
- My "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 likelyhave 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 supress it at
configure using --without-python, or override the python module output
directory at configure time with the --with-pymodir=<directory>
Building on Windows
GDAL can be built on Windows using MS VC++ 6.x and MS Visual Studio .NET (C++)
at the DOS command line. For this to work you will normally have to have run
the VCVAR32.BAT script that comes with the compiler. For VC 6.x this might be
found at:
C:\\Program Files\\Microsoft Visual Studio\\VC98\\bin\\VCVARS32.BAT
Once the environment is setup, you can cd to the GDAL root directory
and do the following:
C:\\GDAL> nmake /f makefile.vc
There are lots of options that can be tweaked by hand in the nmake.opt
file in the GDAL root directory.
- BINDIR: Directory in which to install executables, and DLLs if
you use the "nmake /f makefile.vc install" command.
- PY_INST_DIR: Directory to install python modules in.
- PYDIR: The directory where your python tree is installed.
Used to find python include files. If this is set to a directory that
does not exist then python support will be omitted from the build.
- DLLBUILD: Define this (to "1") to force all the OGR utilities
to link against the GDAL DLL instead of building built statically.
- INCLUDE_OGR_FRMTS: Set to "YES" to build OGR formats into
the GDAL dll, or comment out to omit OGR formats from build.
- SETARGV: Point this to the setargv.obj file distributed with
Visual Studio to get wildcard expanasion for commandline arguments or
leave commented out to omit this.
- OPTFLAGS: Set this to contain the desired compiler flags for
compiling. The default is a debug build but there is usually a suitable
alternative for optimized builds commented out in the template file.
- ECWDIR/ECWLIB: Uncomment these to enable building with ECW
support, correcting ECWDIR to point to the install location on your system.
- OGDIDIR/OGDIVER/OGDILIB: Uncomment these to enable OGDI
support, correcting the OGDIDIR and OGDIVER values as needed.
- HDF4_DIR: Uncomment, and correct path to enable support for
NCSA HDF Release 4.
- JASPER_DIR/JASPER_INCLUDE/JASPER_LIB: This variables should be
pointed to appropriate directories where JasPer library was installed. JasPer
toolkit needed for JPEG2000 support.
- XERCES_DIR/XERCES_INCLUDE/XERCES_LIB: Uncomment these and
correct XERCES_DIR to enable Xerces XML parser support for GML read support.
- FME_DIR: Uncomment, and correct path to enable support for
FMEObject vector access.
I frequently forget to update the Windows makefiles when I add new files,
so if something comes up missing consider comparing the file lists in the
appropriate makefile.vc against the GNUmakefile or just contact me.
External Libraries
Several drivers require additional libraries to be installed in your system.
These are:
- NCSA HDF library can be downloaded from the
The NCSA HDF Home Page
at the
National Center for Supercomputing Applications.
If your OS distribution already contains prebuilded HDF library you can
use one from the distribution.
Please note, that NCSA HDF library compiled with several defaults which is
defined in hlimits.h file. For example, hlimits.h defines
the maximum number of opened files:
# define MAX_FILE 32
If you need open more HDF4 files simultaneously you should change this value
and rebuild HDF4 library (there is no need to rebuild GDAL if it is already
compiled with HDF4 support).
- JPEG2000 support based on JasPer toolkit which can be accessed
from the
The JasPer Project Home Page.
JasPer itself is a bridge for working with several image file formats.
Only JP2 and JPC parts of JasPer used in GDAL.
*/