[Gdal-dev] Any possibility of static compile?

Collins, Benjamin collinsb at mitre.org
Mon Dec 4 14:21:13 EST 2006


>From my experience with the Java bindings, this is also possible with
the SWIG bindings.  For Java this means stand-alone JNI libraries that
include GDAL statically linked internally.  It can be achieved in much
the same way; by linking against libgdal.a

I have had success on Win32, Linux, and OSX (PPC + Intel)
--
Ben 

>-----Original Message-----
>From: gdal-dev-bounces at lists.maptools.org 
>[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of 
>Frank Warmerdam
>Sent: Monday, December 04, 2006 12:46 PM
>To: Curt Mills
>Cc: gdal-dev at lists.maptools.org
>Subject: Re: [Gdal-dev] Any possibility of static compile?
>
>Curt Mills wrote:
>> I need to do a static compile of my app.  I've been able to compile
>> Shapelib, proj, geotiff, and a few other libraries statically so
>> far.
>> 
>> I'd like to get GDAL compiled in, of which we use some of the OGR
>> functions, but I recall reading earlier about some problems with
>> static compiles of GDAL.  Is there a way to get OGR or the full
>> GDAL/OGR library compiled statically these days?
>> 
>> There's also a way under Linux Standard Base rules to distribute a
>> shared library along with the application, so that's my backup plan.
>> I'd much rather distribute the entire thing statically linked if
>> possible though.  Any hope?
>
>Curt,
>
>John pointed out some of the issues.  For what it is worth, I was able
>to issue the following command against my local GDAL build:
>
>
>  gcc -Ibld/include gdal/apps/gdalinfo.c gdal/libgdal.a 
>-L/usr/local/lib -lgeos 
>-lgeos_c -L/usr/local/lib -lxerces-c -lpthread -lNCSEcw 
>-lNCSCnet -lNCSUtil 
>-L/home/warmerda/pkg/HDF4.2r1/NewHDF/lib -lmfhdf -ldf -ljpeg 
>-ltiff -lpng -lpq 
>-L/usr/lib/postgresql/8.0/lib -lpq -lz -lpthread -lm -lrt -ldl 
>-L/home/warmerda/pkg/kakadu-5.1/lib -lkdu -lsqlite3 -L/usr/lib 
>-lcurl -lidn 
>-lssl -lcrypto -ldl -lssl -lcrypto -ldl -lz -L/usr/lib 
>-lmysqlclient -lz 
>-lcrypt -lnsl -lm -o gdalinfo
>
>This produced a gdalinfo executable with GDAL statically 
>linked in, though
>the various support libraries were still .so's.  I did this by 
>configuring
>GDAL "--without-libtool" and then linking against 
>gdal/libgdal.a.  Essentially
>I took the build's "gdal-config --libs" output replaced the 
>part about -lgdal
>itself with the path to libgdal.a, and used the rest unchanged.
>
>So, one data point says static builds are doable.
>
>Best regards,
>-- 
>---------------------------------------+-----------------------
>---------------
>I set the clouds in motion - turn up   | Frank Warmerdam, 
>warmerdam at pobox.com
>light and sound - activate the windows | http://pobox.com/~warmerdam
>and watch the world go round - Rush    | President OSGeo, 
>http://osgeo.org
>
>_______________________________________________
>Gdal-dev mailing list
>Gdal-dev at lists.maptools.org
>http://lists.maptools.org/mailman/listinfo/gdal-dev
>




More information about the Gdal-dev mailing list