Skip to content

fix(libcurl): build the curl backend from a checkout path with spaces on Windows - #20120

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
lenny370:fix/libcurl-backend-rc-include-spaces
Nov 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
lenny370:fix/libcurl-backend-rc-include-spaces

Conversation

@lenny370

Copy link
Copy Markdown
Contributor

What

The full Windows build fails when the checkout path contains a space, for example under a Windows user folder whose name has one. It stops in the bundled curl backend at lib/CMakeFiles/libcurl.dir/libcurl.rc.obj:

cc1.exe: fatal error: <rest of the path after the space>/3rdparty/curl/include: No such file or directory
compilation terminated.
windres.exe: preprocessing failed.

GNU windres hands its include directories to the preprocessor unquoted, so each -I that contains a space splits into two arguments. Reduced outside the build with WinLibs binutils 2.46: windres -O coff -I "<dir with a space>" libcurl.rc out.obj fails the same way with -I, --include-dir=, --preprocessor-arg=-I... and --use-temp-file; a -D value or a source path with a space is accepted, and the same command without -I succeeds.

libcurl.rc includes only <winver.h> and "../include/curl/curlver.h", which resolves relative to the file, so it needs no include directory. On MinGW the curl backend now gets a resource rule without <INCLUDES>, through CMAKE_PROJECT_INCLUDE of the ExternalProject. Nothing changes for Linux or macOS, and the 3rdparty/curl submodule is untouched.

Tested

Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 r7 (x86_64-ucrt-posix-seh, binutils 2.46), CMake 4.3.1, Ninja, Release, BUILD_TESTING=ON, checkout under a path with a space.

  • main a20547ffb7: cmake --build build stops at libcurl.rc.obj with the error above, once per include directory.
  • This branch on main 32a2f1e1d7: with libcurl.rc.obj and libcurl.a deleted, cmake --build build --target libcurl rebuilds the backend (Building RC object lib/CMakeFiles/libcurl.dir/libcurl.rc.obj succeeds), and ctest --test-dir build -R "^guest_curl" passes 10 of 10.
  • The whole build (cmake --build build) completes with this change merged with fix(tests): set the upload cache test's environment with _putenv_s on Windows #19899, which fixes an unrelated setenv compile error on Windows.
  • python3 tools/check_conventions.py --base origin/main passes; python3 tools/pr_overlap.py --branch reports no conflicting open pull request (feat(libcurl): implement curl_m[v]fprintf and curl_m[v]printf #18468 could not be compared automatically; it changes the add_library and test-topic lines, not these).

Not tested: MSYS2 UCRT64, and a checkout path without a space on this change (the rule no longer depends on the path).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

… on Windows

GNU windres hands its include directories to the preprocessor unquoted, so
an include directory that contains a space splits into two arguments and the
bundled curl's libcurl.rc fails with "No such file or directory" for every
-I. libcurl.rc includes only <winver.h> and "../include/curl/curlver.h",
which resolves relative to the file, so on MinGW the curl backend's resource
rule now omits the include directories.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@JJenkx

JJenkx commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 533e96bf68, merged onto main 87d51b0307 (5cf7b45d8b, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_curl, guest_curl_strings pass in 3 of 3 runs, none skipped.

AI-assisted: yes.

@oneandonlydean
oneandonlydean merged commit f8058c9 into boykopovar:main Nov 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants