Skip to content

Restore Windows support: native pdfalto build + Java process fixes - #1424

Open
zleamy wants to merge 1 commit into
grobidOrg:masterfrom
zleamy:windows-support
Open

Restore Windows support: native pdfalto build + Java process fixes#1424
zleamy wants to merge 1 commit into
grobidOrg:masterfrom
zleamy:windows-support

Conversation

@zleamy

@zleamy zleamy commented Apr 12, 2026

Copy link
Copy Markdown

Summary

  • Restores Windows support that was previously available but broke
  • Native MinGW-w64 pdfalto binary replaces broken Cygwin binaries
  • Java process spawning fixes for DLL discovery on Windows
  • All changes extensively commented for novice developers

Changes

build.gradle

Added Os.isFamily(Os.FAMILY_WINDOWS) branches at both JEP library path checks. Without these, Windows builds crash with "Unsupported platform!" before anything starts.

DocumentSource.java

On Windows, skip server-mode --timeout/--ulimit flags (Unix-only POSIX concepts). Falls through to thread mode which uses Java's own timeout mechanism.

ProcessPdfToXml.java + ProcessRunner.java

On Windows, add pdfalto's parent directory to the child process PATH so MinGW runtime DLLs are found by Windows' DLL search.

pdfalto binaries (win-64/)

Replaced old Cygwin-compiled binaries with native MinGW-w64 build. The old 64-bit pdfalto.exe was v0.1 (missing required flags); the old 32-bit pdftoxml.exe couldn't be spawned by Java's 64-bit ProcessBuilder.

Testing

  • Windows 11 Pro, OpenJDK 21, GROBID 0.9.1-SNAPSHOT
  • 18/25 PDFs processed successfully (CRF models)
  • 4/25 produced high-quality metadata extraction (title, multiple authors, year)
  • 7/25 failed on scanned PDFs without text layer (expected, same as Linux)

Build instructions for pdfalto on Windows

See companion PR at kermitt2/pdfalto for the CMakeLists.txt changes.

🤖 Generated with Claude Code

GROBID's README notes "We cannot ensure currently support for
Windows as we did before (help welcome!)." This commit restores
Windows support with three changes:

1. build.gradle: Added Os.isFamily(Os.FAMILY_WINDOWS) branches at
   both JEP library path resolution points. Windows uses semicolons
   (not colons) as path separators and backslashes for directories.

2. DocumentSource.java: On Windows, skip server-mode --timeout and
   --ulimit flags (Unix-only POSIX concepts). Fall through to thread
   mode which uses Java's own timeout mechanism and works on all OS.

3. ProcessPdfToXml.java + ProcessRunner.java: On Windows, add the
   pdfalto executable's parent directory to the child process PATH
   so MinGW runtime DLLs (shipped alongside pdfalto.exe) are found.

The pre-built pdfalto binaries in win-64/ are replaced with a native
MinGW-w64 build (3.9 MB PE64, no Cygwin dependency). The old Cygwin
binaries could not be spawned by Java's 64-bit ProcessBuilder.

All code changes are extensively commented for novice developers.

Tested on Windows 11 with OpenJDK 21, GROBID 0.9.1-SNAPSHOT.
18/25 PDFs processed successfully with CRF models.

Co-developed-by: ScienciaLAB
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.

1 participant