For a safe wrapper, see the rdkafka crate.
The rdkafka-sys version number is in the format
X.Y.Z is the version of this crate and follows SemVer conventions, while
RX.RY.RZ is the version of the bundled librdkafka.
Note that versions before v2.0.0+1.4.2 did not follow this convention, and instead directly correspond to the bundled librdkafka version.
- When any of librdkafka’s optional dependencies are enabled, like libz or OpenSSL, if you have multiple versions of that library installed upon your system, librdkafka’s build system may disagree with Cargo about which version of the library to use! This can result in subtly broken builds, if librdkafka compiles against the headers for one version but Cargo links against a different version. For complete confidence when building release binaries, use an environment like a Docker container or a chroot jail where you can guarantee that only one version of each dependency is present. The current design of Cargo unfortunately makes this nearly impossible to fix.
By default a submodule with the librdkafka sources will be used to compile and statically link the library.
dynamic-linking feature can be used to link rdkafka to a locally
installed version of librdkafka: if the feature is enabled, the build script
pkg-config to check the version of the library installed in the
system, and it will configure the compiler to dynamically link against it.
The system version of librdkafka must exactly match the version of
librdkafka bundled with this crate.
The following features directly correspond to librdkafka features (i.e.,
flags you would pass to
configure if you were compiling manually).
sslfeature enables SSL support. By default, the system’s OpenSSL library is dynamically linked, but static linking of the version bundled with the openssl-sys crate can be requested with the
gssapifeature enables SASL GSSAPI support with Cyrus libsasl2. By default the system’s libsasl2 is dynamically linked, but static linking of the version bundled with the sasl2-sys crate can be requested with the
libzfeature enables support for zlib compression. This feature is enabled by default. By default, the system’s libz is dynamically linked, but static linking of the version bundled with the libz-sys crate can be requested with the
zstdfeature enables support for ZSTD compression. By default, this builds and statically links the version bundled with the zstd-sys crate, but dynamic linking of the system’s version can be requested with the
external-lz4feature statically links against the copy of liblz4 bundled with the lz4-sys crate. By default, librdkafka statically links against its own bundled version of liblz4. Due to limitations with lz4-sys, it is not yet possible to dynamically link against the system’s version of liblz4.
All features are disabled by default unless noted otherwise above. The build
process is defined in