Skip to content

fix: disable HDF5/NetCDF/Poppler in GDAL build to resolve DLL init failure in R - #22

Merged
jimbrig merged 2 commits into
developfrom
copilot/fix-e2e-runtime-gdalraster-hook
Jul 3, 2026
Merged

jimbrig merged 2 commits into
developfrom
copilot/fix-e2e-runtime-gdalraster-hook

Conversation

Copilot AI commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

The e2e CI job "E2E: runtime + gdalraster + hook" fails with ERROR_DLL_INIT_FAILED (Windows 1114) when libgdal-*.dll is loaded inside an R session.

Root cause: Windows' loaded-module list rule — once R loads Rblas.dll at startup (Rtools45), its libgfortran-5.dll/libgomp-1.dll/libquadmath-0.dll are pinned in the process. The GDAL bundle's HDF5 driver chain (libhdf5 → libsuperlu → libopenblas → libgfortran/libgomp) then receives the already-loaded Rtools copies at DllMain time. When Rtools45 and the MSYS2 UCRT64 build environment use different GCC versions, libopenblas.DllMain returns FALSE → the error propagates up to libgdal itself. Poppler poses a secondary risk via its NSS/NSPR dependency.

Changes

tools/build_gdal.sh

  • Adds -DGDAL_USE_HDF5=OFF, -DGDAL_USE_NETCDF=OFF, -DGDAL_USE_POPPLER=OFF to the cmake configure, eliminating the OpenBLAS/Fortran/OpenMP and NSS/NSPR dependency chains from the bundle entirely
  • Expands the "Key build decisions" comment with a full explanation of the Rtools/MSYS2 GCC version conflict mechanism

.github/workflows/build.yml

  • Removes hdf5, netcdf, poppler from the MSYS2 explicit package install list
  • Adds a comment block documenting these as intentionally omitted
  • Adds three rows to the release body table (HDF5=OFF, NETCDF=OFF, POPPLER=OFF) with rationale

The build cache key hashes build_gdal.sh, so the next workflow run automatically triggers a full rebuild producing a clean bundle. The e2e workflow auto-triggers when the new release is published.

Manual step required after merge: push a new gdal-v* tag to trigger the bundle build.

ROOT CAUSE: ERROR_DLL_INIT_FAILED (Windows error 1114) when loading
libgdal-*.dll in an R session. The HDF5 driver's dependency chain
(libhdf5 → libsuperlu → libopenblas → libgfortran-5/libgomp-1/libquadmath-0)
conflicts with Rtools45's copies of these same DLLs already loaded by R at
startup. Windows' loaded-module list rule reuses the Rtools copy of
libgfortran/libgomp for all subsequent DLL loads, regardless of what is
in the bundle's bin/. When Rtools45 GCC and MSYS2 UCRT64 GCC versions
diverge, libopenblas DllMain returns FALSE → ERROR_DLL_INIT_FAILED.

FIX: Set GDAL_USE_HDF5=OFF, GDAL_USE_NETCDF=OFF, GDAL_USE_POPPLER=OFF in
cmake configure. Remove corresponding MSYS2 packages from the explicit
install list. Update comments and release body table to document the
rationale. The build cache key (hashing build_gdal.sh) auto-busts on
this change so the next workflow run produces a fresh bundle."
Copilot AI changed the title [WIP] Fix failing GitHub Actions job E2E: runtime + gdalraster + hook fix: disable HDF5/NetCDF/Poppler in GDAL build to resolve DLL init failure in R Jul 3, 2026
Copilot AI requested a review from jimbrig July 3, 2026 22:36
@jimbrig
jimbrig marked this pull request as ready for review July 3, 2026 22:41
@jimbrig
jimbrig changed the base branch from main to develop July 3, 2026 22:42
@jimbrig
jimbrig merged commit f6e54fa into develop Jul 3, 2026
5 checks passed
@devactivity-app

Copy link
Copy Markdown

Pull Request Summary by devActivity

Metrics

Cycle Time: 36m

Achievements

Copilot stopped work on behalf of jimbrig due to an error July 3, 2026 23:03
@jimbrig
jimbrig deleted the copilot/fix-e2e-runtime-gdalraster-hook branch July 4, 2026 00:54
jimbrig added a commit that referenced this pull request Jul 4, 2026
…etCDF; gate bundles on loadability

Root cause of the e2e ERROR_DLL_INIT_FAILED (1114): MSYS2's libpodofo.dll
runs OpenSSL initialization in its static initializers (DllMain, under the
loader lock) and fails against the MSYS2-built libcrypto-3-x64.dll - in any
process. libgdal imports libpodofo directly when the PDF driver is built,
making libgdal-*.dll itself unloadable. Disabling only GDAL_USE_POPPLER is
insufficient (the driver falls back to podofo), so the driver is off
entirely: GDAL_ENABLE_DRIVER_PDF=OFF + POPPLER/PODOFO/PDFIUM=OFF.

The earlier HDF5/OpenBLAS/Rtools-conflict theory (PR #22) was disproven by
loading all 175 published-bundle DLLs individually inside R 4.6.1 - only
libpodofo fails - so GDAL_USE_HDF5/NETCDF are ON again.

Verification now has three layers so this class of breakage can never
publish again: ntldd closure + banned-DLL guard (collect_dlls.sh),
LoadLibrary smoke test over every bundled DLL (build.yml step 7b), and the
e2e workflow on release publish.

Validated locally end to end in Rtools45 UCRT64: full 3.13.1 build with the
new flags, 162-DLL closed bundle (no podofo/poppler/NSS), 0 load failures,
gdalraster source-built against it, algorithm registry returns all 8 names.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants