mirror of
https://github.com/open-goal/jak-project
synced 2026-09-06 19:21:00 -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)
287 lines
9.4 KiB
Plaintext
Vendored
Generated
287 lines
9.4 KiB
Plaintext
Vendored
Generated
$! File: setup_gnv_curl_build.com
|
|
$!
|
|
$! Set up build environment for building curl under GNV on VMS.
|
|
$!
|
|
$! GNV needs some files moved into the other directories to help with
|
|
$! the configure script and the build.
|
|
$!
|
|
$! Copyright (C) John Malmberg
|
|
$!
|
|
$! Permission to use, copy, modify, and/or distribute this software for any
|
|
$! purpose with or without fee is hereby granted, provided that the above
|
|
$! copyright notice and this permission notice appear in all copies.
|
|
$!
|
|
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
|
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
$!
|
|
$! SPDX-License-Identifier: ISC
|
|
$!
|
|
$!=======================================================================
|
|
$!
|
|
$! Save this so we can get back.
|
|
$ default_dir = f$environment("default")
|
|
$!
|
|
$! Move to where the Configure script is.
|
|
$ set def [--]
|
|
$!
|
|
$! Get the path to where the Configure script is.
|
|
$ base_dir = f$environment("default")
|
|
$!
|
|
$! Allow arguments to be grouped together with comma or separated by spaces
|
|
$! Do no know if we will need more than 8.
|
|
$ args = "," + p1 + "," + p2 + "," + p3 + "," + p4 + ","
|
|
$ args = args + p5 + "," + p6 + "," + p7 + "," + p8 + ","
|
|
$!
|
|
$! Provide lower case version to simplify parsing.
|
|
$ args_lower = f$edit(args, "LOWERCASE,COLLAPSE")
|
|
$!
|
|
$ args_len = f$length(args)
|
|
$ args_lower_len = f$length(args_lower)
|
|
$!
|
|
$ tests = 0
|
|
$ if f$locate(",test", args_lower) .lt. args_lower_len
|
|
$ then
|
|
$ tests = 1
|
|
$ endif
|
|
$!
|
|
$ examples = 0
|
|
$ if f$locate(",exam", args_lower) .lt. args_lower_len
|
|
$ then
|
|
$ examples = 1
|
|
$ endif
|
|
$!
|
|
$! We want detailed build logs.
|
|
$ clist = "/list/show=(expan,includ)"
|
|
$!
|
|
$! We want full symbol names in exact case. Need a common
|
|
$! repository for all directories.
|
|
$ cnames = "/names=(shortened,as_is)/repository=''base_dir'"
|
|
$!
|
|
$! Set the compiler options for GNV CC wrapper to inherit.
|
|
$ cc :== cc'clist''cnames'/nested_include_directory=none
|
|
$ cxx :== cxx'clist''cnames'/nested_include_directory=none
|
|
$ pointer_size = "32"
|
|
$! Note 64-bit pointers requires all libraries to either have
|
|
$! 64-bit pointers or have #pragma directives.
|
|
$! Currently building curl on VMS with 64-bit pointers does not work.
|
|
$!
|
|
$! A logical name to make it easier to find some of the hacks.
|
|
$ define/job gnv_hacks 'base_dir'
|
|
$!
|
|
$! A logical name to find the [.projects.vms] directory where we started.
|
|
$ define/job gnv_packages_vms 'default_dir'
|
|
$!
|
|
$! Kerberos headers:
|
|
$ if f$trnlnm("gssapi") .eqs. ""
|
|
$ then
|
|
$ if f$search("sys$sysroot:[kerberos]include.dir") .nes. ""
|
|
$ then
|
|
$ define/job gssapi sys$sysroot:[kerberos.include]
|
|
$ endif
|
|
$ endif
|
|
$!
|
|
$! OpenSSL headers
|
|
$ if f$trnlnm("openssl") .eqs. ""
|
|
$ then
|
|
$ if f$trnlnm("ssl$include") .nes. ""
|
|
$ then
|
|
$ define/job openssl ssl$include:
|
|
$ endif
|
|
$ endif
|
|
$!
|
|
$! C compiler include path.
|
|
$ define/job decc$system_include prj_root:[.include.curl],-
|
|
[-.projects.vms],-
|
|
ssl$include:,gnv$gnu:[usr.include],-
|
|
gnv$gnu:[usr.include.libz],gnv$gnu:[include],-
|
|
gnv$zlib_include:,-
|
|
sys$sysroot:[kerberos.include]
|
|
$!
|
|
$! Set up an include list for the compiler to find all the header files
|
|
$! that they need.
|
|
$!
|
|
$ define/job decc$user_include src_root:[.include.curl]
|
|
$ define ssl_lib sys$library:
|
|
$!
|
|
$! Calculate what is needed in the option files
|
|
$ libzshr_line = ""
|
|
$ try_shr = "gnv$libzshr''pointer_size'"
|
|
$ if f$search(try_shr) .nes. "" then libzshr_line = "''try_shr'/share"
|
|
$ if (libzshr_line .eqs. "")
|
|
$ then
|
|
$ try_shr = "sys$share:" + try_shr
|
|
$ if f$search("''try_shr'.exe") .nes. ""
|
|
$ then
|
|
$ libzshr_line = "''try_shr'/share"
|
|
$ endif
|
|
$ endif
|
|
$!
|
|
$! Kerberos
|
|
$ gssrtlshr_line = ""
|
|
$ try_shr = "sys$share:gss$rtl"
|
|
$ if f$search("''try_shr'.exe") .nes. ""
|
|
$ then
|
|
$ gssrtlshr_line = "''try_shr'/share"
|
|
$ endif
|
|
$!
|
|
$! HP OpenSSL
|
|
$ libcryptoshr_line = ""
|
|
$ try_shr = "sys$share:ssl$libcrypto_shr''pointer_size'"
|
|
$ if f$search("''try_shr'.exe") .nes. ""
|
|
$ then
|
|
$ libcryptoshr_line = "''try_shr'/share"
|
|
$ endif
|
|
$!
|
|
$ libsslshr_line = ""
|
|
$ try_shr = "sys$share:ssl$libssl_shr''pointer_size'"
|
|
$ if f$search("''try_shr'.exe") .nes. ""
|
|
$ then
|
|
$ libsslshr_line = "''try_shr'/share"
|
|
$ endif
|
|
$!
|
|
$!
|
|
$! Copy over the gnv$conftest* files to base directory.
|
|
$!-----------------------------------------------------
|
|
$ copy 'default_dir'gnv_conftest.c_first 'base_dir'gnv$conftest.c_first
|
|
$ create 'base_dir'gnv$conftest.opt
|
|
$ open/append opt 'base_dir'gnv$conftest.opt
|
|
$ if libzshr_line .nes. "" then write opt libzshr_line
|
|
$ if libcryptoshr_line .nes. "" then write opt libcryptoshr_line
|
|
$ if libsslshr_line .nes. "" then write opt libsslshr_line
|
|
$ close opt
|
|
$ purge 'base_dir'gnv$conftest.*
|
|
$ rename 'base_dir'gnv$conftest.* ;1
|
|
$!
|
|
$!
|
|
$!
|
|
$! GNV helper files for building the test curl binary.
|
|
$!-----------------------------------------------
|
|
$ create [.src]gnv$curl.opt
|
|
$ open/append opt [.src]gnv$curl.opt
|
|
$ write opt "gnv_packages_vms:curlmsg.obj"
|
|
$ if libzshr_line .nes. "" then write opt libzshr_line
|
|
$ if gssrtlshr_line .nes. "" then write opt gssrtlshr_line
|
|
$ if libcryptoshr_line .nes. "" then write opt libcryptoshr_line
|
|
$ if libsslshr_line .nes. "" then write opt libsslshr_line
|
|
$ close opt
|
|
$ purge [.src]gnv$*.*
|
|
$ rename [.src]gnv$*.* ;1
|
|
$!
|
|
$!
|
|
$! Create the libcurl
|
|
$!------------------------------------------------------
|
|
$ create 'default_dir'gnv_libcurl_linker.opt
|
|
$ open/append opt 'default_dir'gnv_libcurl_linker.opt
|
|
$ if libzshr_line .nes. "" then write opt libzshr_line
|
|
$ if gssrtlshr_line .nes. "" then write opt gssrtlshr_line
|
|
$ if libcryptoshr_line .nes. "" then write opt libcryptoshr_line
|
|
$ if libsslshr_line .nes. "" then write opt libsslshr_line
|
|
$ close opt
|
|
$!
|
|
$!
|
|
$! Create the template linker file
|
|
$!---------------------------------
|
|
$ create 'default_dir'gnv_template_linker.opt
|
|
$ open/append opt 'default_dir'gnv_template_linker.opt
|
|
$ write opt "gnv_vms_common:vms_curl_init_unix.obj"
|
|
$ if libzshr_line .nes. "" then write opt libzshr_line
|
|
$ if gssrtlshr_line .nes. "" then write opt gssrtlshr_line
|
|
$ if libcryptoshr_line .nes. "" then write opt libcryptoshr_line
|
|
$ if libsslshr_line .nes. "" then write opt libsslshr_line
|
|
$ close opt
|
|
$!
|
|
$! Copy over the gnv$*.opt files for [.docs.examples]
|
|
$!----------------------------------------------------
|
|
$ if examples .ne. 0
|
|
$ then
|
|
$ example_apps = "10-at-a-time,anyauthput,certinfo,cookie_interface,debug"
|
|
$ example_apps = example_apps + ",fileupload,fopen,ftpget,ftpgetresp"
|
|
$ example_apps = example_apps + ",ftpupload,getinfo,getinmemory"
|
|
$ example_apps = example_apps + ",http-post,httpcustomheader,httpput"
|
|
$ example_apps = example_apps + ",https,multi-app,multi-debugcallback"
|
|
$ example_apps = example_apps + ",multi-double,multi-post,multi-single"
|
|
$ example_apps = example_apps + ",persistent,post-callback,postit2"
|
|
$ example_apps = example_apps + ",sendrecv,sepheaders,simple,simplepost"
|
|
$ example_apps = example_apps + ",simplessl"
|
|
$!
|
|
$ i = 0
|
|
$example_loop:
|
|
$ ap_name = f$element(i, ",", example_apps)
|
|
$ if ap_name .eqs. "," then goto example_loop_end
|
|
$ if ap_name .eqs. "" then goto example_loop_end
|
|
$ copy 'default_dir'gnv_template_linker.opt -
|
|
[.docs.examples]gnv$'ap_name'.opt
|
|
$ i = i + 1
|
|
$ goto example_loop
|
|
$example_loop_end:
|
|
$!
|
|
$! clean up the copy.
|
|
$ purge [.docs.examples]gnv$*.opt
|
|
$ rename [.docs.examples]gnv$*.opt ;1
|
|
$ endif
|
|
$!
|
|
$!
|
|
$ if tests .ne. 0
|
|
$ then
|
|
$ libtest_apps = "lib500,lib501,lib502,lib503,lib504,lib505,lib506,lib507"
|
|
$ libtest_apps = libtest_apps + ",lib508,lib510,lib511,lib512,lib513,lib514"
|
|
$ libtest_apps = libtest_apps + ",lib515,lib516,lib517,lib518,lib519,lib520"
|
|
$ libtest_apps = libtest_apps + ",lib521,lib523,lib524,lib525,lib526,lib527"
|
|
$ libtest_apps = libtest_apps + ",lib529,lib530,lib532,lib533,lib536,lib537"
|
|
$ libtest_apps = libtest_apps + ",lib539,lib540,lib541,lib542,lib543,lib544"
|
|
$ libtest_apps = libtest_apps + ",lib545,lib547,lib548,lib549,lib552,lib553"
|
|
$ libtest_apps = libtest_apps + ",lib554,lib555,lib556,lib557,lib558,lib559"
|
|
$ libtest_apps = libtest_apps + ",lib560,lib562,lib564"
|
|
$ i = 0
|
|
$libtest_loop:
|
|
$ ap_name = f$element(i, ",", libtest_apps)
|
|
$ if ap_name .eqs. "," then goto libtest_loop_end
|
|
$ if ap_name .eqs. "" then goto libtest_loop_end
|
|
$ copy 'default_dir'gnv_template_linker.opt -
|
|
[.tests.libtest]gnv$'ap_name'.opt
|
|
$ i = i + 1
|
|
$ goto libtest_loop
|
|
$libtest_loop_end:
|
|
$!
|
|
$! clean up the copy.
|
|
$ purge [.tests.libtest]gnv$*.opt
|
|
$ rename [.tests.libtest]gnv$*.opt ;1
|
|
$ endif
|
|
$!
|
|
$!
|
|
$! Build the Message file.
|
|
$!--------------------------
|
|
$ if f$search("[.projects.vms]curlmsg.obj") .eqs. ""
|
|
$ then
|
|
$ message [.projects.vms]curlmsg.msg/object=[.projects.vms]
|
|
$ endif
|
|
$ if f$search("gnv$curlmsg.exe") .eqs. ""
|
|
$ then
|
|
$ link/share=gnv$curlmsg.exe [.projects.vms]curlmsg.obj
|
|
$ endif
|
|
$!
|
|
$!
|
|
$!
|
|
$! Need to build the common init module.
|
|
$!-------------------------------------------
|
|
$ init_obj = "[.projects.vms]curl_crtl_init.obj"
|
|
$ if f$search(init_obj) .eqs. ""
|
|
$ then
|
|
$ cc'cflags' 'default_dir'curl_crtl_init.c/obj='init_obj'
|
|
$ purge 'init_obj'
|
|
$ rename 'init_obj' ;1
|
|
$ endif
|
|
$!
|
|
$all_exit:
|
|
$!
|
|
$ set def 'default_dir'
|
|
$!
|
|
$! Verify can break things in bash, especially in Configure scripts.
|
|
$ set nover
|
|
$ exit
|