build(deps): bundle zlib 1.3.1 under third_party/ (#2651). Principle III.#2698
Conversation
…III. zlib was added by PR #2641 as a runtime dependency for raw-deflate decompression of .ssdr_cfg ZIP packages. The original implementation linked the system zlib on Linux/macOS and pulled vcpkg's zlib on Windows + copied zlib1.dll into the installer. That split-source pattern deviates from the constitution's Technology Constraint: > Third-party: vendor under third_party/ with THIRD_PARTY_LICENSES > updated. Prefer bundled libraries over package-manager dependencies > for portability (see libmosquitto bundling for MQTT, #699). This change bundles zlib 1.3.1 in third_party/zlib/ (vendored from madler/zlib's GitHub release; sha256 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23) and links zlibstatic via the upstream CMakeLists.txt: CMakeLists.txt - find_package(ZLIB REQUIRED) + set(ZLIB_BUILD_EXAMPLES OFF) / SKIP_INSTALL_ALL ON + add_subdirectory(third_party/zlib EXCLUDE_FROM_ALL) - ZLIB::ZLIB + zlibstatic .github/workflows/ci.yml - "Install zlib via vcpkg" step (sets VCPKG_ROOT, runs vcpkg install) + small comment pointing at the bundled tree .github/workflows/windows-installer.yml - "Install zlib via vcpkg" step (same as ci.yml) - zlib*.dll copy into deploy/ (no DLL needed; statically linked) THIRD_PARTY_LICENSES — adds the zlib entry (entry #13). Trimmed from the vendored tree (kept lean while still building): amiga/ contrib/ doc/ examples/ msdos/ nintendods/ old/ os400/ qnx/ watcom/. Kept win32/ because zlib's own CMakeLists.txt references win32/zlib1.rc for the shared-library target unconditionally. Verified: * cmake configure clean, AetherSDR builds + links clean (no direct NEEDED on libz in objdump -p; only Qt's transitive use of system zlib remains, unrelated to our code). * profile_transfer_test passes. * Single source-of-truth zlib version across Linux, macOS, and Windows. No vcpkg cache miss → Windows CI no longer waits on vcpkg's first-build slow path. Self-contained Windows installer artifact (no zlib1.dll to ship separately). Closes #2651. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Thanks @ten9876 — this is a clean, well-scoped vendoring change. Minimal blast radius outside third_party/ (only 4 files, +31/-25), and the constitution-alignment rationale is documented both in the PR body and inline at CMakeLists.txt:43-50 and THIRD_PARTY_LICENSES entry #13. Verified on main that ZLIB::ZLIB had only one consumer (AetherSDR itself), so dropping find_package(ZLIB REQUIRED) doesn't orphan any other target — Qt's transitive system-zlib use is correctly called out as out-of-scope.
A few small things, none blocking:
-
Trim list slightly inconsistent with PR body. The description lists the directories that were trimmed, but the vendored tree still contains
test/(example.c,infcover.c,minigzip.c),zlib.3,zlib.3.pdf,make_vms.com, andMakefile.bor. WithZLIB_BUILD_EXAMPLES OFF+EXCLUDE_FROM_ALLthey're inert, but if the goal was a lean vendor tree (and to keep the diff easier to re-vendor on the next bump),test/,make_vms.com,Makefile.bor, and the manpage PDF are safe to drop too. Optional — purely a hygiene thing. -
Worth confirming MSVC CRT flag consistency. zlib 1.3.1's
CMakeLists.txtdoesn't override/MDvs/MT, so it inherits whatever CMake picks for the project, which should match AetherSDR. The fact that you've verified the Windows installer artifact builds cleanly is the real test, but if Windows CI hasn't been re-run since the rebase, that's the one box left to tick. -
zlibstaticinclude propagation. Upstream zlib 1.3.1 setstarget_include_directories(zlibstatic PUBLIC ...)on both source and binary dirs (the latter for the generatedzconf.h), so AetherSDR TUs that#include <zlib.h>should resolve via the target's INTERFACE properties — no extratarget_include_directoriesneeded in our top-levelCMakeLists.txt. You've already verified the Linux/macOS build, so this is just noting the mechanism for future readers. -
Optional follow-up: consider adding a
THIRD_PARTY_VERSIONS(or extending theTHIRD_PARTY_LICENSESentry) with a one-line "to bump: download v$X tarball, verify sha256, drop intothird_party/zlib/, re-trim per this list." Will save the next person 30 minutes when zlib 1.3.2 lands.
LGTM as a Principle III correctness fix. Single source of truth across all three platforms is the right call, and avoiding the zlib1.dll copy in the Windows installer is a nice ergonomics win.
There was a problem hiding this comment.
Thanks @ten9876 — clean execution of the constitution's bundled-deps preference, and it nicely mirrors the libmosquitto pattern (#699).
The integration touchpoints all look right to me:
add_subdirectory(third_party/zlib EXCLUDE_FROM_ALL)+target_link_libraries(... zlibstatic)is the correct shape — upstream zlib 1.3.1's CMakeLists setstarget_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})(lines 153–155), so<zlib.h>propagates through the link without needing a separatetarget_include_directorieson AetherSDR. Good — I had to double-check that sincefind_package(ZLIB)users sometimes get burned bundling zlib viaadd_subdirectory.ZLIB_BUILD_EXAMPLES OFF+SKIP_INSTALL_ALL ONkeep the example targets and theinstall(TARGETS zlib zlibstatic …)block from leaking into our install tree. ✓- Removing the vcpkg step from both
ci.ymlandwindows-installer.yml, plus thezlib*.dllcopy fromwindows-installer.yml, are consistent with the static-link decision. ✓ THIRD_PARTY_LICENSESentry #13 has copyright, license name, source URL, and version — matches the format of the existing entries. ✓- Trim list (amiga/contrib/doc/examples/msdos/nintendods/old/os400/qnx/watcom) plus the noted exception for
win32/(zlib's CMakeLists unconditionally referenceswin32/zlib1.rcfor the shared target) is correct. ✓
A few small notes, none blocking:
- CMake deprecation warning at configure time. Upstream zlib's
cmake_minimum_required(VERSION 2.4.4...3.15.0)will produce a deprecation warning under CMake ≥ 3.27 because the floor is below 3.5. Purely cosmetic, can't fix without forking the vendored tree — worth knowing if reviewers see warning noise in CI logs. - Qt's transitive system zlib remains. Your verification note already calls this out, but flagging it for future readers: Qt6 still pulls in the system libz dynamically (via QtCore on Linux), so on Linux/macOS the process has both our statically-linked zlib 1.3.1 and the system libz mapped. That's normal and the symbols don't conflict (static lib's symbols are internal-only), but it's a "two zlib's in the process" thing worth being aware of if anyone ever debugs strange compression-related behavior.
- Self-contained Windows installer is a real win — agree the artifact no longer needing
zlib1.dllshipped separately is the cleanest outcome here.
LGTM as a comment review. Nice cleanup.
zlib was added by PR #2641 as a runtime dependency for raw-deflate
decompression of .ssdr_cfg ZIP packages. The original implementation
linked the system zlib on Linux/macOS and pulled vcpkg's zlib on
Windows + copied zlib1.dll into the installer. That split-source
pattern deviates from the constitution's Technology Constraint:
This change bundles zlib 1.3.1 in third_party/zlib/ (vendored from
madler/zlib's GitHub release; sha256
9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23) and
links zlibstatic via the upstream CMakeLists.txt:
CMakeLists.txt
- find_package(ZLIB REQUIRED)
+ set(ZLIB_BUILD_EXAMPLES OFF) / SKIP_INSTALL_ALL ON
+ add_subdirectory(third_party/zlib EXCLUDE_FROM_ALL)
- ZLIB::ZLIB
+ zlibstatic
.github/workflows/ci.yml
- "Install zlib via vcpkg" step (sets VCPKG_ROOT, runs vcpkg install)
+ small comment pointing at the bundled tree
.github/workflows/windows-installer.yml
- "Install zlib via vcpkg" step (same as ci.yml)
- zlib*.dll copy into deploy/ (no DLL needed; statically linked)
THIRD_PARTY_LICENSES — adds the zlib entry (entry #13).
Trimmed from the vendored tree (kept lean while still building):
amiga/ contrib/ doc/ examples/ msdos/ nintendods/ old/ os400/ qnx/
watcom/. Kept win32/ because zlib's own CMakeLists.txt references
win32/zlib1.rc for the shared-library target unconditionally.
Verified:
direct NEEDED on libz in objdump -p; only Qt's transitive
use of system zlib remains, unrelated to our code).
Windows. No vcpkg cache miss → Windows CI no longer waits on
vcpkg's first-build slow path. Self-contained Windows installer
artifact (no zlib1.dll to ship separately).
Closes #2651.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com