Repository navigation
build(win): pin pkg-config to the cvcpkg prefixes, unbreaking libcvc-cuda on Windows - #310
Merged
Merged
Conversation
…cuda on Windows
Every CUDA translation unit failed on the self-hosted Windows CUDA runner with
~100 errors each, all inside MSYS2 headers:
C:/msys64/mingw64/include/corecrt.h(159): error : identifier "__UINTPTR_TYPE__" is undefined
C:/msys64/mingw64/include/stdlib.h(274): error : expected a "{"
The nvcc command line carried -IC:\msys64\mingw64\bin\..\include\libpng16 and
-IC:\msys64\mingw64\bin\..\include, so MinGW's <stdlib.h>/<corecrt.h> shadowed
the MSVC CRT and nvcc's EDG frontend — which predefines neither GCC's nor
MinGW's macros — collapsed.
Where they came from: when find_package(ImageMagick) fails on Windows, the
cvcpkg-prefix fallback sets ImageMagick_FOUND with raw library paths and creates
no imported targets, which enables the _im_dep_ delegate loop. That loop calls
pkg_check_modules() with nothing scoping the search path. A box with MSYS2
installed has C:\msys64\mingw64\bin on PATH, so find_package(PkgConfig) picks up
MSYS2's pkg-config.exe and it searches MSYS2's own .pc tree; libpng resolves
there, and PkgConfig::_im_dep_libpng's INTERFACE_INCLUDE_DIRECTORIES land on
cvc's own compiles — .cu files included. The loop's own comment already claimed
to "probe pkg-config against the SAME prefix"; nothing enforced it.
PKG_CONFIG_LIBDIR is now pinned to CMAKE_PREFIX_PATH's pkgconfig dirs on WIN32
before the first find_package(PkgConfig). It REPLACES pkg-config's built-in
default (PKG_CONFIG_PATH only prepends), so the MSYS2 tree becomes unreachable,
and it covers all four probe sites rather than the one that happened to fail.
Also adds an MSVC-only configure-time guard that rejects any MinGW include
directory on the cvc target. This class of failure has no good symptom — it
surfaces as a wall of errors inside system headers with nothing naming the
cause — so it is worth failing early with a message that says what to fix.
Not a compiler difference: the ordinary Windows lane is green only because the
GitHub-hosted windows-2022 image has no MSYS2 pkg-config on PATH, so every
delegate falls through to find_library. Had cl.exe been handed these flags it
would very likely have broken too.
Windows-only by construction, so the green Linux/macOS/wasm lanes cannot regress
— and the delegate loop does not run there anyway (stock FindImageMagick
supplies the imported targets). Verified locally: Linux reconfigures clean, no
pin applied, ImageMagick still found, nav_material_test 19/19.
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.
libcvc-cudaon Windows has been failing to build. Every CUDA translation unit —drive.cu,coef_train.cu,material_rollout.cu,coef_energy_net.cu,material_train.cu,voxels_kernels.cu— dies with ~100 errors each, all inside MSYS2 headers:The nvcc line carried
-IC:\msys64\mingw64\bin\..\include\libpng16and-IC:\msys64\mingw64\bin\..\include, so MinGW's<stdlib.h>/<corecrt.h>shadowed the MSVC CRT and nvcc's EDG frontend — which predefines neither GCC's nor MinGW's macros — collapsed.Where those flags came from
When
find_package(ImageMagick)fails on Windows, the cvcpkg-prefix fallback setsImageMagick_FOUNDwith raw library paths and no imported targets, which is exactly the condition that enables the_im_dep_delegate loop. That loop callspkg_check_modules()with nothing scoping the search path. A box with MSYS2 installed hasC:\msys64\mingw64\binon PATH, sofind_package(PkgConfig)picks up MSYS2'spkg-config.exe, which searches MSYS2's own.pctree;libpngresolves there, andPkgConfig::_im_dep_libpng'sINTERFACE_INCLUDE_DIRECTORIESland oncvc's own compiles —.cufiles included.The loop's own comment already claims to "probe pkg-config against the SAME prefix". Nothing enforced it.
The fix
PKG_CONFIG_LIBDIRis pinned toCMAKE_PREFIX_PATH's pkgconfig dirs onWIN32, before the firstfind_package(PkgConfig). It replaces pkg-config's built-in default (PKG_CONFIG_PATHonly prepends), so the MSYS2 tree becomes unreachable — and it covers all four probe sites, not just the one that happened to bite.Plus an MSVC-only configure-time guard rejecting any MinGW include directory on the
cvctarget. This class of failure has no good symptom — a wall of errors inside system headers, nothing naming the cause — so it's worth failing early with a message that says what to fix.Why the ordinary Windows lane was green
Not a compiler difference — a runner difference.
build-cuda-windowsruns on[self-hosted, windows, cuda]; the plain lane runs on GitHub-hostedwindows-2022, which has no MSYS2pkg-configon PATH, so every delegate falls through tofind_library. Hadcl.exebeen handed these flags it would very likely have broken too — so the fix acts on discovery, not on nvcc.History
This lane has been green exactly once (2026-08-05, run 30974275698) and for the wrong reason:
CVC_ENABLE_IMAGEMAGICKwas OFF, so the block was skipped entirely. The regression landed 2026-08-28 (#251 broadened the ImageMagick fallback; #252 added the delegate loop gated on precisely that path). It stayed invisible for days becausepublish_cudadefaults to'false'on aworkflow_dispatch, so the job was skipped in every intervening run — thev3.3.0tag push was the first to force it on.Risk
WIN32/MSVC-gated by construction, so the green Linux/macOS/wasm lanes cannot regress — and the delegate loop doesn't run there anyway (stockFindImageMagicksupplies the imported targets). Worst case on the CUDA box: a delegate stops resolving via pkg-config and falls through tofind_library, which is exactly what the already-green Windows lane does today.Verified locally: Linux reconfigures clean, no pin applied, ImageMagick still found,
nav_material_test19/19.