zlib icon indicating copy to clipboard operation
zlib copied to clipboard

Build files: consistency of binaries names on Windows between CMakeLists and Makefiles

Open SpaceIm opened this issue 3 years ago • 6 comments

For Windows builds, zlib provides 4 build files:

  • Makefile.gcc for MinGW
  • Makefile.msvc and MSBuild files for Visual Studio
  • CMake

For a given compiler, names of generated binaries are not consistent among these build systems:

MinGW:

build file static shared (import lib & dll)
Makefile.gcc libz.a libz.dll.a & zlib1.dll
CMakeLists.txt libzlibstatic.a libzlib.dll.a & libzlib1.dll

Visual Studio:

build file static shared (import lib & dll)
Makefile.msvc zlib.lib zdll.lib & zlib1.dll
MSBuild zlibstat.lib zlibwapi.lib & zlibwapi.dll
CMakeLists.txt zlibstatic[d].lib zlib[d].lib & zlib[d]1.dll

Wouldn't it be better to follow Makefiles names in CMakeLists.txt? What is considered canonical name for each compiler?

SpaceIm avatar May 13 '22 10:05 SpaceIm

Further to what is described above, when building static zlib using CMake on Windows, the output lib (zlibstatic.lib) does not match what is described in the pkg-config .pc file. As such, if a dependent library were to use pkg-config to resolve a statically built zlib on Windows, it would fail

jheaff1 avatar Aug 07 '22 16:08 jheaff1

Do you or anyone else here have an opinion on what those names should be?

madler avatar Aug 07 '22 22:08 madler

I’m personally not bothered about naming inconsistencies, as long as usage of the pkg-config .pc file works

jheaff1 avatar Aug 08 '22 06:08 jheaff1

With MinGW (and MSYS/Cygwin) the expected names are: libz.a for static and libz.dll.a for the implib. These are recognized by the toolchain as static/shared libs when linking.

vszakats avatar Oct 14 '22 12:10 vszakats

To follow this ticket

Neustradamus avatar Oct 15 '22 07:10 Neustradamus

Also: building in WSL (ubuntu 22.10 on it) fails to run ./configure as well.

Likewise, I have a situation where I would like to build zlib for linux-x86, linux-x64, linux-arm, and linux-arm64 (all in a x64 build of linux).

AraHaan avatar Oct 26 '22 00:10 AraHaan