Skip to content

[zlib] Update to 1.3.2#51235

Merged
BillyONeal merged 44 commits into
microsoft:masterfrom
dg0yt:zlib
Apr 23, 2026
Merged

[zlib] Update to 1.3.2#51235
BillyONeal merged 44 commits into
microsoft:masterfrom
dg0yt:zlib

Conversation

@dg0yt

@dg0yt dg0yt commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Continued from #50538 by @scschaefer.
Resolves #50060.
Closes #50843.

Downstream fixes as needed:

  • to avoid the new ZLIB CMake config package when the actual use is ZLIB_LIBRARIES,
  • to adapt to the new binary names on windows (z, zs) and to the debug suffix now on all platforms (d),
  • to fix arbitary installation order bugs in the cone of destruction,
  • to avoid a symbol name clash for crc32 with port elfutils.
    (The symbol was already there, maybe the signature changed a little bit. I don't know why it didn't occur earlier.)

serf got a little bit more work, to ensure that all three deps are handled in a consistent way and to not mix debug and release paths.

qt5-base[postgresqlplugin](windows & !static) was probably already broken with libpq 18.3 - it is not in the cone of destruction for libpq. It should be reviewed and tested with the fixes to libpq (separate PR).

@dg0yt dg0yt marked this pull request as ready for review April 22, 2026 13:17
@BillyONeal

Copy link
Copy Markdown
Member

Thank you so much! I'm sorry that the arm64-linux configuration has been such a thorn in everyone's side. This time it looks like it might be legitimate though :(

@BillyONeal BillyONeal marked this pull request as draft April 22, 2026 23:57
@dg0yt

dg0yt commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

This time it looks like it might be legitimate though :(

I think it is a race, and I will just run CI again.

@dg0yt

dg0yt commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

This time it looks like it might be legitimate though :(

I think it is a race, and I will just run CI again.

The ffmpeg situation (fftools/Makefile et al.) is like this Makefile:

first:
	$(MAKE) clean
	$(MAKE) build

clean:
	rm -Rf subdir

build: subdir/secondary-output

subdir/secondary-output: | subdir

subdir/secondary-output: subdir/primary-output
	cp subdir/primary-output subdir/secondary-output

subdir/primary-output:
	touch subdir/primary-output

subdir:
	sleep 2
	mkdir subdir

which even without concurrency produces

/tmp/foo$ LANG=C make
make clean
make[1]: Entering directory '/tmp/foo'
rm -Rf subdir
make[1]: Leaving directory '/tmp/foo'
make build
make[1]: Entering directory '/tmp/foo'
touch subdir/primary-output
touch: cannot touch 'subdir/primary-output': No such file or directory
make[1]: *** [Makefile:16: subdir/primary-output] Error 1
make[1]: Leaving directory '/tmp/foo'
make: *** [Makefile:3: first] Error 2

The secondary output (fftools/resources/graph.html.o) depends on the subdir (fftools/resources) and transitively on primary output (fftools/resources/graph.html.c from fftools/resources/graph.html.gz). Compiling the C source is depending on the subdir, but creating the primary outputs is independent.

A fix might apply the approach chosen for the first target, but it is out of scope for this PR.

@dg0yt dg0yt marked this pull request as ready for review April 23, 2026 10:49
@dg0yt

dg0yt commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

All checks have passed. Use it or loose it.

@BillyONeal BillyONeal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THANK YOU 1000%

@BillyONeal BillyONeal merged commit f777374 into microsoft:master Apr 23, 2026
16 checks passed
@dg0yt dg0yt deleted the zlib branch April 23, 2026 20:49
@Neustradamus

Copy link
Copy Markdown

@Green-Sky

Green-Sky commented May 9, 2026

Copy link
Copy Markdown

This breaks ports that depend on zlib with the x64-windows-static triplet when using find_package CONFIG is used.
This can be seen by setting CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON in
(eg. freetype, libpng)

For me this breaks my vendored sdl3_image, since they set it if undefined.

I am working around this by setting it to OFF, but this worked before as is.

It is possible this breaks other triplets too, but this is the only one I use.

@dg0yt

dg0yt commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

Upstream made a patch release which fixes a CVE, introduces signifcant CMake changes, and renames binaries. "This" PR updated the port and adjusted downstream ports as needed. Including removing some usage of CMAKE_FIND_PACKAGE_PREFER_CONFIG which didn't break for the first time when packages introduced CMake config.

If unhappy with upstream's choices, please go there and report.

Comment thread ports/dlib/portfile.cmake
${COMMON_OPTIONS}
-DDLIB_PNG_SUPPORT=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_PNG=ON
-Dtest_for_libpng_worked=TRUE # try_compile ignores vcpkg setup

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? try_compile should see the toolchain and variables should be passed through.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it doesn't describe the problem correctly.

Unfortunately I cannot reproduce it now, but there are CI logs where the try_compile test failed for some triplets, e.g. x64-windows-static:

        FAILED: [code=2] CMakeFiles/libpng_test.dir/libpng_test.cpp.obj 
        C:\\PROGRA~1\\MICROS~1\\2022\\ENTERP~1\\VC\\Tools\\MSVC\\1444~1.352\\bin\\Hostx64\\x64\\cl.exe  /nologo /TP   /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\\libpng_test.dir\\libpng_test.cpp.obj /FdCMakeFiles\\libpng_test.dir\\ /FS -c D:\\b\\dlib\\src\\v20.0.1-f170b8e716.clean\\dlib\\cmake_utils\\test_for_libpng\\libpng_test.cpp
        D:\\b\\dlib\\src\\v20.0.1-f170b8e716.clean\\dlib\\cmake_utils\\test_for_libpng\\libpng_test.cpp(3): fatal error C1083: Cannot open include file: 'png.h': No such file or directory

I couldn't spot the root cause in reasonable time for the zlib update. But I came to the conclusion that this test didn't add value: We know that libpng works. (And we could react if the build fails later.) I left the comment to catch the eye of the right person.

FTR these try_compile tests are broken: The CMAKE_FLAGS aren't passed correctly. Everything lands in CMAKE_PREFIX_PATH. Too many quotes here:
https://github.com/davisking/dlib/blob/3d40bf5790ca9073c160cebb898800d9f33e12ab/dlib/cmake_utils/find_libpng.cmake#L20-L29

@jjerphan

Copy link
Copy Markdown
Contributor

I confirm that this breaks projects depending on ZLIB on Windows:

CMake Error at C:/Program Files/CMake/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found suitable version
  "1.3.2", minimum required is "1")

See those logs.

@dg0yt

dg0yt commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

I confirm that this breaks projects depending on ZLIB on Windows:

CMake Error at C:/Program Files/CMake/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found suitable version
  "1.3.2", minimum required is "1")

See those logs.

CMake Error at C:/Program Files/CMake/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found suitable version
  "1.3.2", minimum required is "1")
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.31/Modules/FindZLIB.cmake:202 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  C:/Program Files/CMake/share/cmake-3.31/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
  vcpkg_installed/x64-windows-static-md/share/curl/CURLConfig.cmake:75 (find_dependency)
  libmamba/CMakeLists.txt:623 (find_package)
  libmamba/CMakeLists.txt:760 (libmamba_create_target)

