Improve zlib Windows library detection for future zlib versions#1070
Conversation
|
The CI failures are unrelated to this PR — all three Windows jobs fail with: This appears to be a pre-existing issue in the test workflow configuration where |
CI Status UpdateThe Windows CI jobs now progress significantly further than before this PR — builds run for ~9 minutes (compiling all libraries successfully) instead of failing immediately at startup. What this PR fixes
All three libraries now compile and install successfully on Windows. Remaining CI failure (pre-existing, unrelated)The builds now fail at the final PHP linking stage with unresolved symbols: The linker command includes: But is missing transitive dependencies: This is a separate issue in the extension/library dependency resolution for Windows — This would need to be addressed in the extension configuration ( |
|
Remove the unrelated changes please. And I don't understand why the zlib diff is so large. |
| if ($found !== 'zlibstatic.lib') { | ||
| FileSystem::copy(BUILD_LIB_PATH . '\\' . $found, BUILD_LIB_PATH . '\zlibstatic.lib'); | ||
| } |
There was a problem hiding this comment.
what is this? you check for found === null earlier.
| FileSystem::removeFileIfExists(BUILD_ROOT_PATH . '\bin\zlib.dll'); | ||
| FileSystem::removeFileIfExists(BUILD_LIB_PATH . '\zlib.lib'); | ||
| FileSystem::removeFileIfExists(BUILD_LIB_PATH . '\libz.dll'); | ||
| FileSystem::removeFileIfExists(BUILD_LIB_PATH . '\libz.lib'); | ||
| FileSystem::removeFileIfExists(BUILD_LIB_PATH . '\z.lib'); | ||
| FileSystem::removeFileIfExists(BUILD_LIB_PATH . '\z.dll'); | ||
| FileSystem::removeFileIfExists(BUILD_ROOT_PATH . '\bin\z.dll'); | ||
| FileSystem::removeFileIfExists(BUILD_ROOT_PATH . '\bin\libz.dll'); |
| foreach (['zlib.lib', 'z.lib', 'libz.lib'] as $implib) { | ||
| $path = BUILD_LIB_PATH . '\\' . $implib; | ||
| if ($implib !== $found) { | ||
| FileSystem::removeFileIfExists($path); | ||
| } | ||
| } |
There was a problem hiding this comment.
the loop made it longer than it was before
zlib 1.3.3+ may produce libz.lib instead of the earlier naming conventions (zlibstatic.lib, zs.lib, libzs.lib). Add it to the detection list so the build can find the static library.
2a83799 to
52ca33e
Compare
|
Done — stripped down to a single-line change (just adding |
Summary
Builds on #1066 with three improvements to the zlib Windows library detection:
libz.libcandidate — zlib 1.3.3+ may produce this name, which the current detection list missesRuntimeExceptioninstead of silently continuing with a broken build statebin/where cmake actually puts themWe hit this in our fork when building with newer zlib versions on Windows and the build silently failed because the copy target didn't exist.
Changes
src/SPC/builder/windows/library/zlib.phplibz.libto detect listBUILD_ROOT_PATH/bin/consistently