🌐
discoversdk
discoversdk.com › compare › libzip-vs-zlib
Compare libzip vs zlib | DiscoverSdk
compare products libzip vs zlib on www.discoversdk.com: Compare products
🌐
GitHub
github.com › tihmstar › libfragmentzip › issues › 9
Do we need zlib or libzip? · Issue #9 · tihmstar/libfragmentzip
August 31, 2018 - Pull request #3 has changed Makefile to use libzip instead of zlib. But if I do not have zlib installed, it cannot cannot compile: make[1]: Entering directory '/tmp/BUILD/dioni21-libfragmentzip-80d2585' Making all in libfragmentzip make[...
Author   tihmstar
Discussions

compression - How are zlib, gzip and zip related? What do they have in common and how are they different? - Stack Overflow
The compression algorithm used in zlib is essentially the same as that in gzip and zip. What are gzip and zip? How are they different and how are they same? Mod note: This post is off-topic, but t... More on stackoverflow.com
🌐 stackoverflow.com
glibc conflict between libzip and zlib
Describe the bug There seems to be a conflict between libzip and zlib which results into glibc "not working" Steps To Reproduce Steps to reproduce the behavior: #!/bin/sh FHS=$(cat More on github.com
🌐 github.com
1
April 27, 2022
How are zlib, gzip and zip related? What do they have in common and how are they different?
The first two comments on the SO post are golden More on reddit.com
🌐 r/programming
76
1803
March 14, 2021
c++ - libzip with Visual Studio 2010 - Stack Overflow
Using libzip-1.0.1, zlib-1.2.8, and VS Community 2013. More on stackoverflow.com
🌐 stackoverflow.com
Software library for reading, creating, and modifying zip archives
Appveyor Build status
libzip is an open-source library for handling zip archives. It is written in portable C and can thus be used on multiple operating systems. It is based on zlib. It is used … Wikipedia
Factsheet
libzip
Developers Dieter Baron, Thomas Klausner
Stable release 1.11.4
/ 23 May 2025; 12 months ago (23 May 2025)
Factsheet
libzip
Developers Dieter Baron, Thomas Klausner
Stable release 1.11.4
/ 23 May 2025; 12 months ago (23 May 2025)
🌐
Wikipedia
en.wikipedia.org › wiki › Libzip
libzip - Wikipedia
November 23, 2024 - libzip is an open-source library for handling zip archives. It is written in portable C and can thus be used on multiple operating systems. It is based on zlib. It is used by PHP's zip extension for zip file support and MySQL Workbench.
Top answer
1 of 3
3283

Short form:

.zip is an archive format using, usually, the Deflate compression method. The .gz gzip format is for single files, also using the Deflate compression method. Often gzip is used in combination with tar to make a compressed archive format, .tar.gz. The zlib library provides Deflate compression and decompression code for use by zip, gzip, png (which uses the zlib wrapper on deflate data), and many other applications.

Long form:

The ZIP format was developed by Phil Katz as an open format with an open specification, where his implementation, PKZIP, was shareware. It is an archive format that stores files and their directory structure, where each file is individually compressed. The file type is .zip. The files, as well as the directory structure, can optionally be encrypted.

The ZIP format supports several compression methods:

    0 - The file is stored (no compression)
    1 - The file is Shrunk
    2 - The file is Reduced with compression factor 1
    3 - The file is Reduced with compression factor 2
    4 - The file is Reduced with compression factor 3
    5 - The file is Reduced with compression factor 4
    6 - The file is Imploded
    7 - Reserved for Tokenizing compression algorithm
    8 - The file is Deflated
    9 - Enhanced Deflating using Deflate64(tm)
   10 - PKWARE Data Compression Library Imploding (old IBM TERSE)
   11 - Reserved by PKWARE
   12 - File is compressed using BZIP2 algorithm
   13 - Reserved by PKWARE
   14 - LZMA
   15 - Reserved by PKWARE
   16 - IBM z/OS CMPSC Compression
   17 - Reserved by PKWARE
   18 - File is compressed using IBM TERSE (new)
   19 - IBM LZ77 z Architecture 
   20 - deprecated (use method 93 for zstd)
   93 - Zstandard (zstd) Compression 
   94 - MP3 Compression 
   95 - XZ Compression 
   96 - JPEG variant
   97 - WavPack compressed data
   98 - PPMd version I, Rev 1
   99 - AE-x encryption marker (see APPENDIX E)

