Skip to content

fix(windows): link LLVM's libomp from cvcpkg; drop the libomp140 exception - #607

Merged
transfix merged 1 commit into
masterfrom
fix/windows-libomp-from-cvcpkg
Oct 12, 2026
Merged

transfix merged 1 commit into
masterfrom
fix/windows-libomp-from-cvcpkg

Conversation

@transfix

@transfix transfix commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #587. It removes the Windows SDK's one temporary exception, the dependency on MSVC's non-redistributable libomp140.x86_64.dll.

cvcpkg now publishes everything this needs for windows/x86_64/release/shared (cy-pca/cvcpkg#146, #156, #164 and #166 merged and deployed; built by windows-build run https://github.com/cy-pca/cvcpkg/actions/runs/38189723443):

  • openmp 21.1.8+cvc.2
  • native gmp 6.3.0+cvc.10 and mpfr 4.2.1+cvc.6, which replace the vcpkg-built bundles. mingw-w64-runtime is added here for mpfr's libmcfgthread-2.dll.

Changes

  • OpenMP runtime on MSVC. cvc compiles with -openmp:llvm, because voxels.cpp needs OpenMP 3.0. It now links LLVM's libomp from cvcpkg's openmp bundle:
    • lib/libomp-llvm.lib by full path, plus /NODEFAULTLIB:libomp.lib and libompd.lib, through the build-local imported target LLVMOpenMP::omp;
    • cvc.dll then imports libomp.dll, which the SDK ships from that bundle through the whole-bundle rule;
    • without the bundle, cvc still builds, falls back to libomp140 and warns, so from-source builds elsewhere keep working.
  • Static consumers. A static cvc.lib exports $<LINK_ONLY:LLVMOpenMP::omp>, and cvcConfig.cmake.in recreates it from the package's own lib/libomp-llvm.lib with the same /NODEFAULTLIB flags.
  • Recipe. openmp and mingw-w64-runtime become Windows runtime deps.
  • Checks.
    • sdk-check-closure.sh now fails any SDK whose cvc imports libomp140, where it used to warn.
    • sdk-smoke-test.sh's Windows run uses only the SDK's bin/ and the Windows directories; Visual Studio's libomp140 is no longer on PATH.
    • The release.yml header and the top-level CMakeLists.txt comment are updated.

Validation

Rebased onto master (now including #591, #596 and #609). Dry run: https://github.com/transfix/libcvc/actions/runs/38192113286. All 17 jobs passed: 10 build lanes, 6 sdk-smoke legs and the release gate.

  • Windows deps. Both Windows lanes install openmp 21.1.8+cvc.2, gmp 6.3.0+cvc.10 and mpfr 4.2.1+cvc.6 from the catalog. cvc links libomp-llvm.lib.
  • Windows closure check: "Checked 31 libraries reachable from cvc.dll. All resolve inside …/bin or the base system." With libomp140 now an error, it passes.
  • Windows smoke test, shared. The consumer's loaded modules include sdk/bin/libomp.dll, and every non-OS module comes from the SDK's bin/. The archive is reported self-contained.
  • Windows smoke test, static. The link line takes sdk/lib/libomp-llvm.lib, and the consumer loads sdk/bin/libomp.dll.

My earlier expectations were partly wrong:

  • libgmp-10.dll, libmpfr-6.dll and libmcfgthread-2.dll do not appear in the loaded-modules list, because cvc.dll does not import them. They ship in bin/ as part of the whole-bundle install, for consumers that use gmp/mpfr directly.
  • VCOMP140.DLL, MSVC's own OpenMP runtime, does load. The loader resolves it from System32 on the runner, and something in the dependency closure imports it; ImageMagick's CORE_RL_* DLLs are the likely source. Unlike libomp140 it is part of the VC++ redistributable, and the SDK ships vcomp140.dll in bin/ with the rest of the MSVC runtime. A consumer process therefore has two OpenMP runtimes (LLVM's for cvc, MSVC's for that dependency). That was already the case before this PR.

A local configure on Linux generates the config correctly: CVC_USES_LLVM_OPENMP evaluates to FALSE there.

…ption

MSVC builds of cvc compile with -openmp:llvm (voxels.cpp needs OpenMP 3.0), so
cvc.dll imported libomp140.x86_64.dll, which Microsoft does not allow
redistributing. #587 shipped the Windows SDK with that as a documented,
temporary exception. This removes it:

- cvc links LLVM's own libomp from cvcpkg's `openmp` bundle (Windows build in
  cy-pca/cvcpkg#146): lib/libomp-llvm.lib by full path, plus
  /NODEFAULTLIB:libomp.lib and libompd.lib, through a build-local imported
  target LLVMOpenMP::omp. cvc.dll then imports libomp.dll, which the SDK ships
  from that bundle. Without the bundle, cvc still builds, falls back to
  libomp140 and warns at configure time.
- A STATIC cvc exports $<LINK_ONLY:LLVMOpenMP::omp>; cvcConfig.cmake.in
  recreates it from the package's lib/libomp-llvm.lib, so static consumers bind
  LLVM's libomp too.
- The recipe adds `openmp` and `mingw-w64-runtime` as Windows runtime deps.
  The latter supplies libmcfgthread-2.dll, which cvcpkg's native Windows mpfr
  (cy-pca/cvcpkg#156) needs.
- sdk-check-closure.sh now fails any SDK whose cvc imports libomp140, instead
  of warning. sdk-smoke-test.sh's Windows run no longer adds Visual Studio's
  libomp140 to PATH: the SDK's bin/ and the Windows directories only. The
  release.yml header and the top-level CMakeLists.txt comment are updated.
@transfix
transfix force-pushed the fix/windows-libomp-from-cvcpkg branch from bc886f6 to 2bde136 Compare October 12, 2026 00:54
@transfix
transfix marked this pull request as ready for review October 12, 2026 02:06
@transfix
transfix merged commit a5c65e5 into master Oct 12, 2026
43 of 45 checks passed
@transfix
transfix deleted the fix/windows-libomp-from-cvcpkg branch October 29, 2026 20:54
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