Cargo Features

libz-sys = { version = "1.1.15", default-features = false, features = ["zlib-ng", "stock-zlib", "asm", "static"] }
default = libc, stock-zlib

These default features are set whenever libz-sys is added without default-features = false somewhere in the dependency tree.

zlib-ng = cmake, libc

(Omit the libc feature if you don't require the corresponding functions.)

This allows higher-level crates depending on your library to opt into zlib-ng if desired.

Building zlib-ng requires cmake.

stock-zlib default

Deprecated: the assembly routines are outdated, and either reduce performance or cause segfaults.


Enable this feature if you want to have a statically linked libz

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features.

libc default zlib-ng?

Enables libc

When this feature is disabled, zlib will be built in Z_SOLO mode which removes dependency on any external libraries like libc at the cost of eliminating some high-level functions like gz*, compress* and uncompress, and requiring embedder to provide memory allocation routines to deflate and inflate.

Affects libz-sys::gzFile, libz-sys::gzFile_s, libz-sys::z_off_t, libz-sys::z_off_t

cmake build zlib-ng?