This does not go through the vcpkg.cmake toolchain file.
So it misses vcpkg's cmake wrappers.
So it was unsupported/broken already before this PR.

3nids added a commit to qgis/QGIS that referenced this pull request May 20, 2026
…51235

Drop the REQUIRED + VCPKG_BUILD_TYPE gating in favour of the broader name set used in the upstream vcpkg fix (which also handles the static linkage 'zs.lib' / 'zsd.lib' produced by the new zlib 1.3.2 port).

  release: z zs zlib

  debug:   zd zsd zlibd

Ref: microsoft/vcpkg#51235
3nids added a commit to open-vcpkg/python-registry that referenced this pull request May 20, 2026
vcpkg's zlib port is being updated to 1.3.2 (microsoft/vcpkg PR #51235), whose CMake build sets OUTPUT_NAME=z (shared) / zs (static) on MSVC, so the import library is no longer named zlib.lib / zlibd.lib. The python3 portfile's find_library(NAMES zlib ...) silently returned ZLIB_RELEASE-NOTFOUND, which was passed verbatim into vcpkg_msbuild_install(ADDITIONAL_LIBS_RELEASE ...) and ultimately to link.exe as 'ZLIB_RELEASE-NOTFOUND.obj', producing an opaque LNK1181 error deep in CPython's PCbuild.

Mirror microsoft/vcpkg#51235's exact name set so this port stays consistent with the upstream zlib bump:

  release: z zs zlib

  debug:   zd zsd zlibd
3nids added a commit to qgis/QGIS that referenced this pull request May 26, 2026
…51235

Drop the REQUIRED + VCPKG_BUILD_TYPE gating in favour of the broader name set used in the upstream vcpkg fix (which also handles the static linkage 'zs.lib' / 'zsd.lib' produced by the new zlib 1.3.2 port).

  release: z zs zlib

  debug:   zd zsd zlibd

