Files
jak-project/third-party/curl/projects/vms
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
..

                             _   _ ____  _
                         ___| | | |  _ \| |
                        / __| | | | |_) | |
                       ( (__| |_| |  _ <| |___
                        \___|\___/|_| \_\_____|
                             for OpenVMS

History:

09-MAR-2004, Created this readme. file.  Marty Kuhrt (MSK).
15-MAR-2004, MSK, Updated to reflect the new files in this directory.
14-FEB-2005, MSK, removed config-vms.h_with* file comments
10-FEB-2010, SMS. General update.
14-Jul-2013, JEM, General Update, add GNV build information.


The release notes installed by the PCSI kit consist of this file and the
curl_gnv_build_steps.txt and other useful information.

Prerequisites:

OpenVMS v7.0 or later (any platform)
DECC v6.5 or later
OpenSSL or HP SSL, if you want SSL support

What is Here:

This directory contains the following files for a DCL based build.

backup_gnv_curl_src.com  This procedure backs up the source modules for
                        creating a PCSI kit.

build_curl-config_script.com
                        Procedure to create the curl-config script.

build_gnv_curl.com      This procedure does a build of curl using the
                        GNV utilities and then uses DCL tools to build
                        the libcurl shared image.  The setup_gnv_curl_build.com
                        procedure must be run first.

build_gnv_curl_pcsi_desc.com
                        This procedure builds the pcsi$desc file for
                        creating a PCSI based package.

build_gnv_curl_pcsi_text.com
                        This procedure builds the pcsi$text file for
                        creating a PCSI based package.

build_gnv_curl_release_notes.com
                        This procedure creates the release notes for
                        a PCSI kit based on curl_release_note_start.txt,
                        this readme file, and the curl_gnv_build_steps.txt

build_libcurl_pc.com    Procedure to create a libcurl.pc file.

build_vms.com           DCL based build procedure.

clean_gnv_curl.com      This procedure cleans up the files generated by
                        a GNV based build.

config_h.com            DCL based procedure used by build_vms.com
                        to run generate the curl_config.h file.
                        This is a generic procedure that does most
                        of the work for generating config.h files.

compare_curl_source.com Procedure to compare the working directory
                        with a repository directory or a backup staging
                        directory.

curl_crtl_init.c        A special pre-initialization routine to for
                        programs to behave more Unix like when run
                        under GNV.

curl_gnv_build_steps.txt
                        Detailed instructions on how to built curl using
                        GNV and how to build the libcurl shared image and
                        PCSI kit.

curl_release_note_start.txt
                        The first part of the curl release notes.

curl_startup.com        A procedure run at VMS startup to install the
                        libcurl shared image and to set up the needed
                        logical names.

curlmsg.h               C header defining curl status code macros.

curlmsg.msg             Error message source for curlmsg.h and curlmsg.sdl.

curlmsg.sdl             SDL source defining curl status code constants.

curlmsg_vms.h           Mapping of curl status codes to VMS-form codes.

generate_config_vms_h_curl.com
                        DCL procedure to generate the curl specific
                        definitions for curl_config.h that config_h.com
                        can not properly generate.

generate_vax_transfer.com
                        DCL procedure to read an Alpha/IA64 symbol vector
                        linker option file and generate the VAX transfer
                        vector modules.

gnv_conftest.c_first    A helper file for the configure script.

gnv_curl_configure.sh   A script to run the configure script with the
                        options needed for VMS.

gnv_libcurl_symbols.opt The symbol vectors needed for Alpha and IA64
                        libcurl shared image.

gnv_link_curl.com       Links the libcurl shared image and then links a curl
                        image to use the libcurl.

macro32_exactcase.patch The patch file needed to modify VAX Macro32 to be
                        case sensitive and case preserving.

Makefile.am             curl kit file list for this directory.

Makefile.in             curl kit makefile source for this directory.

make_gnv_curl_install.sh
                        Script to do a make install using GNV after running
                        the configure script.

make_pcsi_curl_kit_name.com
                        This generates the name of the PCSI kit based on
                        the version of curl being built.

pcsi_gnv_curl_file_list.txt
                        This is a text file describing what files should
                        be included in a PCSI kit.

pcsi_product_gnv_curl.com
                        This generates the PCSI kit after the libcurl
                        shared image has been made.

readme.                 This file.

report_openssl_version.c
                        Program to check that the OpenSSL version is new
                        enough for building a shared libcurl image.

setup_gnv_curl_build.com
                        This procedure sets up symbols and logical names
                        for a GNV build environment and also copies some
                        helper files.

stage_curl_install.com  This procedure sets up new_gnu: directory tree to
                        for testing the install and building the PCSI kit.
                        It takes a "remove" option to remove all the staged
                        files.

vms_eco_level.h         This sets the ECO level for the PCSI kit name.


How to Build:

The GNV based build and the DCL based build procedures are not compatible
and you must make sure that none of the build files are present before
running a different type of build.  Use the "REALCLEAN" option for
BUILD_VMS.COM and the "REALCLEAN" option for clean_gnv_curl.com.

The (brute-force) DCL based builder is [.projects.vms]build_vms.com.
Comments in this procedure describe various optional parameters which
enable or disable optional program features, or which control the build
in other ways.  Product files (.EXE, .H, .LIS, .MAP, .OBJ, .OLB, ...)
should be produced in an architecture-specific subdirectory under this
directory ([.ALPHA], [.IA64], [.VAX]).

The file curl_gnv_build_steps.txt contains information on building using
the GNV tool kit, building a shared libcurl, and producing a PCSI kit for
distribution.  The curl_gnv_build_steps.text is included in the release
notes file of the PCSI kit.

The building with 64-bit pointers does not currently work.

The build procedure will detect if HP OpenSSL, LDAP, and Kerberos are
installed and default to building with them.

The build procedure will also detect if a compatible ZLIB shared image
is installed from a PCSI kit and default to using it.

   Example build commands:

      @ [.projects.vms]build_vms.com CLEAN
      @ [.projects.vms]build_vms.com LARGE LDAP
      submit /noprint [.projects.vms]build_vms.com /param = (LARGE, LDAP)

The build_vms.com procedure does not build the shared image file or the PCSI
kit.  If you have built a curl with ZLIB and HPSSL support as well as if
LDAP and Kerberos installed, you can use the GNV_LINK_CURL.COM file.

The GNV_LINK_CURL.COM contains information on how to link and run with a newer
version of HP SSL than what may be install on an Alpha or IA64 based system.

To build the PCSI kit, follow the instructions in the file
curl_gnv_build_steps.txt.

Other Notes:

This release fixes known bugs #22, and #57 in the [curl.docs]known_bugs.
file.

The libcurl formdata.c module and curl tools post form now have some
understanding of VMS file types.  Files will be posted in STREAM_LF format.

The curl tool now has some understanding of VMS file types and will upload the
files in STREAM_LF format.

When curl is uploading a VARIABLE format VMS file, it is less efficient as in
order to get the file size, it will first read the entire file once, and then
read the file again for the actual upload.

The curl tool will now always download files into STREAM_LF format.  Even if a
file by that name with a different format already exists.  This is needed to
allow interrupted downloads to be continued.


The libcurl file module still does not understand VMS file types and requires
the input files to be in STREAM_LF to work property.

The test suites are not supported as of 7.11.0.

The curlmsg.sdl and curlmsg.h files are generated from curlmsg.msg.
This is not done automatically, since the .MSG file is a hand edit
of the relevant stuff from the curl.h file.  If you want to do this
yourself you need the SDL package from the freeware collection.