Files
jak-project/third-party/curl/docs/wcurl.md
T
Alexander J. Semenuk 5d5e35fb9b fix: Windows toolchain compatibility (curl 8.21 re-vendor, endless reconfigure loop) (#4355)
## Problem

Windows builds break with a current local toolchain (Scoop LLVM 22.1.8,
CMake 4.4.0, VS 2026), in two independent ways:

1. The build stops at curl's deliberate guard: `#error "no non-blocking
method was found/used/set"` in `third-party/curl/lib/nonblock.c`.
2. From the second configure onward, `cmake --build` re-runs CMake in an
endless loop (observed 42 consecutive reconfigure cycles in a single
build). Likely the same mechanism behind the "endlessly building" VS
2026 note in `docs/setup/dev/vs.md`.

## Root cause

1. `third-party/curl/CMake/CurlTests.c` passes `int *` to
`ioctlsocket()`, whose third parameter is `u_long *`. Clang 22 promotes
`-Wincompatible-pointer-types` to a hard error in C, so the
`HAVE_IOCTLSOCKET_FIONBIO` try_compile silently fails and
`curl_config.h` never defines it. Upstream CI does not see this because
the windows-2022 runner image ships an older LLVM. GCC 14 promotes the
same warning to a hard error, which is very likely the `CurlTests.c.obj`
failure reported from MSYS2 in open-goal/jak-project#3551. Upstream curl
hit the identical problem with GCC 14 and fixed the probe in curl 8.8.0
(curl/curl#13578).
2. The root CMakeLists copies the build tree's `compile_commands.json`
into `<src>/build/` for clangd using `configure_file()`, which registers
its input as a configure dependency. CMake rewrites
`compile_commands.json` late in every generation, after
`CTestTestfile.cmake` and `cmake_install.cmake` (outputs of the same
Ninja regen rule), so once the dependency is registered the rule is
deterministically dirty and every `ninja` invocation re-runs CMake. A
pristine first configure is safe (the file does not exist yet, so the
`if(EXISTS ...)` guard skips the copy), which is why the loop looks
machine- or IDE-specific.

## Fix

1. Per review, re-vendor `third-party/curl` at the `curl-8_21_0` tag
(previously `curl-8_3_0`), which carries the upstream probe fix plus two
years of upstream development; `vendor.yaml` updated to match.
Adjustments the version jump forced:
- curl 8.15 removed the native macOS Secure Transport backend
(`CURL_USE_SECTRANSP`), so macOS now builds curl against OpenSSL like
Linux. The two macOS workflows install Homebrew `openssl@3` and export
`OPENSSL_ROOT_DIR` (keg-only), and the macOS setup docs gained the same
two lines.
- `CURL_BROTLI` / `CURL_ZSTD` switched to AUTO-detection in curl 8.10;
pinned OFF to keep the previous no-compression behavior and avoid
silently linking whatever the CI images happen to have.
- curl's new top-level `BUILD_EXAMPLES` cache option (default ON) leaked
into discord-rpc's identically named option and broke configure at a
nonexistent `examples/send-presence` directory; pinned OFF ahead of the
third-party subdirectories.

The diff is dominated by the mechanical tag-tree swap under
`third-party/curl` (linguist-vendored, collapsed in review). The
hand-written changes are `CMakeLists.txt`, the two macOS workflows,
`docs/setup/system/macos.md`, and `vendor.yaml`.
2. Swap `configure_file()` for `file(COPY ...)`: the same clangd copy
with no configure dependency registered. (`file(COPY_FILE ...
ONLY_IF_DIFFERENT)` would be cleaner still but requires CMake 3.21,
above the declared `cmake_minimum_required(VERSION 3.10)`.)

## Test plan

- [x] Fresh `cmake --preset Release-windows-clang` (LLVM 22, no cache
seeding) completes and logs `Enabled SSL backends: Schannel`; the
FIONBIO probe passes without the previous `#error`
- [x] Full Windows Release build from scratch in the branch worktree
(all 1422 targets)
- [x] goalc-test suite: 1509 passed, 0 failed
- [x] Second consecutive configure with `compile_commands.json` present:
the regen rule in `build.ninja` has no `compile_commands.json` input;
`<src>/build/compile_commands.json` is still refreshed for clangd
- [x] Repeated `ninja` invocations after a full build no longer re-run
CMake
- [x] macOS Intel and ARM CI green (first exercise of the OpenSSL
backend switch)

---

I work off a self-hosted forge, so this GitHub account is quiet; the
configure logs and ninja dirty-node traces from the investigation are
available if anyone wants the raw data.

(AI-assisted)
2026-07-27 19:19:18 -04:00

4.3 KiB
Vendored
Generated

c, SPDX-License-Identifier, Title, Section, Source, See-also, Added-in
c SPDX-License-Identifier Title Section Source See-also Added-in
Copyright (C) Samuel Henrique <samueloph@debian.org>, Sergio Durigan Junior <sergiodj@debian.org> and many contributors, see the AUTHORS file. curl wcurl 1 wcurl
curl (1)
trurl (1)
n/a

NAME

wcurl - a simple wrapper around curl to easily download files.

SYNOPSIS

wcurl <URL>...

wcurl [--curl-options <CURL_OPTIONS>]... [--dry-run] [--no-decode-filename] [-o|-O|--output <PATH>] [--] <URL>...

wcurl [--curl-options=<CURL_OPTIONS>]... [--dry-run] [--no-decode-filename] [--output=<PATH>] [--] <URL>...

wcurl -V|--version

wcurl -h|--help

DESCRIPTION

wcurl is a simple curl wrapper which lets you use curl to download files without having to remember any parameters.

Call wcurl with a list of URLs you want to download and wcurl picks sane defaults.

If you need anything more complex, you can provide any of curl's supported parameters via the --curl-options option. Beware that you likely should be using curl directly if your use case is not covered.

By default, wcurl does:

* Percent-encode whitespace in URLs;

* Download multiple URLs in parallel

if the installed curl's version is \>= 7.66.0 (--parallel);

* Use a total number of 5 parallel connections to the same protocol + hostname + port number target

if the installed curl's version is \>= 8.16.0 (--parallel-max-host);

* Follow redirects;

* Automatically choose a filename as output;

* Avoid overwriting files

if the installed curl's version is \>= 7.83.0 (--no-clobber);

* Perform retries;

* Set the downloaded file timestamp

to the value provided by the server, if available;

* Default to https

if the URL does not contain any scheme;

* Disable curl's URL globbing parser

so {} and [] characters in URLs are not treated specially;

* Percent-decode the resulting filename;

* Use 'index.html' as the default filename

if there is none in the URL.

OPTIONS

--curl-options, --curl-options=<CURL_OPTIONS>...

Specify extra options to be passed when invoking curl. May be specified more than once.

-o, -O, --output, --output=<PATH>

Use the provided output path instead of getting it from the URL. If multiple URLs are provided, resulting files share the same name with a number appended to the end (curl >= 7.83.0). If this option is provided multiple times, only the last value is considered.

--no-decode-filename

Do not percent-decode the output filename, even if the percent-encoding in the URL was done by wcurl, e.g.: The URL contained whitespace.

--dry-run

Do not actually execute curl, print what would be invoked.

-V, --version

Print version information.

-h, --help

Print help message.

CURL_OPTIONS

Any option supported by curl can be set here. This is not used by wcurl; it is instead forwarded to the curl invocation.

URL

URL to be downloaded. Anything that is not a parameter is considered an URL. Whitespace is percent-encoded and the URL is passed to curl, which then performs the parsing. May be specified more than once.

EXAMPLES

Download a single file:

wcurl example.com/filename.txt

Download two files in parallel:

wcurl example.com/filename1.txt example.com/filename2.txt

Download a file passing the --progress-bar and --http2 flags to curl:

wcurl --curl-options="--progress-bar --http2" example.com/filename.txt

Resume from an interrupted download. The options necessary to resume the download (--clobber --continue-at -) must be the last options specified in --curl-options. Note that the only way to resume interrupted downloads is to allow wcurl to overwrite the destination file:

wcurl --curl-options="--clobber --continue-at -" example.com/filename.txt

Download multiple files without a limit of concurrent connections per host (the default limit is 5):

wcurl --curl-options="--parallel-max-host 0" example.com/filename1.txt example.com/filename2.txt

AUTHORS

Samuel Henrique \<samueloph@debian.org\>
Sergio Durigan Junior \<sergiodj@debian.org\>
and many contributors, see the AUTHORS file.

REPORTING BUGS

If you experience any problems with wcurl that you do not experience with curl, submit an issue on GitHub: https://github.com/curl/wcurl

COPYRIGHT

wcurl is licensed under the curl license