Skip to content

Commit 4a87be9

Browse files
committed
Use system-provided cyrus-sasl/libsasl2 at runtime
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`.
1 parent 69b1865 commit 4a87be9

25 files changed

+300
-217
lines changed

.semaphore/semaphore.yml

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -185,33 +185,19 @@ blocks:
185185
commands:
186186
- '[[ -z $SEMAPHORE_GIT_TAG_NAME ]] || artifact push workflow artifacts/ --destination artifacts/${ARTIFACT_KEY}/'
187187
jobs:
188-
- name: 'Build: centos8 glibc +gssapi'
189-
env_vars:
190-
- name: ARTIFACT_KEY
191-
value: p-librdkafka__plat-linux__dist-centos8__arch-x64__lnk-std__extra-gssapi
192-
commands:
193-
- packaging/tools/build-release-artifacts.sh quay.io/pypa/manylinux_2_28_x86_64:2024.07.01-1 artifacts/librdkafka.tgz
194-
195188
- name: 'Build: centos8 glibc'
196189
env_vars:
197190
- name: ARTIFACT_KEY
198191
value: p-librdkafka__plat-linux__dist-centos8__arch-x64__lnk-all
199192
commands:
200-
- packaging/tools/build-release-artifacts.sh --disable-gssapi quay.io/pypa/manylinux_2_28_x86_64:2024.07.01-1 artifacts/librdkafka.tgz
201-
202-
- name: 'Build: alpine musl +gssapi'
203-
env_vars:
204-
- name: ARTIFACT_KEY
205-
value: p-librdkafka__plat-linux__dist-alpine__arch-x64__lnk-std__extra-gssapi
206-
commands:
207-
- packaging/tools/build-release-artifacts.sh alpine:3.16.9 artifacts/librdkafka.tgz
193+
- packaging/tools/build-release-artifacts.sh quay.io/pypa/manylinux_2_28_x86_64:2024.07.01-1 artifacts/librdkafka.tgz
208194

209195
- name: 'Build: alpine musl'
210196
env_vars:
211197
- name: ARTIFACT_KEY
212198
value: p-librdkafka__plat-linux__dist-alpine__arch-x64__lnk-all
213199
commands:
214-
- packaging/tools/build-release-artifacts.sh --disable-gssapi alpine:3.16.9 artifacts/librdkafka.tgz
200+
- packaging/tools/build-release-artifacts.sh alpine:3.16.9 artifacts/librdkafka.tgz
215201

216202

217203
- name: 'Linux arm64: release artifact docker builds'
@@ -227,33 +213,19 @@ blocks:
227213
commands:
228214
- '[[ -z $SEMAPHORE_GIT_TAG_NAME ]] || artifact push workflow artifacts/ --destination artifacts/${ARTIFACT_KEY}/'
229215
jobs:
230-
- name: 'Build: centos8 glibc +gssapi'
231-
env_vars:
232-
- name: ARTIFACT_KEY
233-
value: p-librdkafka__plat-linux__dist-centos8__arch-arm64__lnk-std__extra-gssapi
234-
commands:
235-
- packaging/tools/build-release-artifacts.sh quay.io/pypa/manylinux_2_28_aarch64:2024.07.01-1 artifacts/librdkafka.tgz
236-
237216
- name: 'Build: centos8 glibc'
238217
env_vars:
239218
- name: ARTIFACT_KEY
240219
value: p-librdkafka__plat-linux__dist-centos8__arch-arm64__lnk-all
241220
commands:
242-
- packaging/tools/build-release-artifacts.sh --disable-gssapi quay.io/pypa/manylinux_2_28_aarch64:2024.07.01-1 artifacts/librdkafka.tgz
243-
244-
- name: 'Build: alpine musl +gssapi'
245-
env_vars:
246-
- name: ARTIFACT_KEY
247-
value: p-librdkafka__plat-linux__dist-alpine__arch-arm64__lnk-all__extra-gssapi
248-
commands:
249-
- packaging/tools/build-release-artifacts.sh alpine:3.16.9 artifacts/librdkafka.tgz
221+
- packaging/tools/build-release-artifacts.sh quay.io/pypa/manylinux_2_28_aarch64:2024.07.01-1 artifacts/librdkafka.tgz
250222

251223
- name: 'Build: alpine musl'
252224
env_vars:
253225
- name: ARTIFACT_KEY
254226
value: p-librdkafka__plat-linux__dist-alpine__arch-arm64__lnk-all
255227
commands:
256-
- packaging/tools/build-release-artifacts.sh --disable-gssapi alpine:3.16.9 artifacts/librdkafka.tgz
228+
- packaging/tools/build-release-artifacts.sh alpine:3.16.9 artifacts/librdkafka.tgz
257229

258230

259231
- name: 'Windows x64: MinGW-w64'

CMakeLists.txt

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -123,38 +123,19 @@ endif()
123123
# SASL {
124124
if(WIN32)
125125
set(with_sasl_default ON)
126+
elseif(WITH_LIBDL)
127+
set(with_sasl_default ON)
126128
else()
127-
if(PkgConfig_FOUND)
128-
pkg_check_modules(SASL libsasl2)
129-
if(SASL_FOUND)
130-
set(with_sasl_default ON)
131-
else()
132-
try_compile(
133-
WITH_SASL_CYRUS_BOOL
134-
"${CMAKE_CURRENT_BINARY_DIR}/try_compile"
135-
"${TRYCOMPILE_SRC_DIR}/libsasl2_test.c"
136-
LINK_LIBRARIES "-lsasl2"
137-
)
138-
if(WITH_SASL_CYRUS_BOOL)
139-
set(with_sasl_default ON)
140-
set(SASL_LIBRARIES "-lsasl2")
141-
else()
142-
set(with_sasl_default OFF)
143-
endif()
144-
endif()
145-
endif()
129+
set(with_sasl_default OFF)
146130
endif()
147131
option(WITH_SASL "With SASL" ${with_sasl_default})
148132
if(WITH_SASL)
149-
if(SASL_FOUND)
150-
link_directories(${SASL_LIBRARY_DIRS})
151-
endif()
152133
if(WITH_SSL)
153134
set(WITH_SASL_SCRAM ON)
154135
set(WITH_SASL_OAUTHBEARER ON)
155136
list(APPEND BUILT_WITH "SASL_SCRAM SASL_OAUTHBEARER")
156137
endif()
157-
if(NOT WIN32)
138+
if(NOT WIN32 AND WITH_LIBDL)
158139
set(WITH_SASL_CYRUS ON)
159140
list(APPEND BUILT_WITH "SASL_CYRUS")
160141
endif()

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ If the version is out of date, please [create an issue or pull request](https://
107107
pthreads
108108
zlib-dev (optional, for gzip compression support)
109109
libssl-dev (optional, for SSL and SASL SCRAM support)
110-
libsasl2-dev (optional, for SASL GSSAPI support)
111110
libzstd-dev (optional, for ZStd compression support)
112111
libcurl-dev (optional, for SASL OAUTHBEARER OIDC support)
113112

configure.self

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ mkl_require socket
1919
mkl_require zlib
2020
mkl_require libzstd
2121
mkl_require libssl
22-
mkl_require libsasl2
2322
mkl_require libcurl
2423

2524
# Generate version variables from rdkafka.h hex version define
@@ -99,12 +98,12 @@ void foo (void) {
9998

10099
if [[ $WITH_LIBDL == "y" ]]; then
101100
mkl_allvar_set WITH_PLUGINS WITH_PLUGINS y
101+
mkl_allvar_set WITH_SASL_CYRUS WITH_SASL_CYRUS y
102102
fi
103103

104104
# optional libs
105105
mkl_check "zlib"
106106
mkl_check "libssl"
107-
mkl_check "libsasl2"
108107
mkl_check "libzstd"
109108
mkl_check "libcurl"
110109

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Source: librdkafka
22
Priority: optional
33
Maintainer: Faidon Liambotis <[email protected]>
44
Uploaders: Christos Trochalakis <[email protected]>
5-
Build-Depends: debhelper (>= 9), zlib1g-dev, libssl-dev, libsasl2-dev, liblz4-dev, python3
5+
Build-Depends: debhelper (>= 9), zlib1g-dev, libssl-dev, liblz4-dev, python3
66
Standards-Version: 3.9.7
77
Section: libs
88
Homepage: https://github.com/confluentinc/librdkafka

mklove/modules/configure.libsasl2

Lines changed: 0 additions & 36 deletions
This file was deleted.

packaging/RELEASE.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,6 @@ you will end up with:
262262
(`librdkafka.so.1` or `librdkafka.1.dylib` on OSX).
263263

264264

265-
**NOTE**: Due to libsasl2/cyrus-sasl's dynamically loaded plugins, it is
266-
not possible for us to provide a self-contained static library with
267-
GSSAPI/Kerberos support.
268-
269-
270265

271266
### The artifact pipeline
272267

packaging/alpine/build-alpine.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [ "$1" = "--in-docker" ]; then
1414
git clone /v /librdkafka
1515

1616
cd /librdkafka
17-
./configure --install-deps --disable-gssapi --disable-lz4-ext --enable-static $*
17+
./configure --install-deps --disable-lz4-ext --enable-static $*
1818
make -j
1919
examples/rdkafka_example -X builtin.features
2020
CI=true make -C tests run_local_quick

packaging/archlinux/PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license=('BSD')
77
arch=('x86_64')
88
source=('git+https://github.com/confluentinc/librdkafka#branch=master')
99
sha256sums=('SKIP')
10-
depends=(glibc libsasl lz4 openssl zlib zstd)
10+
depends=(glibc lz4 openssl zlib zstd)
1111
makedepends=(bash git python3)
1212

1313
pkgver() {

packaging/cmake/try_compile/libsasl2_test.c

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)