Methods 1 to 7 are historical and are not in use. Methods 9 through 98 are relatively recent additions and are in varying, small amounts of use. The only method in truly widespread use in the ZIP format is method 8, Deflate, and to some smaller extent method 0, which is no compression at all. Virtually every .zip file that you will come across in the wild will use exclusively methods 8 and 0, likely just method 8. (Method 8 also has a means to effectively store the data with no compression and relatively little expansion, and Method 0 cannot be streamed whereas Method 8 can be.)

The ISO/IEC 21320-1:2015 standard for file containers is a restricted zip format, such as used in Java archive files (.jar), Office Open XML files (Microsoft Office .docx, .xlsx, .pptx), Office Document Format files (.odt, .ods, .odp), and EPUB files (.epub). That standard limits the compression methods to 0 and 8, as well as other constraints such as no encryption or signatures.

Around 1990, the Info-ZIP group wrote portable, free, open-source implementations of zip and unzip utilities, supporting compression with the Deflate format, and decompression of that and the earlier formats. This greatly expanded the use of the .zip format.

In the early '90s, the gzip format was developed as a replacement for the Unix compress utility, derived from the Deflate code in the Info-ZIP utilities. Unix compress was designed to compress a single file or stream, appending a .Z to the file name. compress uses the LZW compression algorithm, which at the time was under patent and its free use was in dispute by the patent holders. Though some specific implementations of Deflate were patented by Phil Katz, the format was not, and so it was possible to write a Deflate implementation that did not infringe on any patents. That implementation has not been so challenged in the last 20+ years. The Unix gzip utility was intended as a drop-in replacement for compress, and in fact is able to decompress compress-compressed data (assuming that you were able to parse that sentence). gzip appends a .gz to the file name. gzip uses the Deflate compressed data format, which compresses quite a bit better than Unix compress, has very fast decompression, and adds a CRC-32 as an integrity check for the data. The header format also permits the storage of more information than the compress format allowed, such as the original file name and the file modification time.

Though compress only compresses a single file, it was common to use the tar utility to create an archive of files, their attributes, and their directory structure into a single .tar file, and then compress it with compress to make a .tar.Z file. In fact, the tar utility had and still has the option to do the compression at the same time, instead of having to pipe the output of tar to compress. This all carried forward to the gzip format, and tar has an option to compress directly to the .tar.gz format. The tar.gz format compresses better than the .zip approach, since the compression of a .tar can take advantage of redundancy across files, especially many small files. .tar.gz is the most common archive format in use on Unix due to its very high portability, but there are more effective compression methods in use as well, so you will often see .tar.bz2 and .tar.xz archives.

Unlike .tar, .zip has a central directory at the end, which provides a list of the contents. That and the separate compression provides random access to the individual entries in a .zip file. A .tar file would have to be decompressed and scanned from start to end in order to build a directory, which is how a .tar file is listed.

Shortly after the introduction of gzip, around the mid-1990s, the same patent dispute called into question the free use of the .gif image format, very widely used on bulletin boards and the World Wide Web (a new thing at the time). So a small group created the PNG losslessly compressed image format, with file type .png, to replace .gif. That format also uses the Deflate format for compression, which is applied after filters on the image data expose more of the redundancy. In order to promote widespread usage of the PNG format, two free code libraries were created. libpng and zlib. libpng handled all of the features of the PNG format, and zlib provided the compression and decompression code for use by libpng, as well as for other applications. zlib was adapted from the gzip code.

All of the mentioned patents have since expired.

The zlib library supports Deflate compression and decompression, and three kinds of wrapping around the deflate streams. Those are no wrapping at all ("raw" deflate), zlib wrapping, which is used in the PNG format data blocks, and gzip wrapping, to provide gzip routines for the programmer. The main difference between zlib and gzip wrapping is that the zlib wrapping is more compact, six bytes vs. a minimum of 18 bytes for gzip, and the integrity check, Adler-32, runs faster than the CRC-32 that gzip uses. Raw deflate is used by programs that read and write the .zip format, which is another format that wraps around deflate compressed data.

zlib is now in wide use for data transmission and storage. For example, most HTTP transactions by servers and browsers compress and decompress the data using zlib, specifically HTTP header Content-Encoding: deflate means deflate compression method wrapped inside the zlib data format.

Different implementations of deflate can result in different compressed output for the same input data, as evidenced by the existence of selectable compression levels that allow trading off compression effectiveness for CPU time. zlib and PKZIP are not the only implementations of deflate compression and decompression. Both the 7-Zip archiving utility and Google's zopfli library have the ability to use much more CPU time than zlib in order to squeeze out the last few bits possible when using the deflate format, reducing compressed sizes by a few percent as compared to zlib's highest compression level. The pigz utility, a parallel implementation of gzip, includes the option to use zlib (compression levels 1-9) or zopfli (compression level 11), and somewhat mitigates the time impact of using zopfli by splitting the compression of large files over multiple processors and cores.

2 of 3
65

ZIP is a file format used for storing an arbitrary number of files and folders together with lossless compression. It makes no strict assumptions about the compression methods used, but is most frequently used with DEFLATE.

Gzip is both a compression algorithm based on DEFLATE but less encumbered with potential patents et al, and a file format for storing a single compressed file. It supports compressing an arbitrary number of files and folders when combined with tar. The resulting file has an extension of .tgz or .tar.gz and is commonly called a tarball.

zlib is a library of functions encapsulating DEFLATE in its most common LZ77 incarnation.

🌐
GitHub
github.com › yarnpkg › berry › discussions › 2757
Use JS ZIP library instead of WASM LibZip · yarnpkg/berry · Discussion #2757
There is little point to using LibZip because in Yarn, Node.js Zlib is used for decompression and the ZIP format itself is very cheap to parse. In fact, a JavaScript ZIP library will easily outperform LibZip when used in Yarn due to the cost of the WASM-JS boundary and the need for excessive memory copying when using WASM instead of JS.
Author   yarnpkg
🌐
Libzip
libzip.org
libzip - libzip
A C library for reading, creating, and modifying zip archives.
🌐
DEV Community
dev.to › biellls › compression-clearing-the-confusion-on-zip-gzip-zlib-and-deflate-15g1
Compression: Clearing the Confusion on ZIP, GZIP, Zlib and DEFLATE - DEV Community
January 21, 2022 - I was surprised to find out that GZIP, zlib or even ZIP are not compression algorithms, they are actually file formats that can permit different compression algorithms. Even more surprising, virtually every implementation of those three actually use the same lossless data compression algorithm.
🌐
GitHub
github.com › NixOS › nixpkgs › issues › 170609
glibc conflict between libzip and zlib · Issue #170609 · NixOS/nixpkgs
April 27, 2022 - Describe the bug There seems to be a conflict between libzip and zlib which results into glibc "not working" Steps To Reproduce Steps to reproduce the behavior: #!/bin/sh FHS=$(cat
Author   NixOS
Find elsewhere
🌐
GitHub
github.com › nih-at › libzip › blob › main › INSTALL.md
libzip/INSTALL.md at main · nih-at/libzip
This guide shows how to build libzip from source. It assumes basic familiarity with using the command line and building software from source. This guide uses cmake to invoke all required commands to be platform-independent. You can, of course, also use the underlying commands directly. ... You'll need zlib (at least version 1.1.2).
Author   nih-at
🌐
GitHub
github.com › ctabin › libzippp › blob › master › README.md
libzippp/README.md at master · ctabin/libzippp
December 8, 2019 - Check if there is any patch to apply in lib. Sometimes, some files are not compilable in C89 in libzip, depending on the version. Simply execute the compile.bat file. This will compile zlib, libzip and finally libzippp.
Author   ctabin
🌐
Narkive
subsurface.hohndel.narkive.com › JtMLtcYF › dumping-libzip
dumping libzip
In order to make the library smaller and easier to maintain? i think we can. there is just some basic source code in the lines of "io functions like fopen", "zipping stuff", "unzipping stuff" and some helper headers. we need to include those .o files in our files and simply use the zlib shared library. the i/o buffer support from minizip is not part of zlib upstream and it seems to be only in the minizip upstream. we technically need that in locations like subsurfacewebservices.cpp and file.c, but we can still manage to open files instead of buffers. Post by Dirk Hohndel d) alternatively, would it make sense to use it ONLY under Windows (so that way I can deal with building it locally and create binaries and the rest of the OSs can happily keep using their existing libzip)?
🌐
GitHub
github.com › ctabin › libzippp
GitHub - ctabin/libzippp: C++ wrapper for libzip · GitHub
Check if there is any patch to apply in lib. Sometimes, some files are not compilable in C89 in libzip, depending on the version. Simply execute the compile.bat file. This will compile zlib, libzip and finally libzippp.
Starred by 454 users
Forked by 97 users
Languages   C++ 86.8% | CMake 5.9% | Makefile 4.5% | Batchfile 2.8%
🌐
Reddit
reddit.com › r/programming › how are zlib, gzip and zip related? what do they have in common and how are they different?
r/programming on Reddit: How are zlib, gzip and zip related? What do they have in common and how are they different?
March 14, 2021 - The pigz utility, a parallel implementation of gzip, includes the option to use zlib (compression levels 1-9) or zopfli (compression level 11), and somewhat mitigates the time impact of using zopfli by splitting the compression of large files over multiple processors and cores.
🌐
PHP
php.net › manual › en › wrappers.compression.php
PHP: zlib:// - Manual
compress.zlib:// and compress.bzip2:// are equivalent to gzopen() and bzopen() respectively, and operate even on systems that do not support fopencookie. ZIP extension registers zip: wrapper. As of PHP 7.2.0 and libzip 1.2.0+, support for the passwords for encrypted archives were added, allowing ...
Top answer
1 of 8
29

Edit:

Before starting on the answer provided here, it appears that this may no longer be an issue going by @Thomas Klausner's answer below.


The following should get you a VS10 solution:

  1. If you've not already done so, install CMake

  2. Download and extract zlib to e.g. C:\devel. The download links are about halfway down the homepage. Currently this provides zlib version 1.2.7.

    • To work around this CMake bug which affects 64-bit Windows only, add

      if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND MSVC)
        set_target_properties(zlibstatic PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
      endif()
      

      to the end of C:\devel\zlib-1.2.7\CMakeLists.txt

  3. Download and extract libzip to e.g. C:\devel

  4. In a VS10 command prompt, cd C:\devel\zlib-1.2.7

  5. mkdir build && cd build

  6. cmake .. -G"Visual Studio 10" -DCMAKE_INSTALL_PREFIX="C:\devel\installed\zlib" This sets the install path to C:\devel\installed\zlib rather than the default C:\Program Files\zlib. For 64-bit Windows, use "Visual Studio 10 Win64" as the -G parameter.

  7. msbuild /P:Configuration=Debug INSTALL.vcxproj

  8. msbuild /P:Configuration=Release INSTALL.vcxproj

  9. cd C:\devel\libzip-0.10.1

  10. mkdir build && cd build

  11. cmake .. -G"Visual Studio 10" -DCMAKE_PREFIX_PATH="C:\devel\installed\zlib" Set the path to wherever you installed zlib so that CMake can find zlib's include files and libs. Again, for 64-bit Windows, use "Visual Studio 10 Win64" as the -G parameter.

This should result in C:\devel\libzip-0.10.1\build\libzip.sln. It looks like there are a few POSIX-specific problems in the code, but they should hopefully be fairly easy to resolve (e.g. in zipconf.h #include <inttypes.h> needs replaced with #include <stdint.h>; there are some snprintf calls needing replaced e.g. with _snprintf).

2 of 8
4

I can't comment, so just in addition to Fraser's answer: In the last days, libzip's latest repository version should compile on VS without additional patches. Please try it out and let the developers know if parts are still missing.

🌐
Baeldung
baeldung.com › home › algorithms › data compression: zlib vs. gzip vs. zip
Data Compression: ZLib vs. GZip vs. Zip | Baeldung on Computer Science
March 18, 2024 - The main drawback of zlib is that it doesn’t have any checksum mechanism to maintain the integrity of data.
🌐
Libzip
libzip.org › documentation › zip_fopen.html
zip_fopen · libzip
Initializing the zlib stream failed. The function zip_fopen() may also fail and set zip_err for any of the errors specified for the routine zip_name_locate(3). The function zip_fopen_index() may also fail with ZIP_ER_INVAL if index is invalid. libzip(3), zip_fclose(3), zip_fread(3), zip_fseek(3), ...
🌐
Libhunt
cpp.libhunt.com › compare-minizip-vs-zlib
Minizip vs ZLib | LibHunt
Fork of the popular zip manipulation library found in the zlib distribution.