Skip to content

fix: portable Windows native and CUDA builds - #3

Draft
bitnom wants to merge 4 commits into
masterfrom
windows-fixes
Draft

fix: portable Windows native and CUDA builds#3
bitnom wants to merge 4 commits into
masterfrom
windows-fixes

Conversation

@bitnom

@bitnom bitnom commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Draft replacement for the Windows build fixes.

Changes:

  • Link advapi32 for ggml CPU registry detection.
  • Link only the Windows CUDA import libraries required by llama.cpp (cudart, cublas, and cuda).
  • Select the CUDA import-library directory for x64 or ARM64 targets.
  • Normalize Windows drive and UNC paths for MSVC include handling.
  • Add focused build-support tests.
  • Add Ubuntu and Windows CPU CI.

This remains a draft until native Windows/MSVC and CUDA validation is available.

smanaton and others added 4 commits July 17, 2026 18:52
Three build-script fixes, each a hard build failure on Windows:

- canonicalize_llama_cpp_dir returned \?\-prefixed verbatim paths, which
  cl.exe cannot resolve in -I include dirs (fatal error C1083 on
  ggml-backend.h). Strip the verbatim prefix after canonicalizing.
- The target_os link-lib match had no windows arm; ggml-cpu's CPU detection
  calls RegOpenKeyExA/RegQueryValueExA/RegCloseKey, leaving three unresolved
  __imp_Reg* externals at link time. Link advapi32.
- emit_cuda_link_flags was Linux-only and its lib set (cudart_static/culibos/
  dl/rt/pthread) is Unix-specific, so --features cuda compiled every kernel
  then failed to link. Add a Windows variant emitting the cudart/cublas/
  cublasLt/cuda import libs plus the lib\x64 search path, which
  cuda_library_dir misses when the bare lib parent exists.

Validated on Windows 11 (MSVC 14.51, CUDA 12.2, RTX 4090) against mainline
llama.cpp b10054: CPU and CUDA builds link and run; CPU vs GPU eval results
on Bonsai-27B-Q1_0 are identical.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
canonicalize() can return \\?\UNC\server\share\...; stripping only \\?\ left
a relative UNC\... path. Map that form to \\server\share\... and plain
\\?\C:\... to C:\... so MSVC/CMake include paths stay absolute.
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