Skip to content

Commit 32edec8

Browse files
authored
Hotfix Release: use system-provided cyrus-sasl/libsasl2 at runtime (#9)
* 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`. * Compute version from tag or from vcpkg.json * Run style checks on tag too * Re-enable tests that were disabled in our CI * Allow build metadata in nuget version
1 parent 7de45c4 commit 32edec8

28 files changed

+311
-247
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ jobs:
5555

5656
style-check:
5757
runs-on: ubuntu-24.04
58-
if: "!startsWith(github.ref, 'refs/tags/v')"
5958
steps:
6059
- uses: actions/checkout@v4
6160
- name: Install dependencies
@@ -117,28 +116,18 @@ jobs:
117116
strategy:
118117
matrix:
119118
include:
120-
- name: "centos8 glibc +gssapi"
121-
artifact_key: p-librdkafka__plat-linux__dist-centos8__arch-x64__lnk-std__extra-gssapi
122-
image: quay.io/pypa/manylinux_2_28_x86_64:2024.07.01-1
123-
extra_args: ""
124119
- name: "centos8 glibc"
125120
artifact_key: p-librdkafka__plat-linux__dist-centos8__arch-x64__lnk-all
126121
image: quay.io/pypa/manylinux_2_28_x86_64:2024.07.01-1
127-
extra_args: "--disable-gssapi"
128-
- name: "alpine musl +gssapi"
129-
artifact_key: p-librdkafka__plat-linux__dist-alpine__arch-x64__lnk-std__extra-gssapi
130-
image: alpine:3.16.9
131-
extra_args: ""
132122
- name: "alpine musl"
133123
artifact_key: p-librdkafka__plat-linux__dist-alpine__arch-x64__lnk-all
134124
image: alpine:3.16.9
135-
extra_args: "--disable-gssapi"
136125
steps:
137126
- uses: actions/checkout@v4
138127
- name: Build
139128
run: |
140129
mkdir artifacts
141-
packaging/tools/build-release-artifacts.sh ${{ matrix.extra_args }} ${{ matrix.image }} artifacts/librdkafka.tgz
130+
packaging/tools/build-release-artifacts.sh ${{ matrix.image }} artifacts/librdkafka.tgz
142131
- name: Upload artifacts
143132
uses: actions/upload-artifact@v4
144133
with:
@@ -150,28 +139,18 @@ jobs:
150139
strategy:
151140
matrix:
152141
include:
153-
- name: "centos8 glibc +gssapi"
154-
artifact_key: p-librdkafka__plat-linux__dist-centos8__arch-arm64__lnk-std__extra-gssapi
155-
image: quay.io/pypa/manylinux_2_28_aarch64:2024.07.01-1
156-
extra_args: ""
157142
- name: "centos8 glibc"
158143
artifact_key: p-librdkafka__plat-linux__dist-centos8__arch-arm64__lnk-all
159144
image: quay.io/pypa/manylinux_2_28_aarch64:2024.07.01-1
160-
extra_args: "--disable-gssapi"
161-
- name: "alpine musl +gssapi"
162-
artifact_key: p-librdkafka__plat-linux__dist-alpine__arch-arm64__lnk-all__extra-gssapi
163-
image: alpine:3.16.9
164-
extra_args: ""
165145
- name: "alpine musl"
166146
artifact_key: p-librdkafka__plat-linux__dist-alpine__arch-arm64__lnk-all
167147
image: alpine:3.16.9
168-
extra_args: "--disable-gssapi"
169148
steps:
170149
- uses: actions/checkout@v4
171150
- name: Build
172151
run: |
173152
mkdir artifacts
174-
packaging/tools/build-release-artifacts.sh ${{ matrix.extra_args }} ${{ matrix.image }} artifacts/librdkafka.tgz
153+
packaging/tools/build-release-artifacts.sh ${{ matrix.image }} artifacts/librdkafka.tgz
175154
- name: Upload artifacts
176155
uses: actions/upload-artifact@v4
177156
with:
@@ -259,11 +238,10 @@ jobs:
259238
shell: pwsh
260239
run: |
261240
# Different packaging for tagged vs untagged builds
262-
$vstring = "2.11.0-"
263-
if ($env:GITHUB_REF -match '^refs/tags/') {
264-
$vstring += "gr"
241+
if ($env:GITHUB_REF -match '^refs/tags/v') {
242+
$vstring = $env:GITHUB_REF -replace '^refs/tags/v', ''
265243
} else {
266-
$vstring += "ci-$env:GITHUB_RUN_ID"
244+
$vstring = "$((Get-Content .\vcpkg.json | ConvertFrom-Json).version)-ci-$($env:GITHUB_RUN_ID)"
267245
}
268246
269247
mkdir packages

.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'

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# librdkafka v2.11.0 + gr
22
- https://github.com/confluentinc/librdkafka/pull/4972 (Avoid unnecessary producer epoch bumps)
33
- https://github.com/confluentinc/librdkafka/pull/4989 (Fully utilize the max.in.flight.requests.per.connection parameter on the idempotent producer)
4-
4+
- https://github.com/confluentinc/librdkafka/pull/5168 (Use system-provided cyrus-sasl/libsasl2 at runtime)
5+
56
# librdkafka v2.11.0
67

78
librdkafka v2.11.0 is a feature release:

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

0 commit comments

Comments
 (0)