From a50966634375282b9d7b91cc5471450798fa3db3 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 14 May 2017 05:11:49 +0200 Subject: [PATCH] gdal: add sqlite3 and expat dependencies (#605) --- projects/gdal/Dockerfile | 10 +++++++++- projects/gdal/build.sh | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/projects/gdal/Dockerfile b/projects/gdal/Dockerfile index 12ac3f477..8a64338a3 100644 --- a/projects/gdal/Dockerfile +++ b/projects/gdal/Dockerfile @@ -16,9 +16,17 @@ FROM gcr.io/oss-fuzz-base/base-builder MAINTAINER even.rouault@spatialys.com -RUN apt-get update && apt-get install -y make autoconf automake libtool g++ +# curl needed to fetch sqlite3 +# tcl needed to build sqlite3 +# docbook2x needed o build expat +RUN apt-get update && apt-get install -y make autoconf automake libtool g++ curl tcl docbook2x # libpng12-dev libjpeg-dev libgif-dev liblzma-dev libgeos-dev libcurl4-gnutls-dev libproj-dev libxml2-dev libexpat-dev libxerces-c-dev libnetcdf-dev netcdf-bin libpoppler-dev libspatialite-dev libhdf4-alt-dev libhdf5-serial-dev poppler-utils libfreexl-dev unixodbc-dev libwebp-dev libepsilon-dev libpcre3-dev # libpodofo-dev libcrypto++-dev RUN git clone --depth 1 https://github.com/OSGeo/gdal gdal +RUN git clone --depth 1 https://github.com/libexpat/libexpat gdal/libexpat +RUN mkdir gdal/sqlite3 && \ + cd gdal/sqlite3 && \ + curl 'https://www.sqlite.org/src/tarball?uuid=trunk' -o sqlite3.tar.gz && \ + tar xzf sqlite3.tar.gz WORKDIR gdal COPY build.sh $SRC/ diff --git a/projects/gdal/build.sh b/projects/gdal/build.sh index 726b2eda1..6b49c73b9 100755 --- a/projects/gdal/build.sh +++ b/projects/gdal/build.sh @@ -15,10 +15,42 @@ # ################################################################################ -# build project +# build expat +cd libexpat/expat +./buildconf.sh +./configure --disable-shared --prefix=$SRC/install +make clean -s +make -j$(nproc) -s +make install +cd ../.. + +# build sqlite3 +# Taken from https://github.com/google/oss-fuzz/blob/master/projects/sqlite3/build.sh + +export ASAN_OPTIONS=detect_leaks=0 + +# Limit max length of data blobs and sql queries to prevent irrelevant OOMs. +# Also limit max memory page count to avoid creating large databases. +OLD_CFLAGS=$CFLAGS +export CFLAGS="$CFLAGS -DSQLITE_MAX_LENGTH=128000000 \ + -DSQLITE_MAX_SQL_LENGTH=128000000 \ + -DSQLITE_MAX_MEMORY=25000000 \ + -DSQLITE_PRINTF_PRECISION_LIMIT=1048576 \ + -DSQLITE_DEBUG=1 \ + -DSQLITE_MAX_PAGE_COUNT=16384" + +cd sqlite3 +./configure --disable-shared --prefix=$SRC/install +make clean -s +make -j$(nproc) -s +make install +cd .. +export CFLAGS=$OLD_CFLAGS + +# build gdal cd gdal export LDFLAGS=${CXXFLAGS} -./configure --without-libtool +./configure --without-libtool --with-expat=$SRC/install --with-sqlite3=$SRC/install make clean -s make -j$(nproc) -s