Kyng Chaos
“The beast is actively interested only in now, and, as it is always now and always shall be, there is an eternity of time for the accomplishment of objects.”
- the wisdom of Tarzan

GDAL/OGR Build

version: 1.7.2
source: http://www.gdal.org/

parallel: OK

The GDAL build is mostly straightforward. GRASS support is a tricky bit, but easily solved - use a separate plugin.

Patches

First up, a patch.

To use the system iODBC instead of needing to build a separate UnixODBC.

Edit configure.

Change all occurrences of "-lodbc" with "-liodbc" (case sensitive, not whole words).

Edit port/cpl_odbc.h. Change the odbcinst include to:

#include <iodbcinst.h>

Snow Leopard

configure

In the GDAL source:

export MACOSX_DEPLOYMENT_TARGET=10.6
export ARCHFLAGS="-arch i386 -arch x86_64"
./configure --with-threads --disable-static --without-grass --with-jasper=/usr/local \
--with-libtiff=/usr/local --with-jpeg=/usr/local --with-gif=/usr/local --with-png=/usr/local \
--with-geotiff=/usr/local --with-sqlite3=/usr --with-odbc --with-pcraster=internal \
--with-geos=/usr/local/bin/geos-config --with-static-proj4=/usr/local --with-expat=/usr/local \
--with-curl --with-python --with-macosx-framework CFLAGS="-Os -arch i386 -arch x86_64" \
CXXFLAGS="-Os -arch i386 -arch x86_64" \
LDFLAGS="-arch i386 -arch x86_64"

If you installed any of these optional packages, add to the configure line:

Xerces –with-xerces –with-xerces-inc=/usr/local/include –with-xerces-lib="-L/usr/local/lib -lxerces-c -framework CoreServices"
PostgreSQL –with-pg=/usr/local/pgsql/bin/pg_config
MrSID Geo DSDK –with-mrsid=
and drag the MrSID Geo DSDK folder from the Finder to the Terminal window.
MySQL –with-mysql=/usr/local/mysql/bin/mysql_config
NetCDF –with-netcdf=/usr/local
HDF 4 & 5 –with-hdf4=/usr/local –with-hdf5=/usr/local
OGDI –with-ogdi=/usr/local
CFITSIO –with-cfitsio=/usr/local
DAP –with-dods-root=/usr/local
ECW –with-ecw=/usr/local
Spatialite (with updated SQLite3) –with-spatialite=/usr/local –with-sqlite3=/usr/local,
and make sure to remove the other sqlite3 option

edit port/cpl_config.h

add at end:

#undef SIZEOF_LONG
#undef SIZEOF_UNSIGNED_LONG
#undef SIZEOF_VOIDP
#ifdef __LP64__
#define SIZEOF_LONG 8
#define SIZEOF_UNSIGNED_LONG 8
#define SIZEOF_VOIDP 8
#else
#define SIZEOF_LONG 4
#define SIZEOF_UNSIGNED_LONG 4
#define SIZEOF_VOIDP 4
#endif
#undef VSI_STAT64
#undef VSI_STAT64_T
#define VSI_STAT64 stat
#define VSI_STAT64_T stat

make & install

Then finish:

make
sudo make install

Leopard

configure

In the GDAL source:

export MACOSX_DEPLOYMENT_TARGET=10.5
export ARCHFLAGS="-arch ppc -arch i386"
./configure --with-threads --disable-static --without-grass --with-jasper=/usr/local \
--with-libtiff=/usr/local --with-jpeg=/usr/local --with-gif=/usr/local --with-png=/usr/local \
--with-geotiff=/usr/local --with-sqlite3=/usr --with-odbc --with-pcraster=internal \
--with-geos=/usr/local/bin/geos-config --with-static-proj4=/usr/local --with-expat=/usr/local \
--with-curl --with-python --with-macosx-framework CFLAGS="-Os -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXXFLAGS="-Os -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
LDFLAGS="-arch i386 -arch x86_64 -arch ppc -arch ppc64"

If you installed any of these optional packages, add to the configure line:

Xerces –with-xerces –with-xerces-inc=/usr/local/include –with-xerces-lib="-L/usr/local/lib -lxerces-c -framework CoreServices"
PostgreSQL –with-pg=/usr/local/pgsql/bin/pg_config
MrSID Geo DSDK –with-mrsid=
and drag the MrSID Geo DSDK folder from the Finder to the Terminal window.
MySQL –with-mysql=/usr/local/mysql/bin/mysql_config
NetCDF –with-netcdf=/usr/local
HDF 4 & 5 –with-hdf4=/usr/local –with-hdf5=/usr/local
OGDI –with-ogdi=/usr/local
CFITSIO –with-cfitsio=/usr/local
DAP –with-dods-root=/usr/local
ECW –with-ecw=/usr/local
Spatialite (with updated SQLite3) –with-spatialite=/usr/local –with-sqlite3=/usr/local,
and make sure to remove the other sqlite3 option

edit port/cpl_config.h

add at end:

