Skip to content

Add MinGW-w64 native Windows build support#230

Open
zleamy wants to merge 1 commit intokermitt2:masterfrom
zleamy:mingw-windows-build
Open

Add MinGW-w64 native Windows build support#230
zleamy wants to merge 1 commit intokermitt2:masterfrom
zleamy:mingw-windows-build

Conversation

@zleamy
Copy link
Copy Markdown

@zleamy zleamy commented Apr 12, 2026

Summary

Enables building pdfalto on Windows using MSYS2/MinGW-w64. Produces a native 64-bit Windows executable (3.9 MB) without any Cygwin dependency.

Changes

CMakeLists.txt

  • On MinGW: find system libraries via pkg-config (vendored .a files are Linux/Mac only)
  • Windows-specific link libraries: ole32, uuid, ws2_32 instead of dl/pthread
  • Conditional include directories to avoid mixing vendored + system headers

src/XmlAltoOutputDev.cc

  • Replaced using namespace std; with explicit using declarations for the 17 types actually used
  • Resolves std::byte conflict between GCC 15 C++17 and Windows SDK rpcndr.h

Companion PR

GROBID Java fixes at grobidOrg/grobid#1424

🤖 Generated with Claude Code

Enables building pdfalto on Windows with MSYS2/MinGW-w64, producing
a native PE64 executable without Cygwin dependency. Two files changed:

CMakeLists.txt:
  - MinGW: use system libraries via pkg-config instead of vendored
    static .a files (which are only built for Linux/Mac)
  - Windows link libraries: ole32, uuid, ws2_32 (replacing dl/pthread)
  - Conditional include directories: MinGW uses system headers for
    libxml2/ICU/freetype; vendored xpdf headers still used

src/XmlAltoOutputDev.cc:
  - Replaced "using namespace std;" with explicit using declarations
    (17 types) to resolve std::byte conflict between GCC 15's C++17
    std::byte enum and Windows SDK's byte typedef in rpcndr.h

Build instructions:
  pacman -S mingw-w64-x86_64-{gcc,cmake,libxml2,zlib,libpng,freetype,icu,make}
  mkdir build && cd build
  cmake .. -G "MinGW Makefiles" -DNO_FONTCONFIG=ON
  mingw32-make -j4

Tested: 3.9 MB PE64 binary, processes PDFs correctly with GROBID.

All changes extensively commented for novice developers.
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