Ref: microsoft/vcpkg#51235
3nids added a commit to qgis/QGIS that referenced this pull request May 28, 2026
* Bump vcpkg baselines

* error report when building with vcpkg

* handle case when there is no artifact

* do not rely on /tmp

* fix encoding

* link to error log echoed in workflow

* add python overlay to test zlib detection

* [python3 overlay] Skip ZLIB_DEBUG lookup on release-only triplets

VCPKG_BUILD_TYPE=release triplets (e.g. x64-windows-release) don't install debug libs, so find_library(ZLIB_DEBUG ... REQUIRED) fails fatally even though add_libs_dbg is unused in release-only builds. Gate the debug lookup on the build type.

* vcpkg_build_failures_report: surface portfile-execute aborts

Two related fixes for the case where vcpkg fails before any port leaves a parseable buildtree (e.g. a CMake Error in portfile.cmake from find_library REQUIRED, or vcpkg_extract_source_archive download failure). Previously the parser saw nothing and the report claimed 'all ports built ✅' despite a non-zero exit code.

1. parse_failures.py: new --manifest-install-log option that scans vcpkg-manifest-install.log for 'error: building <port>:<triplet> failed with: BUILD_FAILED' lines and 'CMake Error at .../ports/<port>/portfile.cmake' blocks, synthesizing failure records (with excerpts) for ports that never produced a buildtree.

2. format_report.py + action.yml: new build-status input. When the upstream build/configure step failed but no per-port failures were parsed, render a 'vcpkg failed before producing per-port logs' banner with links to the artifacts/run instead of the misleading 'all ports built' line.

Both windows-qt6.yml and build-macos-qt6.yml now pass build-status=${{ job.status }} and manifest-install-log=${{ github.workspace }}/build/vcpkg-manifest-install.log.

* [python3 overlay] Align ZLIB find_library names with microsoft/vcpkg#51235

Drop the REQUIRED + VCPKG_BUILD_TYPE gating in favour of the broader name set used in the upstream vcpkg fix (which also handles the static linkage 'zs.lib' / 'zsd.lib' produced by the new zlib 1.3.2 port).

  release: z zs zlib

  debug:   zd zsd zlibd

Ref: microsoft/vcpkg#51235

* vcpkg_build_failures_report: escape ${{ in build-status description

GitHub evaluates ${{ ... }} expressions inside input descriptions too, so the previous wording caused the composite action to fail to load with 'Unrecognized named-value: job'. Rephrase the description to avoid the expression syntax.

Fixes the action.yml validation error seen in workflow run 69945800777.

* [py-psycopg-c] Fix pg_config path on non-Windows

libpq's portfile uses vcpkg_copy_tools(TOOL_NAMES pg_config ...) without a DESTINATION, so the binary lands at tools/libpq/pg_config — not tools/libpq/bin/pg_config. The else() branch of py-psycopg-c had the wrong path, causing the build to fall back to PATH lookup of pg_config (not present) and fail with 'No such file or directory'. Match the Windows branch which already uses tools/libpq with no /bin.

Failure seen on arm64-osx-dynamic-release / x64-osx-dynamic-release in workflow run 69945800777.

* vcpkg overlays: drop libxml2 and py-psycopg-c (fixed upstream)

Both fixes have landed in their respective upstream registries (microsoft/vcpkg for libxml2, open-vcpkg/python-registry for py-psycopg-c). The overlay copies are no longer needed.

* vcpkg: bump python-registry baseline to 17723c4

Pulls in py-psycopg-c 3.3.4#3 (pg_config path fix) and other recent updates from open-vcpkg/python-registry.

* vcpkg_build_failures_report: surface commit SHA in sticky comment

Adds an optional commit-sha input. When set, the rendered report footer shows a linked short SHA (e.g. 📌 Commit `abc1234`) so reviewers know which revision the sticky comment reflects.

Wired up the windows-qt6 and build-macos-qt6 workflows to pass github.event.pull_request.head.sha (with fallback to github.sha).

* remove python overlay

* Restore libxml2 overlay (dropped prematurely)

* bump python-reg

* vcpkg: bump python-registry baseline to 1578c39

Integrates open-vcpkg/python-registry#240 ([py-psycopg-c] Make it usable without pg_config) which fixes the pg_config path issue on non-Windows post-meson refactor of microsoft/vcpkg's libpq port.

* bump pr

* Update vcpkg.json

* Update vcpkg.json

* Update vcpkg.json

* Update vcpkg.json

* Update vcpkg.json

* Update vcpkg.json

---------

Co-authored-by: 3nids <127259+3nids@users.noreply.github.com>
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.

[zlib] update to 1.3.2

7 participants