[gdal-dev] Alpine Docker build with ODBC support

andrew.murdoch.dev at gmail.com andrew.murdoch.dev at gmail.com
Tue Feb 9 09:31:36 PST 2021


Mateusz,
Thanks for the suggestion!

I tried again and I believe that this novice GDAL builder has now figured it
out!
I only needed to make changes to two places in the alpine-normal-latest
Dockerfile to enable ODBC support

For posterity, this is what I changed:

I altered the GDAL build environment libraries (installed using "apk") here
and added the dev version of the unixodbc library:

# For PROJ and GDAL
ARG POPPLER_DEV=poppler-dev
RUN apk add --no-cache \
    linux-headers \
    curl-dev tiff-dev \
    zlib-dev zstd-dev \
    libjpeg-turbo-dev libpng-dev openjpeg-dev libwebp-dev expat-dev \
    py3-numpy-dev python3-dev py3-numpy \
    ${POPPLER_DEV} postgresql-dev \
    *# Added this for ODBC support:*
    *unixodbc-dev \    *
    openexr-dev libheif-dev xerces-c-dev geos-dev cfitsio-dev \
    # For spatialite (and GDAL)
    libxml2-dev \
    && mkdir -p /build_thirdparty/usr/lib

And further down I added the non-dev version of the unixodbc library for the
final alpine docker build:

ARG POPPLER=poppler
RUN apk add --no-cache \
        libstdc++ \
        sqlite-libs \
        libcurl tiff \
        zlib zstd-libs\
        libjpeg-turbo libpng libwebp expat \
        icu-libs \
        python3 py3-numpy ${POPPLER} pcre libpq libxml2 portablexdr openjpeg
\
        openexr libheif xerces-c geos cfitsio minizip \
       * # Added this for ODBC/MSSQLSpatial support*
       * unixodbc \*
    # Remove /usr/lib/libopenjp2.so.2.3.0 since we are building v2.3.1
manually
    # && rm -f /usr/lib/libopenjp2.so.2.3.0 \
    # libturbojpeg.so is not used by GDAL. Only libjpeg.so*
    && rm -f /usr/lib/libturbojpeg.so* \
    # libpoppler-cpp.so is not used by GDAL. Only libpoppler.so*
    && rm -f /usr/lib/libpoppler-cpp.so* \
    # Only libwebp.so is used by GDAL
    && rm -f /usr/lib/libwebpmux.so* /usr/lib/libwebpdemux.so*
/usr/lib/libwebpdecoder.so* \
    && ln -s /usr/bin/python3 /usr/bin/python

I didn't actually _need_ to use the "--with-odbc" argument/flag at all, as I
wasn't changing the default library name (the unixodbc library actually
installs into /usr/lib/ as the expected name "libodbc.so" that GDAL needs to
find.)

Thanks for your assistance!
Andrew




--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list