<div dir="ltr"><div>Some possibly useful notes...</div><div><br></div><div>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:<br></div><div><br></div><div>frmts/gtiff/<br></div><div>frmts/hfa/hfa_overviews.cpp<br></div><div>frmts/iso8211/<br></div><div>frmts/mem/memdataset.cpp<br></div><div>frmts/pds/nasakeywordhandler.cpp<br></div><div>frmts/raw/rawdataset.cpp<br></div><div>frmts/vrt/<br></div><div>ogr/ogrsf_frmts/generic/<br></div><div>ogr/ogrsf_frmts/geojson/<br></div><div>ogr/ogrsf_frmts/gml/<br></div><div>ogr/ogrsf_frmts/mem/<br></div><div>ogr/ogrsf_frmts/mitab/ (except mitab_ogr*)<br></div><div>ogr/ogrsf_frmts/vrt/<br></div><div>ogr/ogrsf_frmts/xplane/ogr_xplane_geo_utils.cpp<br></div><div><br></div><div>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.</div><div><br></div><div><div>I also add these cpp defines for my non-autoconf setup:</div><div><br></div><div>-DWITHOUT_CPLDEBUG</div><div>-DDISABLE_CVSID</div><div>-DGDAL_NO_AUTOLOAD</div></div><div><br></div><div>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.</div><div><br></div><div>Maybe we need a section to <a href="https://trac.osgeo.org/gdal/wiki/BuildingOnUnixWithMinimizedDrivers">https://trac.osgeo.org/gdal/wiki/BuildingOnUnixWithMinimizedDrivers</a> 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.</div><div><br></div><div>And it's been a long time since I've tried the optimize for size flag in gcc or llvm (-g0 -Os)...</div><div><br></div><div>-kurt</div><div><br></div><div><br></div><div>#!/bin/bash</div><div><br></div><div>echo "Totally untested."</div><div>echo "See ./configure --help | egrep 'enable|disable|yes|no|with'  "</div><div><br></div><div>GDAL_OPTS=""<br></div><div><br></div><div><div># Languages</div><div>GDAL_OPTS="$GDAL_OPTS --without-python"</div><div><br></div><div># Compilation options</div><div>GDAL_OPTS="$GDAL_OPTS --without-avx"</div><div>GDAL_OPTS="$GDAL_OPTS --without-sse"</div><div><br></div><div># --without-pam<br></div><div><br></div><div># Library options</div><div>GDAL_OPTS="$GDAL_OPTS --with-cryptopp=no"</div><div>GDAL_OPTS="$GDAL_OPTS --without-curl"<br></div><div>GDAL_OPTS="$GDAL_OPTS --without-expat"</div><div>GDAL_OPTS="$GDAL_OPTS --without-geos"</div><div>GDAL_OPTS="$GDAL_OPTS --with-odbc=no"</div><div>GDAL_OPTS="$GDAL_OPTS --without-odbc"</div><div>GDAL_OPTS="$GDAL_OPTS --without-pcre"</div><div>GDAL_OPTS="$GDAL_OPTS --without-qhull"</div><div>GDAL_OPTS="$GDAL_OPTS --without-sqlite3"  # You're not going to want to do this if you want gpkg!</div><div>GDAL_OPTS="$GDAL_OPTS --with-xerces=no"<br></div><div>GDAL_OPTS="$GDAL_OPTS --without-xml2"</div></div><div>GDAL_OPTS="$GDAL_OPTS --with-libz=no"<br></div><div>GDAL_OPTS="$GDAL_OPTS --with-liblzma=no"</div><div><br></div><div># Driver options</div><div><br></div><div># TODO: Put lots of driver withouts here.</div><div><br></div><div># TODO: Disable debugging and define NDEBUG</div><div><br></div><div># TODO: Disable alg and apps that you don't use</div><div><br></div><div>echo ./configure $GDAL_OPTS</div><div>./configure $GDAL_OPTS<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 30, 2017 at 3:06 AM, Dmitry Baryshnikov <span dir="ltr"><<a href="mailto:bishop.dev@gmail.com" target="_blank">bishop.dev@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <p>Hi Gane,</p>
    <p>You can try to use Cmake build of GDAL
      (<a class="m_-4367192936162328055moz-txt-link-freetext" href="https://github.com/nextgis-borsch/lib_gdal" target="_blank">https://github.com/nextgis-<wbr>borsch/lib_gdal</a>). <br>
    </p>
    <p>It can be configured via CMake-gui or command line.</p>
    <p>This is an example of minimal static build of GDAL -
<a class="m_-4367192936162328055moz-txt-link-freetext" href="https://github.com/nextgis/nextgis_datastore/blob/master/cmake/extlib.cmake#L94-L175" target="_blank">https://github.com/nextgis/<wbr>nextgis_datastore/blob/master/<wbr>cmake/extlib.cmake#L94-L175</a><br>
    </p>
    <pre class="m_-4367192936162328055moz-signature" cols="72">Best regards,
    Dmitry</pre>
    <div class="m_-4367192936162328055moz-cite-prefix">29.03.17 12:17, Gane R пишет:<br>
    </div>
    <blockquote type="cite"><div><div class="h5">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Hi all,<br>
                <br>
              </div>
              I am looking for building gdal with minimal set of drivers
              like gdal with geotiff, jpg, png and sqlite gpkg<br>
              <br>
            </div>
            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.<br>
          </div>
          the problem is I get a fat static lib. I want to reduce its
          size.<br>
          <br>
          I tried to follow the post <a href="https://trac.osgeo.org/gdal/wiki/BuildingOnUnixWithMinimizedDrivers" target="_blank">https://trac.osgeo.org/gdal/<wbr>wiki/<wbr>BuildingOnUnixWithMinimizedDri<wbr>vers</a>
          It seems it is old.<br>
          <br>
        </div>
        <div>When I build i get error during building the apps like
          gdalinfo, gdalwarp ....<br>
          <br>
        </div>
        Any suggestions <br>
        <div><br>
          my ogr/ogrsf_frmts/GNUmakefile  is <br>
        </div>
        <div>like <br>
          <br>
          include ../../GDALmake.opt<br>
          <br>
          SUBDIRS-yes    := \<br>
              generic rec shape<br>
          <br>
          SUBDIRS-$(HAVE_DODS)    += dods<br>
          SUBDIRS-$(HAVE_DWGDIRECT) += dxfdwg<br>
          SUBDIRS-$(HAVE_FME)    += fme<br>
          SUBDIRS-$(HAVE_GRASS)    += grass<br>
          SUBDIRS-$(HAVE_IDB)    += idb<br>
          <br>
        </div>
        <div>I get the following error<br>
          <br>
          /home/user/home/user/x64/gdal-<wbr>2.1.0/.libs/libgdal.so:
          undefined reference to `TABINDFile::~TABINDFile()'<br>
          /home/user/home/user/x64/gdal-<wbr>2.1.0/.libs/libgdal.so:
          undefined reference to `TABINDFile::FindNext(int, unsigned
          char*)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `gdal_json_object_object_add'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `TABINDFile::Open(char const, char const, int)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `OGRMemLayer::CreateField(<wbr>OGRFieldDefn*, int)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `gdal_json_object_to_file'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `MITABSpatialRef2CoordSys(<wbr>OGRSpatialReference*)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `gdal_json_tokener_free'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `gdal_json_object_new_int64'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `gdal_json_object_get_string'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `OGRMemLayer::GetFeatureCount(<wbr>int)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `TABINDFile::BuildKey(int, int)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `gdal_json_object_array_add'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `gdal_json_object_new_object'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `OGRXPlane_ExtendPosition(<wbr>double, double, double,
          double, double*, double*)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `OGRMemLayer::SetNextByIndex(<wbr>long long)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `OGRMemLayer::CreateGeomField(<wbr>OGRGeomFieldDefn*,
          int)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `OGRMemLayer::ResetReading()'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `OGRMemLayer::ICreateFeature(<wbr>OGRFeature*)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `OGRXPlane_Distance(double, double, double,
          double)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `TABINDFile::AddEntry(int, unsigned char*, int)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `gdal_json_object_put'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `json_object_new_double_with_<wbr>precision'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `OGRMemLayer::TestCapability(<wbr>char const*)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `OGRMemLayer::DeleteFeature(<wbr>long long)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `gdal_json_object_new_int'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `TABINDFile::Close()'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `gdal_json_object_get_type'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `OGRMemLayer::GetNextFeature()<wbr>'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `OGRMemLayer::OGRMemLayer(char const,
          OGRSpatialReference, OGRwkbGeometryType)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `TABINDFile::BuildKey(int, char const*)'<br>
          /home/user/x64/gdal-2.1.0/.<wbr>libs/libgdal.so: undefined
          reference to `gdal_json_object_from_file'<br>
          <br>
        </div>
        <div>Thanks<br>
        </div>
        <div>Gane<br>
        </div>
      </div>
      <br>
      <fieldset class="m_-4367192936162328055mimeAttachmentHeader"></fieldset>
      <br>
      </div></div><span class=""><pre>______________________________<wbr>_________________
gdal-dev mailing list
<a class="m_-4367192936162328055moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a class="m_-4367192936162328055moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/gdal-dev</a></pre>
    </span></blockquote>
    <br>
  </div>

<br>______________________________<wbr>_________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--<div><a href="http://schwehr.org" target="_blank">http://schwehr.org</a></div></div>
</div>