Skip to content

Fix Windows build: exclude CZlib where system zlib is absent#9

Merged
powerje merged 1 commit into
trunkfrom
fix-windows-zlib
Jun 29, 2026
Merged

Fix Windows build: exclude CZlib where system zlib is absent#9
powerje merged 1 commit into
trunkfrom
fix-windows-zlib

Conversation

@powerje

@powerje powerje commented Jun 29, 2026

Copy link
Copy Markdown
Member

The build (windows-latest) CI job has been failing (pre-existing — also red on trunk) with:

Sources/CZlib/include/CZlib.h:4:10: fatal error: 'zlib.h' file not found

zlib ships with the macOS SDK and the Linux Swift toolchain but not on Windows, so the CZlib wrapper can't compile there.

The MTHCore → CZlib dependency is now gated with .when(platforms: [.macOS, .linux]). A platform condition is evaluated against the build destination, so this is also correct under cross-compilation — unlike a manifest #if os(Windows), which keys off the host that evaluates the manifest (it would pull CZlib into a cross-compile to Windows, and drop it from a cross-compile from Windows to Linux). On any non-listed destination, CZlib drops out of the build graph and the #if canImport(CZlib)-guarded MCCP compression compiles out; macOS/Linux are unchanged.

Manifest only — no source changes.

Note: the sibling Cmth/CmthColor C-oracle targets still use a host-based #if !os(Windows) block. That has the same host-vs-destination limitation, but those are entangled with their product declarations and are C targets that can't build on Windows at all, so converting them is a separate change; the native Windows CI runner is unaffected.

@powerje
powerje force-pushed the fix-windows-zlib branch from 7273372 to 51827fb Compare June 29, 2026 10:05
@powerje
powerje merged commit ffbf0f7 into trunk Jun 29, 2026
5 checks passed
@powerje
powerje deleted the fix-windows-zlib branch June 29, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant