0

My Question: How can I create the binaries for zlib 1.2.11 with Visual Studio 2019?

Information:
The binaries are used in a c++ v142 project. I specially need the zlibwapi.lib, zlibwapi.dll and all required headers (zip.h, zlib.h, zconf.h, iowin32.h, ioapi.h) needed for the two components

I tried to write this question as compact as possible. Please inform me if I could provide more information.

What I already tried:
1.) I know there VS solutions exist which are supported by the community.
But there are only .sln´s for vs15 and below available. And I cannot create the binaries without having to modify the source code.
2.) Tried to use cmake and the CMakeLists.txt to generate the example product. Then I imported these binaries in my project. But I get linker errors when doing so. I think the issues with this approach is that an “extern “C”” decoration is not applied when I create the files.
3.) Tried to use vspk but I get the zlib1.dll instead of the zlibwapi.dll. And the zip.h Header is missing.

Thank you very much in advance!

Resources: Homepage: https://zlib.net/ (downloads can be found there. I dont want to provide a link to a mirror.)

BrayanK
  • 1
  • 3
  • zlib1g is what you normally should get when building zlib from sources. zlibwapi seems to be some third-party customization or even separate library. I suggest to search over the internet for exactly what is zlibwapi and how to get it. – ivan.ukr Feb 26 '21 at 12:28
  • @ivan.ukr thank you for your response. When you download the zlib source code from the link I posted above, then you will see that there exists a "contrib" folder. This folder is "maintained" by contributors. And inside the "contrib\vstudio" folder there are visual studio ".sln" solutions. Each solution creates the zlibwapi.xx binaries. The issue, as already mentioned, is that I cannot compile one of these projects without changing the source code. Because the last available project is supported for vs15 and not for vs19. A migration also fails. – BrayanK Feb 26 '21 at 14:11
  • Well, that's common situation with extra contributions to the open-source libraries. Library maintainers typically maintain main library code. So those contributions may be not buildable with newer compilers. If you know how to fix that - just go on and fix. Also it would be nice if you contribute your fix back to the library. However, be sure to not break compatibility with older compilers. For this you will often have to use #if ... #endif and check value of the compiler specific symbol like _MSC_VER or ____GNUC____. – ivan.ukr Feb 27 '21 at 19:36
  • After duplicating the vs16 solution and migrating the csproj file, I noticed that a header file "zconf.h" is missing. This is also not present in any other folder/subfolder. In the root folder 3 similar files exist: "zconf.h.cmakein", "zconf.h.in" and "zconf.h.included". It looks like that this files are some sort of header templates. I read that ".h.in" files can be used with "autoconf" to generate the actual header file. But I dont understand why so many templated headers exist and what the difference between these are. – BrayanK Apr 28 '21 at 14:55
  • Have you solved this problem? I'm also trying to use zlib with VS19. – David G Dec 04 '22 at 06:08
  • @DavidG Not with Version 1.2.11 but I managed it with 1.2.12. I had to change some parts in the code. Because of the change the component is not useable from compliance point of view. It is easier to fix 1.2.12 rather then 1.2.11. Probably a newer version exists already which will work without any code changed. I think a task for that should exists. – BrayanK Dec 05 '22 at 08:31

0 Answers0