You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the one hand, among enhancements and bug fixes, zlib 1.3.2 had a completely rewrite on their CMake support.
Note
CMake is one of the main build systems used by Windows developers to build C/C++ software from source nowadays.
On the other hand, due these changes targeting CMake support, zlib's developers introduced a breaking change:
the DLL name changed (used to be zlib1.dll on MSVC or libzlib1.dll on MinGW/MinGW-w64, now it is z.dll on MSVC or libz.dll on MinGW/MinGW-w64);
the name of the import library also changed (used to zlib.lib on MSVC or libzlib.dll.a on MinGW/MinGW-w64, now it is z.lib on MSVC or libz.dll.a on MinGW/MinGW-w64);
Due these breaking changes explained above, whenever the user built zlib 1.3.2 from source with CMake, the build of lua-zlib through LuaRocks is going to fail.
Temporary and quick solutions to fix this build issue
The easiest solution, which is far from the best scenario, is to ask users to stick to zlib version 1.3.1 or older
The second solution, which is relatively easy to apply, is:
For MSVC users willing to use zlib 1.3.2, ask them to copy the new import library (z.lib) to the legacy import library (zlib.lib);
For MinGW/MinGW-w64 users with zlib 1.3.2, ask them to copy the new dll (libz.dll) to the legacy dll (libzlib1.dll);
The proper solution
The solution to handle both the legacy (1.3.1 and older) and current zlib versions through LuaRocks involve a comparison of versions to decide dynamically the correct import library to use.
There are ways to do that:
with Makefiles (one for nmake - the MSVC make, and another for mingw32-make - the MinGW/MinGW-w64 make). This tends to be quite portable, because nmake is always installed with MSVC, and the user often has mingw32-make in a MinGW/MinGW-w64 installation;
with CMake itself (would require CMake to be installed). Only C/C++ developers usually have this tool installed, so it is not too portable;
Description
Important
The discussion below only applies to Windows.
Warning
This is a long issue description.
Recently, zlib 1.3.2 was released.
On the one hand, among enhancements and bug fixes, zlib 1.3.2 had a completely rewrite on their CMake support.
Note
CMake is one of the main build systems used by Windows developers to build C/C++ software from source nowadays.
On the other hand, due these changes targeting CMake support, zlib's developers introduced a breaking change:
zlib1.dllon MSVC orlibzlib1.dllon MinGW/MinGW-w64, now it isz.dllon MSVC orlibz.dllon MinGW/MinGW-w64);zlib.libon MSVC orlibzlib.dll.aon MinGW/MinGW-w64, now it isz.libon MSVC orlibz.dll.aon MinGW/MinGW-w64);Due these breaking changes explained above, whenever the user built zlib 1.3.2 from source with CMake, the build of
lua-zlibthrough LuaRocks is going to fail.Reproduction
I wrote a GitHub workflow to reproduce this issue comparing versions 1.3.1 and 1.3.2: log in to GitHub and inspect the runs https://github.com/luau-project/ci-tests/actions/runs/22404458107
Click here to toggle the workflow
Temporary and quick solutions to fix this build issue
z.lib) to the legacy import library (zlib.lib);libz.dll) to the legacy dll (libzlib1.dll);The proper solution
The solution to handle both the legacy (1.3.1 and older) and current zlib versions through LuaRocks involve a comparison of versions to decide dynamically the correct import library to use.
There are ways to do that:
nmake- the MSVC make, and another formingw32-make- the MinGW/MinGW-w64 make). This tends to be quite portable, becausenmakeis always installed with MSVC, and the user often hasmingw32-makein a MinGW/MinGW-w64 installation;luaposix, see https://luarocks.org/manifests/gvvaughan/luaposix-36.3-1.rockspec) through the tool https://github.com/gvvaughan/luke.PS
In my view, ranking in portability order, the preferred methods to solve this issue would be: 1 - build command; 2 - Makefiles; 3 - CMake.
However, in a realistic scenario, Makefiles would provide the best balance between
difficultyandtime to marketto solve this.Note
Slowly, I'll investigate the build command and Makefiles solutions to this issue. However, I cannot guarantee anything.