Skip to content

fix: enable MinGW/GCC build on Windows - #312

Merged
PeterStaar-IBM merged 2 commits into
docling-project:mainfrom
yonikremer:fix/windows-mingw-build
Aug 8, 2026
Merged

fix: enable MinGW/GCC build on Windows#312
PeterStaar-IBM merged 2 commits into
docling-project:mainfrom
yonikremer:fix/windows-mingw-build

Conversation

@yonikremer

Copy link
Copy Markdown
Contributor

Enables building with GCC 16.1 (MSYS2 MinGW64) on Windows.

Changes (5 files, independent of memory fix):

  • CMakeLists.txt: /bigobj for MSVC (large object files hit limit without it)
  • local_build.py: force -DCMAKE_BUILD_TYPE=Release (ensures /O2 + release CRT via --config Release)
  • cmake/extlib_lcms2.cmake: build lcms2 via vendored CMakeLists.txt on all Windows (was MSVC-only, else autotools). Autotools requires sh/make and fails under Ninja/MinGW on Windows ('.\configure' is not recognized). Produces lcms2.lib (MSVC) or liblcms2.a (MinGW).
  • src/third_party/pdfium_jbig2/core/fxcrt/fx_memory_wrappers.h: allow std::is_class in FxPartitionAllocAllocator (GCC 16 strictness)
  • src/third_party/pdfium_jbig2/core/fxcrt/immediate_crash.h: __debugbreak() instead of asm volatile("int3"/"ud2") for non-ARM64 (MSVC rejects inline asm, Clang-Cl/GCC warn)

Verified:

PATH="/c/msys64/mingw64/bin:$PATH" ZLIB_ROOT=C:/msys64/mingw64   CC=C:/msys64/mingw64/bin/gcc.exe CXX=C:/msys64/mingw64/bin/g++.exe   CMAKE_GENERATOR=Ninja .venv/Scripts/python.exe local_build.py
# → pdf_parsers.cp312-win_amd64.pyd + zlib1.dll
.venv/Scripts/python.exe -m pytest tests/test_parse.py -q # 21 passed
.venv/Scripts/python.exe -m pytest -q # 111 passed, 1 pre-existing path-separator failure

Independent of the page_cells memory PR — can be reviewed/merged separately.

🤖 Generated with Claude Code

- CMakeLists.txt: add /bigobj for MSVC to handle large object files
- local_build.py: force Release build type (ensures /O2 and release CRT)
- cmake/extlib_lcms2.cmake: build lcms2 via vendored CMake on all
  Windows (MSVC and MinGW) instead of autotools; autotools requires
  sh/make which fails under Ninja/MinGW on Windows
- src/third_party/pdfium_jbig2: allow std::is_class types in
  FxPartitionAllocAllocator and use __debugbreak() instead of
  inline asm (int3/ud2) which MSVC/Clang-Cl reject and GCC 16
  warns on

Allows building with GCC 16.1 at C:/msys64/mingw64/bin via
  PATH=/c/msys64/mingw64/bin:$PATH ZLIB_ROOT=C:/msys64/mingw64   CC=gcc CXX=g++ CMAKE_GENERATOR=Ninja python local_build.py

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

DCO Check Passed

Thanks @yonikremer, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

I, yoni kremer <yoni.kremer@gmail.com>, hereby add my Signed-off-by to this commit: 154575e

Signed-off-by: yoni kremer <yoni.kremer@gmail.com>

@PeterStaar-IBM PeterStaar-IBM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

@PeterStaar-IBM
PeterStaar-IBM merged commit 83e50c5 into docling-project:main Aug 8, 2026
36 checks passed
@yonikremer
yonikremer deleted the fix/windows-mingw-build branch August 8, 2026 06:01
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