Repository navigation
Conversation
This reverts commit d1dba3e.
HAVE_UNISTD_H confusionHAVE_UNISTD_H set by zlib public header
HAVE_UNISTD_H set by zlib public headerHAVE_UNISTD_H set by zlib public header
Member
Author
|
Perhaps it'd make sense to switch to zlib-ng to avoid repeat issues like this. |
This was referenced Nov 18, 2026
vszakats
added a commit
that referenced
this pull request
Nov 19, 2026
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 Closes #24040
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
zlib 1.3.1.2+ built with cmake sets
HAVE_UNISTD_Hto1in its publicheader when the zlib build environment detected
unistd.h. This breaksdependents that rely on this macro, when the zlib-build-time value differs
from the actual target build environment, as in curl CI, which uses the
mingw-built package in an MSVC build.
The issue surfaced when the MSYS2 package switched to using cmake
while bumping from 1.3.2 to 1.4, and this propagated into the Windows
runner, causing:
Ref: https://github.com/curl/curl/actions/runs/44311921832/job/134828014535?pr=24037#step:11:35
Refs:
madler/zlib@3d6dc3c#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aR39-R41
msys2/MINGW-packages@5cbcc05
msys2/MINGW-packages#33269
Bug: #24036 (comment)
Follow-up to c129d0b #17561