]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Wild shot at building our packages with clang++
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Jan 2025 11:33:17 +0000 (12:33 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Jan 2025 15:15:32 +0000 (16:15 +0100)
builder-support/debian/dnsdist/debian-bookworm/control
builder-support/debian/dnsdist/debian-bookworm/rules
builder-support/debian/dnsdist/debian-buster/control
builder-support/debian/dnsdist/debian-buster/rules
builder-support/dockerfiles/Dockerfile.dnsdist
builder-support/specs/dnsdist.spec

index 2521d8c70d56cb6ed1b590539d6493089c54ed8b..4796af9690910f7c2cdc0fb7618777462f500388 100644 (file)
@@ -4,6 +4,7 @@ Priority: optional
 Maintainer: PowerDNS.COM BV <powerdns.support.sales@powerdns.com>
 Uploaders: PowerDNS.COM BV <powerdns.support.sales@powerdns.com>
 Build-Depends: debhelper (>= 10),
+               clang,
                libboost-all-dev,
                libbpf-dev [linux-any],
                libcap-dev,
@@ -22,6 +23,7 @@ Build-Depends: debhelper (>= 10),
                libsystemd-dev [linux-any],
                libwslay-dev,
                libxdp-dev [linux-any],
+               lld,
                pkg-config,
                python3-yaml,
                ragel,
index 5291c3bcb2500732240ab6b13beb660a00bbaf98..4fcc760301e33c06ba1cd01f743d2a1b48a62115 100755 (executable)
@@ -10,6 +10,12 @@ include /usr/share/dpkg/default.mk
 
 # for atomic support on powerpc (automatic on mipsel)
 LDFLAGS += -latomic
+# We need clang (LLVM) to link the Rust static library and the C++ code with LTO enabled
+# build-id SHA1 prevents an issue with the debug symbols
+# and the --no-as-needed -ldl an issue with the dlsym not being found
+LDFLAGS += -fuse-ld=lld -Wl,--build-id=sha1 -Wl,--no-as-needed -ldl
+CC=clang
+CXX=clang++
 
 # Only enable systemd integration on Linux operating systems
 ifeq ($(DEB_HOST_ARCH_OS),linux)
index 4259f478b12b0826c5a70a8ee25fa467ac2ef86a..d9cb1f5d265f4717c8f0b5943e39d409c0717f11 100644 (file)
@@ -4,6 +4,7 @@ Priority: optional
 Maintainer: PowerDNS.COM BV <powerdns.support.sales@powerdns.com>
 Uploaders: PowerDNS.COM BV <powerdns.support.sales@powerdns.com>
 Build-Depends: debhelper (>= 10),
+               clang,
                libboost-all-dev,
                libcap-dev,
                libcdb-dev,
@@ -20,6 +21,7 @@ Build-Depends: debhelper (>= 10),
                libssl-dev,
                libsystemd-dev [linux-any],
                libwslay-dev,
+               lld,
                pkg-config,
                python3-yaml,
                ragel,
index 3b732061a778cd75aa34fd9c269f2ae8b0ea97ba..ce9621d127fcdd55e42b3acdcd8529d0b5ccc0d8 100755 (executable)
@@ -10,6 +10,12 @@ include /usr/share/dpkg/default.mk
 
 # for atomic support on powerpc (automatic on mipsel)
 LDFLAGS += -latomic
+# We need clang (LLVM) to link the Rust static library and the C++ code with LTO enabled
+# build-id SHA1 prevents an issue with the debug symbols
+# and the --no-as-needed -ldl an issue with the dlsym not being found
+LDFLAGS += -fuse-ld=lld -Wl,--build-id=sha1 -Wl,--no-as-needed -ldl
+CC=clang
+CXX=clang++
 
 # Only enable systemd integration on Linux operating systems
 ifeq ($(DEB_HOST_ARCH_OS),linux)
index ffea154e97ddd3e66ff778eceee86aa6c3603c93..b1f096b04e11decf798f3d7388c9b5b3dc4b5c5a 100644 (file)
@@ -19,4 +19,3 @@ RUN /dnsdist/builder/helpers/set-configure-ac-version.sh && \
     ./configure --disable-dependency-tracking && \
     make dist
 RUN cp dnsdist-${BUILDER_VERSION}.tar.bz2 /sdist/
-
index 428e1ddfc3383839858f32225cb4adea1f6736e7..476b279c8859039734bbdff2c817e3e14e6caf42 100644 (file)
@@ -9,7 +9,6 @@ Source: %{name}-%{getenv:BUILDER_VERSION}.tar.bz2
 BuildRequires: readline-devel
 BuildRequires: libedit-devel
 BuildRequires: openssl-devel
-BuildRequires: python3-pyyaml
 
 %if 0%{?suse_version}
 BuildRequires: lua-devel
@@ -22,6 +21,12 @@ BuildRequires: systemd-devel
 BuildRequires: boost169-devel
 %else
 BuildRequires: boost-devel
+BuildRequires: python3-pyyaml
+%endif
+
+%if 0%{?rhel} >= 8
+BuildRequires: clang
+BuildRequires: lld
 %endif
 
 %if 0%{?rhel} >= 7 || 0%{?amzn} == 2023
@@ -72,6 +77,14 @@ dnsdist is a high-performance DNS loadbalancer that is scriptable in Lua.
 export CPPFLAGS=-I/usr/include/boost169
 export LDFLAGS=-L/usr/lib64/boost169
 %endif
+%if 0%{?rhel} >= 8
+# We need to build with LLVM/clang to be able to use LTO, since we are linking against a static Rust library built with LLVM
+export CC=clang
+export CXX=clang++
+# build-id SHA1 prevents an issue with the debug symbols
+# and the --no-as-needed -ldl an issue with the dlsym not being found
+export LDFLAGS="-fuse-ld=lld -Wl,--build-id=sha1 -Wl,--no-as-needed -ldl"
+%endif
 
 export AR=gcc-ar
 export RANLIB=gcc-ranlib
@@ -110,6 +123,8 @@ export RANLIB=gcc-ranlib
   --enable-dns-over-quic \
   --enable-dns-over-http3 \
   --with-quiche \
+%endif
+%if 0%{?rhel} >= 8
   --enable-yaml \
 %endif
   PKG_CONFIG_PATH=/usr/lib/pkgconfig:/opt/lib64/pkgconfig