mirror of
https://github.com/open-goal/jak-project
synced 2026-09-12 12:55:22 -04:00
5d5e35fb9b
## 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)
164 lines
4.3 KiB
Markdown
Vendored
Generated
164 lines
4.3 KiB
Markdown
Vendored
Generated
---
|
|
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
SPDX-License-Identifier: curl
|
|
Title: libcurl-url
|
|
Section: 3
|
|
Source: libcurl
|
|
See-also:
|
|
- CURLOPT_URL (3)
|
|
- curl_url (3)
|
|
- curl_url_cleanup (3)
|
|
- curl_url_dup (3)
|
|
- curl_url_get (3)
|
|
- curl_url_set (3)
|
|
- curl_url_strerror (3)
|
|
Protocol:
|
|
- All
|
|
Added-in: 7.62.0
|
|
---
|
|
|
|
# NAME
|
|
|
|
libcurl-url - URL interface overview
|
|
|
|
# DESCRIPTION
|
|
|
|
The URL interface provides functions for parsing and generating URLs.
|
|
|
|
# INCLUDE
|
|
|
|
You still only include \<curl/curl.h\> in your code.
|
|
|
|
# CREATE
|
|
|
|
Create a handle that holds URL info and resources with curl_url(3):
|
|
~~~c
|
|
CURLU *h = curl_url();
|
|
~~~
|
|
|
|
# CLEANUP
|
|
|
|
When done with it, clean it up with curl_url_cleanup(3)
|
|
~~~c
|
|
curl_url_cleanup(h);
|
|
~~~
|
|
|
|
# DUPLICATE
|
|
|
|
When you need a copy of a handle, duplicate it with curl_url_dup(3):
|
|
~~~c
|
|
CURLU *nh = curl_url_dup(h);
|
|
~~~
|
|
|
|
# PARSING
|
|
|
|
By setting a URL to the handle with curl_url_set(3), the URL is parsed
|
|
and stored in the handle. If the URL is not syntactically correct it returns
|
|
an error instead.
|
|
~~~c
|
|
rc = curl_url_set(h, CURLUPART_URL,
|
|
"https://example.com:449/foo/bar?name=moo", 0);
|
|
~~~
|
|
|
|
The zero in the fourth argument is a bitmask for changing specific features.
|
|
|
|
If successful, this stores the URL in its individual parts within the handle.
|
|
|
|
# REDIRECT
|
|
|
|
When a handle already contains info about a URL, setting a relative URL makes
|
|
it "redirect" to that.
|
|
~~~c
|
|
rc = curl_url_set(h, CURLUPART_URL, "../test?another", 0);
|
|
~~~
|
|
|
|
# GET URL
|
|
|
|
The **CURLU** handle represents a URL and you can easily extract that with
|
|
curl_url_get(3):
|
|
~~~c
|
|
char *url;
|
|
rc = curl_url_get(h, CURLUPART_URL, &url, 0);
|
|
curl_free(url);
|
|
~~~
|
|
The zero in the fourth argument is a bitmask for changing specific features.
|
|
|
|
# GET PARTS
|
|
|
|
When a URL has been parsed or parts have been set, you can extract those
|
|
pieces from the handle at any time.
|
|
|
|
~~~c
|
|
rc = curl_url_get(h, CURLUPART_FRAGMENT, &fragment, 0);
|
|
rc = curl_url_get(h, CURLUPART_HOST, &host, 0);
|
|
rc = curl_url_get(h, CURLUPART_PASSWORD, &password, 0);
|
|
rc = curl_url_get(h, CURLUPART_PATH, &path, 0);
|
|
rc = curl_url_get(h, CURLUPART_PORT, &port, 0);
|
|
rc = curl_url_get(h, CURLUPART_QUERY, &query, 0);
|
|
rc = curl_url_get(h, CURLUPART_SCHEME, &scheme, 0);
|
|
rc = curl_url_get(h, CURLUPART_USER, &user, 0);
|
|
rc = curl_url_get(h, CURLUPART_ZONEID, &zoneid, 0);
|
|
~~~
|
|
|
|
Extracted parts are not URL decoded unless the user also asks for it with the
|
|
*CURLU_URLDECODE* flag set in the fourth bitmask argument.
|
|
|
|
Remember to free the returned string with curl_free(3) when you are done
|
|
with it.
|
|
|
|
# SET PARTS
|
|
|
|
A user set individual URL parts, either after having parsed a full URL or
|
|
instead of parsing such.
|
|
|
|
~~~c
|
|
rc = curl_url_set(urlp, CURLUPART_FRAGMENT, "anchor", 0);
|
|
rc = curl_url_set(urlp, CURLUPART_HOST, "www.example.com", 0);
|
|
rc = curl_url_set(urlp, CURLUPART_PASSWORD, "doe", 0);
|
|
rc = curl_url_set(urlp, CURLUPART_PATH, "/index.html", 0);
|
|
rc = curl_url_set(urlp, CURLUPART_PORT, "443", 0);
|
|
rc = curl_url_set(urlp, CURLUPART_QUERY, "name=john", 0);
|
|
rc = curl_url_set(urlp, CURLUPART_SCHEME, "https", 0);
|
|
rc = curl_url_set(urlp, CURLUPART_USER, "john", 0);
|
|
rc = curl_url_set(urlp, CURLUPART_ZONEID, "eth0", 0);
|
|
~~~
|
|
|
|
Set parts are not URL encoded unless the user asks for it with the
|
|
*CURLU_URLENCODE* flag.
|
|
|
|
# CURLU_APPENDQUERY
|
|
|
|
An application can append a string to the right end of the query part with the
|
|
*CURLU_APPENDQUERY* flag to curl_url_set(3).
|
|
|
|
Imagine a handle that holds the URL "https://example.com/?shoes=2". An
|
|
application can then add the string "hat=1" to the query part like this:
|
|
|
|
~~~c
|
|
rc = curl_url_set(urlp, CURLUPART_QUERY, "hat=1", CURLU_APPENDQUERY);
|
|
~~~
|
|
|
|
It notices the lack of an ampersand (&) separator and injects one, and the
|
|
handle's full URL then equals "https://example.com/?shoes=2&hat=1".
|
|
|
|
The appended string can of course also get URL encoded on add, and if asked to
|
|
URL encode, the encoding process skips the '=' character. For example, append
|
|
"candy=N&N" to what we already have, and URL encode it to deal with the
|
|
ampersand in the data:
|
|
|
|
~~~c
|
|
rc = curl_url_set(urlp, CURLUPART_QUERY, "candy=N&N",
|
|
CURLU_APPENDQUERY | CURLU_URLENCODE);
|
|
~~~
|
|
|
|
Now the URL looks like
|
|
|
|
~~~c
|
|
https://example.com/?shoes=2&hat=1&candy=N%26N
|
|
~~~
|
|
|
|
# NOTES
|
|
|
|
A URL with a literal IPv6 address can be parsed even when IPv6 support is not
|
|
enabled.
|