mirror of
https://github.com/open-goal/jak-project
synced 2026-09-09 20:21:28 -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)
126 lines
4.1 KiB
C
Vendored
Generated
126 lines
4.1 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 "unitcheck.h"
|
|
#include "tool_getparam.h"
|
|
|
|
struct check1623 {
|
|
const char *input;
|
|
curl_off_t amount;
|
|
ParameterError err;
|
|
};
|
|
|
|
static CURLcode test_tool1623(const char *arg)
|
|
{
|
|
UNITTEST_BEGIN_SIMPLE
|
|
|
|
int i;
|
|
static const struct check1623 check[] = {
|
|
{ "0", 0, PARAM_OK },
|
|
{ "00", 0, PARAM_OK },
|
|
{ "000", 0, PARAM_OK },
|
|
{ "1", 1, PARAM_OK },
|
|
{ "1b", 1, PARAM_OK },
|
|
{ "99B", 99, PARAM_OK },
|
|
{ "2", 2, PARAM_OK },
|
|
{ "3", 3, PARAM_OK },
|
|
{ "4", 4, PARAM_OK },
|
|
{ "5", 5, PARAM_OK },
|
|
{ "6", 6, PARAM_OK },
|
|
{ "7", 7, PARAM_OK },
|
|
{ "77", 77, PARAM_OK },
|
|
{ "8", 8, PARAM_OK },
|
|
{ "9", 9, PARAM_OK },
|
|
{ "10", 10, PARAM_OK },
|
|
{ "010", 10, PARAM_OK },
|
|
{ "000000000000000000000000000000000010", 10, PARAM_OK },
|
|
{ "1k", 1024, PARAM_OK },
|
|
{ "2K", 2048, PARAM_OK },
|
|
{ "3k", 3072, PARAM_OK },
|
|
{ "4K", 4096, PARAM_OK },
|
|
{ "5k", 5120, PARAM_OK },
|
|
{ "6K", 6144, PARAM_OK },
|
|
{ "7k", 7168, PARAM_OK },
|
|
{ "8K", 8192, PARAM_OK },
|
|
{ "9k", 9216, PARAM_OK },
|
|
{ "10K", 10240, PARAM_OK },
|
|
{ "20M", 20971520, PARAM_OK },
|
|
{ "30G", 32212254720, PARAM_OK },
|
|
{ "40T", 43980465111040, PARAM_OK },
|
|
{ "50P", 56294995342131200, PARAM_OK },
|
|
{ "1.1k", 1126, PARAM_OK },
|
|
{ "1.01k", 1034, PARAM_OK },
|
|
{ "1.001k", 1025, PARAM_OK },
|
|
{ "1.0001k", 1024, PARAM_OK },
|
|
{ "22.1m", 23173529, PARAM_OK },
|
|
{ "22.01m", 23079157, PARAM_OK },
|
|
{ "22.001m", 23069720, PARAM_OK },
|
|
{ "22.0001m", 23068776, PARAM_OK },
|
|
{ "22.00001m", 23068682, PARAM_OK },
|
|
{ "22.000001m", 23068673, PARAM_OK },
|
|
{ "22.0000001m", 23068672, PARAM_OK },
|
|
{ "22.000000001m", 23068672, PARAM_OK },
|
|
{ "3.4", 0, PARAM_BAD_USE },
|
|
{ "3.14b", 0, PARAM_BAD_USE },
|
|
{ "5000.9P", 5630512844129278361, PARAM_OK },
|
|
{ "5000.99P", 5630614175120894197, PARAM_OK },
|
|
{ "5000.999P", 5630624308220055781, PARAM_OK },
|
|
{ "5000.9999P", 5630625321529969316, PARAM_OK },
|
|
{ "8191P", 9222246136947933184, PARAM_OK },
|
|
{ "8191.9999999P", 9223372036735343194, PARAM_OK },
|
|
{ "8192P", 0, PARAM_NUMBER_TOO_LARGE },
|
|
{ "9223372036854775807", 9223372036854775807, PARAM_OK },
|
|
{ "9223372036854775808", 0, PARAM_NUMBER_TOO_LARGE },
|
|
{ "a", 0, PARAM_BAD_NUMERIC },
|
|
{ "-2", 0, PARAM_BAD_NUMERIC },
|
|
{ "+2", 0, PARAM_BAD_NUMERIC },
|
|
{ "2,2k", 0, PARAM_BAD_USE },
|
|
{ NULL, 0, PARAM_OK } /* end of list */
|
|
};
|
|
|
|
for(i = 0; check[i].input; i++) {
|
|
bool ok = FALSE;
|
|
curl_off_t output = 0;
|
|
ParameterError err = GetSizeParameter(check[i].input, &output);
|
|
if(err != check[i].err)
|
|
curl_mprintf("'%s' unexpectedly returned %d \n",
|
|
check[i].input, (int)err);
|
|
else if(check[i].amount != output)
|
|
curl_mprintf("'%s' unexpectedly gave %" FMT_OFF_T "\n",
|
|
check[i].input, output);
|
|
else {
|
|
#if 0 /* enable for debugging */
|
|
if(err)
|
|
curl_mprintf("'%s' returned %d\n", check[i].input, (int)err);
|
|
else
|
|
curl_mprintf("'%s' == %" FMT_OFF_T "\n", check[i].input, output);
|
|
#endif
|
|
ok = TRUE;
|
|
}
|
|
if(!ok)
|
|
unitfail++;
|
|
}
|
|
|
|
UNITTEST_END_SIMPLE
|
|
}
|