Restore Windows support: native pdfalto build + Java process fixes - #1424
Open
zleamy wants to merge 1 commit into
Open
Restore Windows support: native pdfalto build + Java process fixes#1424zleamy wants to merge 1 commit into
zleamy wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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/--ulimitflags (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
Build instructions for pdfalto on Windows
See companion PR at kermitt2/pdfalto for the CMakeLists.txt changes.
🤖 Generated with Claude Code