[gdal-dev] Alpine Docker build with ODBC support
andrew.murdoch.dev at gmail.com
andrew.murdoch.dev at gmail.com
Mon Feb 8 22:31:49 PST 2021
I just want to be sure that I'm on the right track to getting ODBC support
into a GDAL docker alpine build.
Starting from the Dockerfiles found here:
https://github.com/OSGeo/gdal/tree/master/gdal/docker
I've attempted to modify the alpine-normal linux Dockerfile to build with
ODBC support, but I'm not succeeding.
At this line in the alpine-normal Dockerfile:
https://github.com/OSGeo/gdal/blob/b3582884ea42456766d978dceee8e1ce048504bc/gdal/docker/alpine-normal/Dockerfile#L32
I've added a reference to "unixodbc-dev", but this does not seem to be a
supported/expected ODBC library for GDAL?
I've also added the configure flags for odbc support at this line:
https://github.com/OSGeo/gdal/blob/b3582884ea42456766d978dceee8e1ce048504bc/gdal/docker/alpine-normal/Dockerfile#L326
There I added the flag for:
--with-odbc \
The docker build proceeds and completes but when I try to run gdalinfo
--formats (or any other gdalinfo command), I get the errors below:
Error loading shared library libodbc.so.2: No such file or directory (needed
by /usr/lib/libgdal.so)
Error loading shared library libodbcinst.so.2: No such file or directory
(needed by /usr/lib/libgdal.so)
Error relocating /usr/lib/libgdal.so: SQLFetchScroll: symbol not found
Error relocating /usr/lib/libgdal.so: SQLRowCount: symbol not found
Error relocating /usr/lib/libgdal.so: SQLSetConnectOption: symbol not found
Error relocating /usr/lib/libgdal.so: SQLColAttribute: symbol not found
Error relocating /usr/lib/libgdal.so: SQLGetData: symbol not found
Error relocating /usr/lib/libgdal.so: SQLInstallDriverEx: symbol not found
Error relocating /usr/lib/libgdal.so: SQLNumResultCols: symbol not found
Error relocating /usr/lib/libgdal.so: SQLFreeStmt: symbol not found
Error relocating /usr/lib/libgdal.so: SQLBindParameter: symbol not found
Error relocating /usr/lib/libgdal.so: SQLFetch: symbol not found
Error relocating /usr/lib/libgdal.so: SQLDriverConnect: symbol not found
Error relocating /usr/lib/libgdal.so: SQLGetDiagRec: symbol not found
Error relocating /usr/lib/libgdal.so: SQLConnect: symbol not found
Error relocating /usr/lib/libgdal.so: SQLTables: symbol not found
Error relocating /usr/lib/libgdal.so: SQLDescribeCol: symbol not found
Error relocating /usr/lib/libgdal.so: SQLRemoveDriver: symbol not found
Error relocating /usr/lib/libgdal.so: SQLSetConnectAttr: symbol not found
Error relocating /usr/lib/libgdal.so: SQLDrivers: symbol not found
Error relocating /usr/lib/libgdal.so: SQLEndTran: symbol not found
Error relocating /usr/lib/libgdal.so: SQLAllocEnv: symbol not found
Error relocating /usr/lib/libgdal.so: SQLFreeConnect: symbol not found
Error relocating /usr/lib/libgdal.so: SQLFreeEnv: symbol not found
Error relocating /usr/lib/libgdal.so: SQLAllocStmt: symbol not found
Error relocating /usr/lib/libgdal.so: SQLExecDirect: symbol not found
Error relocating /usr/lib/libgdal.so: SQLDisconnect: symbol not found
Error relocating /usr/lib/libgdal.so: SQLColumns: symbol not found
Error relocating /usr/lib/libgdal.so: SQLInstallerError: symbol not found
Error relocating /usr/lib/libgdal.so: SQLPrimaryKeys: symbol not found
Error relocating /usr/lib/libgdal.so: SQLAllocConnect: symbol not found
Error relocating /usr/lib/libgdal.so: SQLGetConnectAttr: symbol not found
Looking deeper, it seems that GDAL is expecting/detecting an ODBC driver
named "odbc" not "unixodbc-dev"?
In what _looks_ like the main GDAL build configuration script here:
https://github.com/OSGeo/gdal/blob/633cfd90334ab604ad46c1cbcf36f083b27e49ab/gdal/configure.ac#L4082
it appears that the only default library is named "odbc"?
AC_CHECK_LIB(odbc,SQLConnect,[ODBC_LIBS="-lodbc -lodbcinst"])
so, it looks like in the configure step, I would need to pass an explicit
path for the ODBC driver library (similar to how the Dockerfile builds
custom libraries from source for geos, netcdf, and others?)
Is there a better way to get ODBC support inside of an alpine Docker
container?
Should I instead consider using the Microsoft ODBC drivers here?
https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#alpine17
In the configure step ("--with-odbc"), what would the explicit path to ODBC
library look like for an example supported ODBC library (unixodbc,
msodbcsql17_17, etc.)?
Thanks!
Andrew
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
More information about the gdal-dev
mailing list