Skip to content

Fix Arrow/Parquet debug build on Windows: add 'd' suffix and build deps in debug mode#183

Open
Copilot wants to merge 2 commits intomasterfrom
copilot/build-arrow-parquet-debug-suffix
Open

Fix Arrow/Parquet debug build on Windows: add 'd' suffix and build deps in debug mode#183
Copilot wants to merge 2 commits intomasterfrom
copilot/build-arrow-parquet-debug-suffix

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

Summary

Fixes issue #182. On Windows (MSVC), the Arrow and Parquet static libraries and their bundled dependencies (Snappy, zstd, Thrift, xsimd, RapidJSON) were not properly built in debug mode, causing _ITERATOR_DEBUG_LEVEL mismatch linker errors when consuming them in a Debug build of OpenMS.

Root Causes

  1. Arrow/Parquet own libs (arrow_static.lib, parquet_static.lib, etc.) — built in both Debug and Release, but with the same filename → only one survives in lib/. Fix: add CMAKE_DEBUG_POSTFIX=d.

  2. Bundled ExternalProject dependencies (arrow_bundled_dependencies.lib / Snappy, zstd, Thrift, etc.) — Arrow's build system derives ARROW_EP_BUILD_TYPE from CMAKE_BUILD_TYPE. With the MSVC multi-config generator and no CMAKE_BUILD_TYPE set, Arrow defaulted these to Release → compiled with /MD (Release CRT), causing _ITERATOR_DEBUG_LEVEL=0 vs 2 mismatch when linked into a Debug binary. Fix: two separate build directories with CMAKE_BUILD_TYPE=Debug / Release set explicitly.

  3. arrow_bundled_dependencies.lib — this merged static library is installed via install(FILES ...) rather than as a regular CMake library target, so it ignores CMAKE_DEBUG_POSTFIX automatically. Fix: rename to arrow_bundled_dependenciesd.lib after the Debug install, and patch ArrowConfig.cmake.in so the installed ArrowConfig.cmake references the correct variant per configuration.

Changes (libraries.cmake/arrow.cmake, MSVC section only)

  • Separate Debug / Release build directories (build_debug, build_release inside the Arrow source tree). Each is configured with a different CMAKE_BUILD_TYPE, ensuring bundled deps inherit the correct MSVC runtime flag (/MDd / /MD).
  • -DCMAKE_DEBUG_POSTFIX=d added to both configurations → arrow_staticd.lib, parquet_staticd.lib, etc.
  • Rename arrow_bundled_dependencies.libarrow_bundled_dependenciesd.lib immediately after the Debug install step.
  • Patch ArrowConfig.cmake.in (two targeted single-line replacements) before building so the generated ArrowConfig.cmake sets Arrow::arrow_bundled_dependencies's IMPORTED_LOCATION_DEBUG to the d-suffixed file and IMPORTED_LOCATION_RELEASE to the normal one.
  • Safety-net fix for ArrowTargets.cmake / ParquetTargets.cmake: if the Release build's umbrella file omits the debug config include (only needed on CMake < 3.22; modern CMake uses a GLOB), the missing include is appended.

Notes

  • Linux/macOS path is unchanged (Release-only build, no debug suffix needed there).
  • Two separate build directories mean bundled dependencies are compiled and downloaded twice (once Debug, once Release). This is intentional and necessary to get correct CRT linkage.

… in debug mode

Agent-Logs-Url: https://github.com/OpenMS/contrib/sessions/a2d6b120-1740-4f2c-8552-e9b32c506848

Co-authored-by: jpfeuffer <8102638+jpfeuffer@users.noreply.github.com>
…rs during OpenMS configure time: 'The imported target Arrow::arrow_static references the file /lib/arrow_staticd.lib but this file does not exist. '
@cbielow
Copy link
Copy Markdown
Contributor

cbielow commented Apr 30, 2026

This version now works for me.

@jpfeuffer jpfeuffer marked this pull request as ready for review April 30, 2026 21:23
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