[Gdal-dev] Any possibility of static compile?

Eric Dönges eric.doenges at gmx.net
Tue Dec 5 01:50:05 EST 2006


Am 04.12.2006 um 20:35 schrieb Curt, WE7U:

> On Mon, 4 Dec 2006, Collins, Benjamin wrote:
>
>> I have had success on Win32, Linux, and OSX (PPC + Intel)
>
> I've linked against libgdal.a but I get 10's or 100's of link errors
> about missing OGR functions.  Are you using any of the vector OGR
> functions or only the raster GDAL functions?  We're pretty much only
> using the OGR functions from the library.

This is how I link GDAL statically on MacOS X:

1. Configure proj4 for static linking:

./configure --prefix=$(INSTALL) --disable-shared

( $INSTALL is just a local directory where I store the static builds )

2. Build and install proj4

3. Configure gdal for static linking:

./configure --prefix=$(INSTALL) \
             --with-png=internal --with-libtiff=internal \
             --with-geotiff=internal --with-jpeg=internal \
             --with-gif=internal \
             --with-static-proj4=$(INSTALL) \
             --without-jasper \
             --without-python --without-ld-shared --without-libtool

Since I use custom BSB reading code that depends on some MacOS  
frameworks, I then run a
perl script on GDALmake.opt to add those dependencies.

4. Build and install gdal

5. Link against libgdal.a

My application does use some OGR functionality to do coordinate  
transforms, but
doesn't read any vector formats, so YMMV.

With kind regards,
Eric






More information about the Gdal-dev mailing list