You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bn...@apache.org on 2026/08/27 20:12:00 UTC

(trafficserver-ci) branch main updated: Build nuraft against shared OpenSSL on Ubuntu 26.04 (#458)

This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/trafficserver-ci.git


The following commit(s) were added to refs/heads/main by this push:
     new 3842a49  Build nuraft against shared OpenSSL on Ubuntu 26.04 (#458)
3842a49 is described below

commit 3842a499cbee0baec874b1a7ec81dbf13251fc3b
Author: Brian Neradt <br...@gmail.com>
AuthorDate: Thu Aug 27 15:11:55 2026 -0500

    Build nuraft against shared OpenSSL on Ubuntu 26.04 (#458)
    
    OpenSSL 3.5 lists "-lz" in the static half of its pkg-config file, so
    CMake's FindOpenSSL resolves zlib while it is restricted to static
    libraries and puts the non-PIC libz.a into libnuraft.so. amd64 rejects
    that relocation, so the ubuntu2604 image fails to build there while
    arm64 tolerates the same archive.
    
    This patch names the shared OpenSSL libraries, which keeps FindOpenSSL
    out of its static path and drops the zlib, jitterentropy, and zstd
    dependencies from the nuraft link entirely.
    
    Co-authored-by: Claude Opus 5 <no...@anthropic.com>
---
 docker/ubuntu2604/Dockerfile | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/docker/ubuntu2604/Dockerfile b/docker/ubuntu2604/Dockerfile
index 69d4ef6..5143865 100644
--- a/docker/ubuntu2604/Dockerfile
+++ b/docker/ubuntu2604/Dockerfile
@@ -70,9 +70,25 @@ ENV PATH="/opt/bin:${PATH}"
 
 # Install nuraft for the stek_share plugin. Distros, unfortunately, do not
 # package these, so this has to be built by hand.
+#
+# NuRaft asks CMake for a static OpenSSL. On Ubuntu 26.04, OpenSSL 3.5 lists
+# "-lz" in the static half of its pkg-config file, so FindOpenSSL resolves zlib
+# as well, and it does so while restricted to static libraries. That puts libz.a
+# into the link of NuRaft's own shared library. Ubuntu does not build libz.a with
+# -fPIC, which amd64 rejects in a shared object:
+#
+#   relocation R_X86_64_PC32 against symbol `z_errmsg' can not be used when
+#   making a shared object; recompile with -fPIC
+#
+# arm64 tolerates the same archive, so this only fails on amd64. Naming the
+# shared OpenSSL libraries keeps FindOpenSSL out of its static path, which drops
+# the zlib, jitterentropy, and zstd dependencies entirely. Ubuntu 22.04 and
+# 24.04 are unaffected because their OpenSSL does not list "-lz".
 RUN <<EOF
   set -e
 
+  OPENSSL_LIBDIR=$(pkg-config --variable=libdir openssl)
+
   git clone https://github.com/eBay/NuRaft.git
   cd NuRaft
   ./prepare.sh
@@ -80,7 +96,10 @@ RUN <<EOF
   cmake \
     -B build \
     -G Ninja \
-    -DCMAKE_INSTALL_PREFIX=/opt/
+    -DCMAKE_INSTALL_PREFIX=/opt/ \
+    -DOPENSSL_SSL_LIBRARY=${OPENSSL_LIBDIR}/libssl.so \
+    -DOPENSSL_CRYPTO_LIBRARY=${OPENSSL_LIBDIR}/libcrypto.so \
+    -DOPENSSL_INCLUDE_DIR=/usr/include
   cmake --build build
   cmake --install build
   cd ../