#undef HOST_FILLORDER
#undef WORDS_BIGENDIAN
#ifdef __BIG_ENDIAN__
#define HOST_FILLORDER FILLORDER_MSB2LSB
#define WORDS_BIGENDIAN 1
#else
#define HOST_FILLORDER FILLORDER_LSB2MSB
#endif
#undef SIZEOF_LONG
#undef SIZEOF_UNSIGNED_LONG
#undef SIZEOF_VOIDP
#ifdef __LP64__
#define SIZEOF_LONG 8
#define SIZEOF_UNSIGNED_LONG 8
#define SIZEOF_VOIDP 8
#else
#define SIZEOF_LONG 4
#define SIZEOF_UNSIGNED_LONG 4
#define SIZEOF_VOIDP 4
#endif
#undef VSI_STAT64
#undef VSI_STAT64_T
#define VSI_STAT64 stat
#define VSI_STAT64_T stat

make & install

Then finish:

make
sudo make install

Tiger

configure

In the GDAL source:

export MACOSX_DEPLOYMENT_TARGET=10.4
export ARCHFLAGS="-arch ppc -arch i386 -arch ppc64 -arch x86_64"
./configure --with-threads --disable-static --without-grass --with-jasper=/usr/local \
--with-libtiff=/usr/local --with-jpeg=/usr/local --with-gif=/usr/local --with-png=/usr/local \
--with-geotiff=internal --with-sqlite3=/usr --with-odbc --with-pcraster=internal \
--with-geos=/usr/local/bin/geos-config --with-static-proj4=/usr/local --with-expat=/usr/local \
--with-curl --with-python --with-macosx-framework CFLAGS="-Os -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \
CXXFLAGS="-Os -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \
LDFLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk"

If you installed any of these optional packages, add to the configure line:

Xerces –with-xerces –with-xerces-inc=/usr/local/include –with-xerces-lib="-L/usr/local/lib -lxerces-c -framework CoreServices"
PostgreSQL –with-pg=/usr/local/pgsql/bin/pg_config
MrSID Geo DSDK –with-mrsid=
and drag the MrSID Geo DSDK folder from the Finder to the Terminal window.
MySQL –with-mysql=/usr/local/mysql/bin/mysql_config
NetCDF –with-netcdf=/usr/local
HDF 4 & 5 –with-hdf4=/usr/local –with-hdf5=/usr/local
OGDI –with-ogdi=/usr/local
CFITSIO –with-cfitsio=/usr/local
DAP –with-dods-root=/usr/local
ECW –with-ecw=/usr/local
Spatialite (with updated SQLite3) –with-spatialite=/usr/local –with-sqlite3=/usr/local,
and make sure to remove the other sqlite3 option

port/cpl_config.h

add at end:

HOST_FILLORDER line with:

#undef HOST_FILLORDER
#undef WORDS_BIGENDIAN
#ifdef __BIG_ENDIAN__
#define HOST_FILLORDER FILLORDER_MSB2LSB
#define WORDS_BIGENDIAN 1
#else
#define HOST_FILLORDER FILLORDER_LSB2MSB
#endif

make & install

Then finish:

make
sudo make install

Frameworks

To build using the frameworks, change the following options as given:

--with-jasper=/Library/Frameworks/UnixImageIO.framework/unix \
--with-libtiff=/Library/Frameworks/UnixImageIO.framework/unix \
--with-geotiff=/Library/Frameworks/UnixImageIO.framework/unix \
--with-jpeg=/Library/Frameworks/UnixImageIO.framework/unix \
--with-gif=/Library/Frameworks/UnixImageIO.framework/unix \
--with-png=/Library/Frameworks/UnixImageIO.framework/unix \
--with-sqlite3=/Library/Frameworks/SQLite3.framework/unix \
--with-spatialite=/Library/Frameworks/SQLite3.framework/unix \
--with-geos=/Library/Frameworks/GEOS.framework/Programs/geos-config \
--with-static-proj4=/Library/Frameworks/PROJ.framework/unix \

GRASS

GRASS support must be done as a plugin. This is so that GRASS itself (needed by the plugin) can be compiled after GDAL (needed by GRASS). :!: Note: starting with v6.4, GRASS is particular about its library versions. If you build the GDAL-GRASS plugin for GRASS 6.4, then install and run GRASS 6.5, GRASS will complain because GDAL is still using the GRASS 6.4 libraries.

So, first, install GRASS. The following instructions assume that GRASS is built as an application, with version x.y (ie 6.4).

Combine the files from the GDAL source dirs: frmts/grass and ogr/ogrsf_frmts/grass into a single folder, but leave out the GNUMakefile file. Download this custom Makefile and unzip it into the combined folder.

Now, in this merged gdal-grass folder:

Snow Leopard

make SYSSDK=snow GRASSPREFIX=/Applications/GRASS-6.4.app/Contents/MacOS

Leopard

make SYSSDK=leo GRASSPREFIX=/Applications/GRASS-6.4.app/Contents/MacOS

Tiger

make SYSSDK=tig GRASSPREFIX=/Applications/GRASS-6.4.app/Contents/MacOS

install

Manually copy the resulting gdal_GRASS.dylib and ogr_GRASS.dylib to the GDAL plugins dir. On a /usr/local install, this will be /usr/local/lib/gdalplugins. For a GDAL framework this is /Library/Application Support/GDAL/PlugIns/$(GDALVER).

macosx/build/gdal.txt · Last modified: 2010/09/02 20:09 by kyngchaos
[unknown link type]Back to top
Copyright © 2004-2011 William Kyngesburye Driven by DokuWiki Recent changes RSS feed