Some possibly useful notes... I use bazel for a restricted build. Here are a few key files/directories that I've found to be in surprising places that are hard or impossible to go without:
frmts/gtiff/ frmts/hfa/hfa_overviews.cpp frmts/iso8211/ frmts/mem/memdataset.cpp frmts/pds/nasakeywordhandler.cpp frmts/raw/rawdataset.cpp frmts/vrt/ ogr/ogrsf_frmts/generic/ ogr/ogrsf_frmts/geojson/ ogr/ogrsf_frmts/gml/ ogr/ogrsf_frmts/mem/ ogr/ogrsf_frmts/mitab/ (except mitab_ogr*) ogr/ogrsf_frmts/vrt/ ogr/ogrsf_frmts/xplane/ogr_xplane_geo_utils.cpp The gtiff, mem (raster and vector), and vrt (raster and vector) directories aren't really surprising after you see that it's hard to do a lot of things without them as helpers. If you look in the format registration code, you will see there are a lot of drivers that depend on others. I also add these cpp defines for my non-autoconf setup: -DWITHOUT_CPLDEBUG -DDISABLE_CVSID -DGDAL_NO_AUTOLOAD At one point, I had a autoconf configure setup that was pretty minimal. While it built, it was not so much fun to work with. Here are some remnants of notes that might constitute the beginnings of a sourceme-minimal.sh. More will likely be needed depending on libs are already installed on your machine. And gdal without many of these libs (e.g. proj4, geos, libz/zlib) is just frustrating. Maybe we need a section to https://trac.osgeo.org/gdal/wiki/BuildingOnUnixWithMinimizedDrivers that is a stab at what the mimumum to build is without respect to if it's actually useful for anything beyond testing purposes. e.g. I have a build target that is just a subset of port that I use with the autotest2 port tests. It makes linking and analysis go a lot faster when you don't have anything beyond port in the build. And it's been a long time since I've tried the optimize for size flag in gcc or llvm (-g0 -Os)... -kurt #!/bin/bash echo "Totally untested." echo "See ./configure --help | egrep 'enable|disable|yes|no|with' " GDAL_OPTS="" # Languages GDAL_OPTS="$GDAL_OPTS --without-python" # Compilation options GDAL_OPTS="$GDAL_OPTS --without-avx" GDAL_OPTS="$GDAL_OPTS --without-sse" # --without-pam # Library options GDAL_OPTS="$GDAL_OPTS --with-cryptopp=no" GDAL_OPTS="$GDAL_OPTS --without-curl" GDAL_OPTS="$GDAL_OPTS --without-expat" GDAL_OPTS="$GDAL_OPTS --without-geos" GDAL_OPTS="$GDAL_OPTS --with-odbc=no" GDAL_OPTS="$GDAL_OPTS --without-odbc" GDAL_OPTS="$GDAL_OPTS --without-pcre" GDAL_OPTS="$GDAL_OPTS --without-qhull" GDAL_OPTS="$GDAL_OPTS --without-sqlite3" # You're not going to want to do this if you want gpkg! GDAL_OPTS="$GDAL_OPTS --with-xerces=no" GDAL_OPTS="$GDAL_OPTS --without-xml2" GDAL_OPTS="$GDAL_OPTS --with-libz=no" GDAL_OPTS="$GDAL_OPTS --with-liblzma=no" # Driver options # TODO: Put lots of driver withouts here. # TODO: Disable debugging and define NDEBUG # TODO: Disable alg and apps that you don't use echo ./configure $GDAL_OPTS ./configure $GDAL_OPTS On Thu, Mar 30, 2017 at 3:06 AM, Dmitry Baryshnikov <bishop....@gmail.com> wrote: > Hi Gane, > > You can try to use Cmake build of GDAL (https://github.com/nextgis- > borsch/lib_gdal). > > It can be configured via CMake-gui or command line. > > This is an example of minimal static build of GDAL - > https://github.com/nextgis/nextgis_datastore/blob/master/ > cmake/extlib.cmake#L94-L175 > > Best regards, > Dmitry > > 29.03.17 12:17, Gane R пишет: > > Hi all, > > I am looking for building gdal with minimal set of drivers like gdal with > geotiff, jpg, png and sqlite gpkg > > so it should do basic warp geotiff and work with geopkg raster. I don't > need OGR part I need the core, alg and raster tif, gpkg, jpg and png alone > is enought. > the problem is I get a fat static lib. I want to reduce its size. > > I tried to follow the post https://trac.osgeo.org/gdal/wiki/ > BuildingOnUnixWithMinimizedDrivers It seems it is old. > > When I build i get error during building the apps like gdalinfo, gdalwarp > .... > > Any suggestions > > my ogr/ogrsf_frmts/GNUmakefile is > like > > include ../../GDALmake.opt > > SUBDIRS-yes := \ > generic rec shape > > SUBDIRS-$(HAVE_DODS) += dods > SUBDIRS-$(HAVE_DWGDIRECT) += dxfdwg > SUBDIRS-$(HAVE_FME) += fme > SUBDIRS-$(HAVE_GRASS) += grass > SUBDIRS-$(HAVE_IDB) += idb > > I get the following error > > /home/user/home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference > to `TABINDFile::~TABINDFile()' > /home/user/home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference > to `TABINDFile::FindNext(int, unsigned char*)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `gdal_json_object_object_add' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `TABINDFile::Open(char const, char const, int)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `OGRMemLayer::CreateField(OGRFieldDefn*, int)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `gdal_json_object_to_file' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `MITABSpatialRef2CoordSys(OGRSpatialReference*)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `gdal_json_tokener_free' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `gdal_json_object_new_int64' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `gdal_json_object_get_string' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `OGRMemLayer::GetFeatureCount(int)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `TABINDFile::BuildKey(int, int)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `gdal_json_object_array_add' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `gdal_json_object_new_object' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `OGRXPlane_ExtendPosition(double, double, double, double, double*, > double*)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `OGRMemLayer::SetNextByIndex(long long)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `OGRMemLayer::CreateGeomField(OGRGeomFieldDefn*, int)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `OGRMemLayer::ResetReading()' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `OGRMemLayer::ICreateFeature(OGRFeature*)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `OGRXPlane_Distance(double, double, double, double)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `TABINDFile::AddEntry(int, unsigned char*, int)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `gdal_json_object_put' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `json_object_new_double_with_precision' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `OGRMemLayer::TestCapability(char const*)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `OGRMemLayer::DeleteFeature(long long)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `gdal_json_object_new_int' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `TABINDFile::Close()' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `gdal_json_object_get_type' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `OGRMemLayer::GetNextFeature()' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `OGRMemLayer::OGRMemLayer(char const, OGRSpatialReference, > OGRwkbGeometryType)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `TABINDFile::BuildKey(int, char const*)' > /home/user/x64/gdal-2.1.0/.libs/libgdal.so: undefined reference to > `gdal_json_object_from_file' > > Thanks > Gane > > > _______________________________________________ > gdal-dev mailing > listgdal-dev@lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/gdal-dev > > > > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/gdal-dev > -- -- http://schwehr.org
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev