-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Use system-provided cyrus-sasl/libsasl2 at runtime #5168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
🎉 All Contributor License Agreements have been signed. Ready to merge. |
a740b69
to
07e9f8e
Compare
07e9f8e
to
9f54d07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements runtime loading of the Cyrus SASL library (libsasl2
) on Unix systems to enable SASL GSSAPI mechanism support without requiring static linking at build time. This change allows Python wheels to be distributed on PyPI while maintaining GSSAPI functionality and addresses ABI compatibility issues between different Linux distributions.
Key Changes
- Dynamic loading of
libsasl2
at runtime usingdlopen
instead of build-time linking - Removal of build dependencies on
libsasl2
across all packaging configurations - Simplification of build artifacts by eliminating separate GSSAPI and non-GSSAPI builds
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/rdkafka_sasl_cyrus.c |
Implements dynamic loading of libsasl2 with function pointer resolution and error handling |
src/rdkafka_sasl_int.h |
Adds new API functions for library status checking |
src/rdkafka_sasl.c |
Updates provider selection to check runtime library availability |
src/rdkafka_conf.c |
Updates error message for missing library support |
src/CMakeLists.txt |
Removes static linking to libsasl2 |
configure.self |
Removes libsasl2 build dependency configuration |
Various packaging files | Removes libsasl2 dependencies and GSSAPI build variants |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Instead of having multiple builds with and without `libsasl2` on Linux, one of which cannot be redistributed within Python wheels, we use `dlopen` to load `libsasl2` at runtime on Unix. The SASL GSSAPI mechanism availability is thus checked at runtime. Because of differences in soname ABI bumps between Debian-based and RPM-based distros, the previous SASL builds did not work on Debian-based systems. This is also solved in this change, by probing the various known names for `libsasl2`.
9f54d07
to
4a87be9
Compare
Hi @emasab, could you please review this PR? |
- G-Research#3 (CI/CD script) - confluentinc#4972 (Avoid unnecessary producer epoch bumps) - confluentinc#4989 (Fully utilize the max.in.flight.requests.per.connection parameter on the idempotent producer) - confluentinc#4972 (Avoid unnecessary producer epoch bumps) - confluentinc#4989 (Fully utilize the max.in.flight.requests.per.connection parameter on the idempotent producer) - confluentinc#5168 (Use system-provided cyrus-sasl/libsasl2 at runtime)
- G-Research#3 (CI/CD script) - confluentinc#4972 (Avoid unnecessary producer epoch bumps) - confluentinc#4989 (Fully utilize the max.in.flight.requests.per.connection parameter on the idempotent producer) - confluentinc#5168 (Use system-provided cyrus-sasl/libsasl2 at runtime)
- #3 (CI/CD script) - confluentinc#4972 (Avoid unnecessary producer epoch bumps) - confluentinc#4989 (Fully utilize the max.in.flight.requests.per.connection parameter on the idempotent producer) - confluentinc#5168 (Use system-provided cyrus-sasl/libsasl2 at runtime)
Motivation
Currently the Python bindings require the user to build from source in order to use the SASL GSSAPI mechanism on Linux. This is because PyPI doesn't allow Python wheels that link to non-core libraries, like
libsasl2
.Other bindings that can use the builds linking to
libsasl2
- like the .NET ones - do not work on Debian-based systems without adding a symlink fromlibsasl2.so.3
tolibsasl2.so.2
. This is because the builds are done on an RPM-based system, which have a different soname ABI policy.Implementation
Instead of having multiple builds with and without
libsasl2
on Linux, we usedlopen
to loadlibsasl2
at runtime on Unix. The SASL GSSAPI mechanism availability is thus checked at runtime.The differences between Debian-based and RPM-based distros are addressed by probing the various known names for
libsasl2
. The subset of the ABI we use has not changed between the upstream soname ABI bumps.The documentation has been updated to remove the previous limitations around libsasl2/GSSAPI.
The CI and build scripts have been updated to only build one flavor per linux/libc, and the
--disable-gssapi
parameter has been removed.The 2 build systems (mklove and cmake) have been updated to build SASL GSSAPI support based on the availability of
libdl
instead oflibsasl2
.The
librdkafka.redist
nuget package has been updated to include only one build for linux/glibc/x64, as thecentos8-librdkafka.so
build is obsoleted by the single build with no dependencies.The static library build now supports the SASL GSSAPI mechanism.
A very small subset of the libsasl2 header has been included in
rdkafka_sasl_cyrus.c
. The license can be found at https://github.com/cyrusimap/cyrus-sasl/blob/master/COPYING.