Skip to content
14 changes: 11 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ jobs:
# muparser — Algorithmic API (gdal_global_reg_names fix)
# pkgconf — pkg-config shim used by cmake find-modules
# ntldd — walk PE import tree to find transitive DLL deps
#
# Intentionally omitted (see build_gdal.sh Key build decisions):
# hdf5 — pulls in libopenblas/libgfortran/libgomp which conflict with
# Rtools DLLs in the R process (ERROR_DLL_INIT_FAILED).
# GDAL_USE_HDF5=OFF in cmake configure.
# netcdf — depends on hdf5; same issue. GDAL_USE_NETCDF=OFF.
# poppler — pulls in NSS/NSPR which can fail DllMain on restricted
# Windows environments. GDAL_USE_POPPLER=OFF.
- name: Setup MSYS2 UCRT64
id: msys2
uses: msys2/setup-msys2@v2
Expand All @@ -220,11 +228,8 @@ jobs:
mingw-w64-ucrt-x86_64-zlib
mingw-w64-ucrt-x86_64-muparser
mingw-w64-ucrt-x86_64-arrow
mingw-w64-ucrt-x86_64-hdf5
mingw-w64-ucrt-x86_64-netcdf
mingw-w64-ucrt-x86_64-geos
mingw-w64-ucrt-x86_64-libspatialite
mingw-w64-ucrt-x86_64-poppler
mingw-w64-ucrt-x86_64-openjpeg2
mingw-w64-ucrt-x86_64-libwebp
mingw-w64-ucrt-x86_64-libjxl
Expand Down Expand Up @@ -375,6 +380,9 @@ jobs:
| `GDAL_HIDE_INTERNAL_SYMBOLS` | `ON` | Cleaner export table |
| `--kill-at` | (linker) | Correct stdcall symbol decoration for MinGW DLLs |
| Static GCC/stdc++/winpthread | (linker) | No Rtools or MSYS2 required at runtime |
| `GDAL_USE_HDF5` | `OFF` | Eliminates libopenblas/libgfortran/libgomp chain that conflicts with Rtools DLLs already loaded by R (ERROR_DLL_INIT_FAILED) |
| `GDAL_USE_NETCDF` | `OFF` | NetCDF depends on HDF5; disabled for the same reason |
| `GDAL_USE_POPPLER` | `OFF` | Poppler links NSS/NSPR which can fail DllMain initialization on restricted Windows environments |

### Runtime bundle asset
Download:
Expand Down
20 changes: 18 additions & 2 deletions tools/build_gdal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@
# OS-provided DLL and breaks LoadLibrary on end-user machines that don't
# have that driver installed. The MSSQLSpatial driver falls back to the
# generic ODBC32-based path (same as the MSYS2 gdal package).
# - GDAL_USE_HDF5=OFF, GDAL_USE_NETCDF=OFF — HDF5 (and its dependent
# NetCDF) pulls in libopenblas → libgfortran-5/libgomp-1/libquadmath-0.
# R on Windows (Rtools45) already loads its own versions of libgfortran
# and libgomp at process startup. Windows' "loaded-module list" rule means
# these Rtools copies are reused by any subsequently loaded DLL, even when
# a different version lives in the bundle's bin/. When the Rtools and MSYS2
# versions diverge (e.g. GCC 14 vs GCC 15 snapshot) the mismatched
# libopenblas DllMain returns FALSE → ERROR_DLL_INIT_FAILED (1114) for
# libgdal itself. Disabling HDF5/NetCDF eliminates the entire
# OpenBLAS/Fortran/OpenMP dependency chain from the bundle.
# - GDAL_USE_POPPLER=OFF — Poppler links against Mozilla NSS/NSPR
# (libnspr4/nss3/nssutil3) which perform process-wide initialization on
# load. On locked-down Windows environments this can also produce
# ERROR_DLL_INIT_FAILED. PDF driver support is rarely needed in R spatial
# workflows, so disabling it is a safe trade-off.
# =============================================================================
set -euo pipefail

Expand Down Expand Up @@ -75,12 +90,13 @@ cmake -B build -G Ninja \
-DGDAL_USE_MUPARSER=ON \
-DGDAL_USE_ARROW=ON \
-DGDAL_USE_PARQUET=ON \
-DGDAL_USE_HDF5=ON \
-DGDAL_USE_NETCDF=ON \
-DGDAL_USE_GEOS=ON \
-DGDAL_USE_SPATIALITE=ON \
-DGDAL_HIDE_INTERNAL_SYMBOLS=ON \
\
-DGDAL_USE_HDF5=OFF \
-DGDAL_USE_NETCDF=OFF \
-DGDAL_USE_POPPLER=OFF \
-DGDAL_USE_MSSQL_ODBC=OFF \
-DGDAL_USE_MSSQL_NCLI=OFF \
\
Expand Down
Loading