Skip to content

GHA/windows: stop using MSYS2/mingw zlib in an MSVC job - #24040

Closed
vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:zlibng
Closed

vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:zlibng

Conversation

@vszakats

@vszakats vszakats commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Drop zlib from the MSVC CI job as this is fragile, potentially unsafe,
and requires hacks to make it build:

  • zlib includes or wants to include unistd.h from its public headers,
    also on Windows. (it's available in mingw-w64, not in MSVC)
  • defines non-zlib namespaced, commonly-used HAVE_UNISTD_H in its
    public headers.
  • above only happens if zlib was built with cmake (in 1.3.1.2+).
  • hardcodes build-time environment properties into its public header,
    meaning its headers cannot be safely used in a cross-build or in a
    different target env.
  • HAVE_UNISTD_H became unused in 1.4, but still set. It may
    break dependent 1st-party code that uses this symbol to communicate
    unistd.h presence.
  • the z_off_t type is not fixed-size, and depends on non-standard type
    off_t, that depends e.g. on unistd.h.
  • due to z_off_t depending on the above logic, the ABI may break in an
    affected API e.g. gzseek*(), gztell*(), gzoffset*(), when some
    of the consume-time logic differs from the build-time one. (curl not
    using these functions, but there may be more.)
    E.g. using an MSYS2/mingw UCRT x64-built zlib.dll in an equivalent
    MSVC build.
  • zlib-ng also includes unistd.h, and depends on off_t. It does not
    define HAVE_UNISTD_H though.

Follow-up to 9584627 #24037
Follow-up to c129d0b #17561


The root of evil here is that the API uses a type that has a loosly
defined size, and then many kinds of fragile craziness is necessary
to keep this in sync with env, headers and the binary. Probably
introducing a fixed 64-bit type and always enabling 64-bit APIs
internally would fix this, at least on Windows, where a build-time
env is not necessary the same as the consume-time env.

@github-actions github-actions Bot added Windows Windows-specific CI Continuous Integration labels Nov 18, 2026
@vszakats vszakats closed this Nov 18, 2026
@vszakats
vszakats deleted the zlibng branch November 18, 2026 16:06
@vszakats vszakats changed the title GHA/windows: replace mainline zlib with zlib-ng to avoid crazy stuff [TEST] GHA/windows: replace mainline zlib with zlib-ng to avoid crazy stuff Nov 18, 2026
@vszakats vszakats changed the title [TEST] GHA/windows: replace mainline zlib with zlib-ng to avoid crazy stuff [TEST] GHA/windows: try replacing mainline zlib with zlib-ng to avoid crazy stuff Nov 18, 2026
@vszakats
vszakats restored the zlibng branch November 18, 2026 16:11
@vszakats vszakats reopened this Nov 18, 2026
@vszakats vszakats changed the title [TEST] GHA/windows: try replacing mainline zlib with zlib-ng to avoid crazy stuff [TEST] GHA/windows: stop using MSYS2/mingw zlib in an MSVC job Nov 18, 2026
@vszakats vszakats changed the title [TEST] GHA/windows: stop using MSYS2/mingw zlib in an MSVC job GHA/windows: stop using MSYS2/mingw zlib in an MSVC job Nov 18, 2026
@vszakats vszakats closed this in 4830b39 Nov 19, 2026
@vszakats
vszakats deleted the zlibng branch November 19, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

2 participants