Skip to content

fix(gdal): disable PDF driver (podofo DllMain failure), restore HDF5/NetCDF, gate bundles on loadability - #23

Merged
jimbrig merged 8 commits into
mainfrom
develop
Jul 4, 2026
Merged

jimbrig merged 8 commits into
mainfrom
develop

Conversation

@jimbrig

@jimbrig jimbrig commented Jul 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Fixes the e2e-blocking ERROR_DLL_INIT_FAILED (1114): the MSYS2 libpodofo.dll (PDF driver backend) fails DllMain-time OpenSSL initialization against the MSYS2 libcrypto-3-x64.dll in any process, making every published libgdal-*.dll unloadable on machines without Rtools' UCRT64 tree. The PDF driver is now disabled outright (GDAL_ENABLE_DRIVER_PDF=OFF + poppler/podofo/pdfium backends off). Disabling only poppler (PR fix: disable HDF5/NetCDF/Poppler in GDAL build to resolve DLL init failure in R #22) was insufficient — the driver falls back to podofo.
  • Restores HDF5/NetCDF: PR fix: disable HDF5/NetCDF/Poppler in GDAL build to resolve DLL init failure in R #22's OpenBLAS/Fortran/Rtools-conflict theory was disproven empirically (all 175 DLLs of the published bundle were loaded individually inside R 4.6.1 — only libpodofo.dll fails).
  • Adds a loadability gate: build.yml now LoadLibrary-tests every bundled DLL in a plain process before anything is published — the failure class that shipped in June/July is undetectable by import-closure checks alone. collect_dlls.sh additionally bans PDF/NSS-chain DLLs from libgdal's import tree.
  • Docs: new dev/docs/00-the-full-picture.md (design-decision narrative) and dev/docs/08-windows-dll-abi-deep-dive.md (Windows DLL loading / C++ ABI reference); troubleshooting vignette + dev notes gain an error-1114 section with a sweep-load diagnostic; architecture vignette documents the PDF-driver exclusion.

Validation (local, Rtools45 UCRT64)

  • Full GDAL 3.13.1 build with the new flags: PDF driver in cmake "disabled features", poppler/podofo detected-but-disabled, HDF5/NetCDF building
  • collect_dlls.sh: closed 162-DLL bundle (13 fewer than broken published bundle — no podofo/poppler/NSS)
  • Sweep-load of all 162 DLLs in R 4.6.1: 0 failures; libgdal-39.dll loads in a clean process with minimal PATH
  • install_gdalraster() against the local bundle: compiles, installs, gdal_global_reg_names() returns all 8 entries, CRS/raster smoke checks pass

Test plan

  • Local end-to-end validation (above)
  • Smoke e2e on clean runner against locally built asset (smoke-gdal-v3.13.1 prerelease, run in progress)
  • After merge: dispatch Build GDAL (Windows) to rebuild + republish gdal-v3.13.1 (cache auto-busts via script hash); release publish auto-triggers e2e against the CI-built asset
  • Delete the smoke-gdal-v3.13.1 prerelease after the CI asset verifies

Copilot AI and others added 3 commits July 3, 2026 22:06
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."
…r-hook

fix: disable HDF5/NetCDF/Poppler in GDAL build to resolve DLL init failure in R
@jimbrig jimbrig self-assigned this Jul 4, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates tools/build_gdal.sh to disable HDF5, NetCDF, and Poppler in the GDAL build configuration. These changes prevent DLL initialization failures on Windows environments caused by mismatched OpenBLAS/Fortran/OpenMP dependencies and Mozilla NSS/NSPR initialization issues. I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

jimbrig and others added 3 commits July 3, 2026 20:57
…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>
…update troubleshooting and toolchain notes for the 1114 failure class

Co-authored-by: Cursor <cursoragent@cursor.com>
…reference material under dev/archive (local-only)

Co-authored-by: Cursor <cursoragent@cursor.com>
@jimbrig
jimbrig requested a review from Copilot July 4, 2026 01:02
@jimbrig jimbrig changed the title Develop fix(gdal): disable PDF driver (podofo DllMain failure), restore HDF5/NetCDF, gate bundles on loadability Jul 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR resolves a bundle-wide LoadLibrary failure (A dynamic link library (DLL) initialization routine failed, Windows error 1114) that made published GDAL runtime bundles unloadable on machines without Rtools' UCRT64 tree. The root cause was MSYS2's libpodofo.dll (a PDF-driver backend) failing its DllMain-time OpenSSL initialization against the MSYS2 libcrypto. The fix disables the PDF driver at the build level and adds new verification layers so a broken bundle cannot be published again. The remainder of the PR is an extensive documentation refresh capturing the diagnosis, the Windows DLL/ABI mechanics, and the failure history.

Changes:

  • Disable the GDAL PDF driver (GDAL_ENABLE_DRIVER_PDF=OFF plus GDAL_USE_POPPLER/PODOFO/PDFIUM=OFF) in build_gdal.sh, remove poppler from the MSYS2 install list, and re-enable/confirm HDF5+NetCDF.
  • Add a banned-dependency guard in collect_dlls.sh and a LoadLibrary smoke-test gate in build.yml so DllMain failures and PDF/NSS backends are caught before publishing.
  • Add/expand maintainer documentation and user-facing troubleshooting/architecture notes; delete two obsolete dev/docs/reference/ scratch files and adjust .gitignore/archive tracking.

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/build_gdal.sh Adds PDF-driver-off cmake flags with detailed rationale; reorders HDF5/NetCDF flags (no functional change).
tools/collect_dlls.sh Adds a banned-dependency (podofo/poppler/NSS) guard that fails the build if libgdal links a known-broken backend.
.github/workflows/build.yml Adds LoadLibrary smoke-test step; removes poppler from and reorders the MSYS2 package list; updates summary table.
vignettes/troubleshooting.qmd New section explaining error 1114 vs 126 and a DLL sweep-load diagnostic snippet.
vignettes/architecture.qmd Documents the PDF-driver-off build flag.
NEWS.md Notes the 1114 fix, HDF5/NetCDF re-enable, and 3-layer verification.
dev/docs/* New 00-the-full-picture.md, 08-windows-dll-abi-deep-dive.md; updates to README/05/06 deep-dive references.
dev/docs/reference/* (deleted) Removes two non-normative Perplexity/reference scratch documents.
.gitignore, .build/*, dev/archive/.gitignore Track .build/ scaffolding; scope docs ignore to /docs/; keep archive dir tracked but contents ignored.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

jimbrig and others added 2 commits July 3, 2026 21:09
…estored, loadability gate)

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@jimbrig
jimbrig merged commit 64d7d31 into main Jul 4, 2026
@devactivity-app

Copy link
Copy Markdown

Pull Request Summary by devActivity

Metrics

Cycle Time: 2h 29m Coding Time: 2h 13m Review Time: 15m

Achievements

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.

3 participants