mirror of
https://github.com/open-goal/jak-project
synced 2026-09-06 11:20:54 -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)
206 lines
7.2 KiB
C
Vendored
Generated
206 lines
7.2 KiB
C
Vendored
Generated
/***************************************************************************
|
|
* _ _ ____ _
|
|
* Project ___| | | | _ \| |
|
|
* / __| | | | |_) | |
|
|
* | (__| |_| | _ <| |___
|
|
* \___|\___/|_| \_\_____|
|
|
*
|
|
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
*
|
|
* This software is licensed as described in the file COPYING, which
|
|
* you should have received as part of this distribution. The terms
|
|
* are also available at https://curl.se/docs/copyright.html.
|
|
*
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
* copies of the Software, and permit persons to whom the Software is
|
|
* furnished to do so, under the terms of the COPYING file.
|
|
*
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
* KIND, either express or implied.
|
|
*
|
|
* SPDX-License-Identifier: curl
|
|
*
|
|
***************************************************************************/
|
|
#include "tool_setup.h"
|
|
|
|
#include "tool_libinfo.h"
|
|
|
|
/* global variable definitions, for libcurl runtime info */
|
|
|
|
static const char *no_protos = NULL;
|
|
|
|
curl_version_info_data *curlinfo = NULL;
|
|
const char * const *built_in_protos = &no_protos;
|
|
|
|
size_t proto_count = 0;
|
|
|
|
const char *proto_file = NULL;
|
|
const char *proto_ftp = NULL;
|
|
const char *proto_ftps = NULL;
|
|
const char *proto_http = NULL;
|
|
const char *proto_https = NULL;
|
|
const char *proto_rtsp = NULL;
|
|
const char *proto_scp = NULL;
|
|
const char *proto_sftp = NULL;
|
|
const char *proto_tftp = NULL;
|
|
#ifndef CURL_DISABLE_IPFS
|
|
const char *proto_ipfs = "ipfs";
|
|
const char *proto_ipns = "ipns";
|
|
#endif
|
|
|
|
static struct proto_name_tokenp {
|
|
const char *proto_name;
|
|
const char **proto_tokenp;
|
|
} const possibly_built_in[] = {
|
|
{ "file", &proto_file },
|
|
{ "ftp", &proto_ftp },
|
|
{ "ftps", &proto_ftps },
|
|
{ "http", &proto_http },
|
|
{ "https", &proto_https },
|
|
{ "rtsp", &proto_rtsp },
|
|
{ "scp", &proto_scp },
|
|
{ "sftp", &proto_sftp },
|
|
{ "tftp", &proto_tftp },
|
|
{ NULL, NULL }
|
|
};
|
|
|
|
bool feature_altsvc = FALSE;
|
|
bool feature_brotli = FALSE;
|
|
bool feature_hsts = FALSE;
|
|
bool feature_http2 = FALSE;
|
|
bool feature_http3 = FALSE;
|
|
bool feature_httpsproxy = FALSE;
|
|
bool feature_libz = FALSE;
|
|
bool feature_ntlm = FALSE;
|
|
bool feature_ntlm_wb = FALSE;
|
|
bool feature_spnego = FALSE;
|
|
bool feature_ssl = FALSE;
|
|
bool feature_tls_srp = FALSE;
|
|
bool feature_zstd = FALSE;
|
|
bool feature_ech = FALSE;
|
|
bool feature_ssls_export = FALSE;
|
|
|
|
static struct feature_name_presentp {
|
|
const char *feature_name;
|
|
bool *feature_presentp;
|
|
int feature_bitmask;
|
|
} const maybe_feature[] = {
|
|
/* Keep alphabetically sorted. */
|
|
{ "alt-svc", &feature_altsvc, CURL_VERSION_ALTSVC },
|
|
{ "AsynchDNS", NULL, CURL_VERSION_ASYNCHDNS },
|
|
{ "brotli", &feature_brotli, CURL_VERSION_BROTLI },
|
|
{ "CharConv", NULL, CURL_VERSION_CONV },
|
|
{ "Debug", NULL, CURL_VERSION_DEBUG },
|
|
{ "ECH", &feature_ech, 0 },
|
|
{ "gsasl", NULL, CURL_VERSION_GSASL },
|
|
{ "GSS-API", NULL, CURL_VERSION_GSSAPI },
|
|
{ "HSTS", &feature_hsts, CURL_VERSION_HSTS },
|
|
{ "HTTP2", &feature_http2, CURL_VERSION_HTTP2 },
|
|
{ "HTTP3", &feature_http3, CURL_VERSION_HTTP3 },
|
|
{ "HTTPS-proxy", &feature_httpsproxy, CURL_VERSION_HTTPS_PROXY },
|
|
{ "IDN", NULL, CURL_VERSION_IDN },
|
|
{ "IPv6", NULL, CURL_VERSION_IPV6 },
|
|
{ "Kerberos", NULL, CURL_VERSION_KERBEROS5 },
|
|
{ "Largefile", NULL, CURL_VERSION_LARGEFILE },
|
|
{ "libz", &feature_libz, CURL_VERSION_LIBZ },
|
|
{ "MultiSSL", NULL, CURL_VERSION_MULTI_SSL },
|
|
{ "NTLM", &feature_ntlm, CURL_VERSION_NTLM },
|
|
{ "NTLM_WB", &feature_ntlm_wb, CURL_VERSION_NTLM_WB },
|
|
{ "PSL", NULL, CURL_VERSION_PSL },
|
|
{ "SPNEGO", &feature_spnego, CURL_VERSION_SPNEGO },
|
|
{ "SSL", &feature_ssl, CURL_VERSION_SSL },
|
|
{ "SSPI", NULL, CURL_VERSION_SSPI },
|
|
{ "SSLS-EXPORT", &feature_ssls_export, 0 },
|
|
{ "threadsafe", NULL, CURL_VERSION_THREADSAFE },
|
|
{ "TLS-SRP", &feature_tls_srp, CURL_VERSION_TLSAUTH_SRP },
|
|
{ "Unicode", NULL, CURL_VERSION_UNICODE },
|
|
{ "UnixSockets", NULL, CURL_VERSION_UNIX_SOCKETS },
|
|
{ "zstd", &feature_zstd, CURL_VERSION_ZSTD },
|
|
{ NULL, NULL, 0 }
|
|
};
|
|
|
|
static const char *fnames[CURL_ARRAYSIZE(maybe_feature)];
|
|
const char * const *feature_names = fnames;
|
|
size_t feature_count;
|
|
|
|
/*
|
|
* libcurl_info_init: retrieves runtime information about libcurl,
|
|
* setting a global pointer 'curlinfo' to libcurl's runtime info
|
|
* struct, count protocols and flag those we are interested in.
|
|
* Global pointer feature_names is set to the feature names array. If
|
|
* the latter is not returned by curl_version_info(), it is built from
|
|
* the returned features bit mask.
|
|
*/
|
|
CURLcode get_libcurl_info(void)
|
|
{
|
|
CURLcode result = CURLE_OK;
|
|
const char * const *builtin;
|
|
|
|
/* Pointer to libcurl's runtime version information */
|
|
curlinfo = curl_version_info(CURLVERSION_NOW);
|
|
if(!curlinfo)
|
|
return CURLE_FAILED_INIT;
|
|
|
|
if(curlinfo->protocols) {
|
|
const struct proto_name_tokenp *p;
|
|
|
|
built_in_protos = curlinfo->protocols;
|
|
|
|
for(builtin = built_in_protos; !result && *builtin; builtin++) {
|
|
/* Identify protocols we are interested in. */
|
|
for(p = possibly_built_in; p->proto_name; p++)
|
|
if(curl_strequal(p->proto_name, *builtin)) {
|
|
*p->proto_tokenp = *builtin;
|
|
break;
|
|
}
|
|
}
|
|
proto_count = builtin - built_in_protos;
|
|
}
|
|
|
|
if(curlinfo->age >= CURLVERSION_ELEVENTH && curlinfo->feature_names)
|
|
feature_names = curlinfo->feature_names;
|
|
else {
|
|
const struct feature_name_presentp *p;
|
|
const char **cpp = fnames;
|
|
|
|
for(p = maybe_feature; p->feature_name; p++)
|
|
if(curlinfo->features & p->feature_bitmask)
|
|
*cpp++ = p->feature_name;
|
|
*cpp = NULL;
|
|
}
|
|
|
|
/* Identify features we are interested in. */
|
|
for(builtin = feature_names; *builtin; builtin++) {
|
|
const struct feature_name_presentp *p;
|
|
|
|
for(p = maybe_feature; p->feature_name; p++)
|
|
if(curl_strequal(p->feature_name, *builtin)) {
|
|
if(p->feature_presentp)
|
|
*p->feature_presentp = TRUE;
|
|
break;
|
|
}
|
|
++feature_count;
|
|
}
|
|
|
|
return CURLE_OK;
|
|
}
|
|
|
|
/* Tokenize a protocol name.
|
|
* Return the address of the protocol name listed by the library, or NULL if
|
|
* not found.
|
|
* Although this may seem useless, this always returns the same address for
|
|
* a given protocol and thus allows comparing pointers rather than strings.
|
|
* In addition, the returned pointer is not deallocated until the program ends.
|
|
*/
|
|
const char *proto_token(const char *proto)
|
|
{
|
|
const char * const *builtin;
|
|
|
|
if(!proto)
|
|
return NULL;
|
|
for(builtin = built_in_protos; *builtin; builtin++)
|
|
if(curl_strequal(*builtin, proto))
|
|
break;
|
|
return *builtin;
|
|
}
|