From a903101ff1eae136b4e4d1924c93459dfa5d2ac5 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 20 Jan 2025 10:50:17 +0100 Subject: [PATCH 1/4] dnsdist: Enable the new YAML configuration in our packages --- builder-support/debian/dnsdist/debian-bookworm/control | 1 + builder-support/debian/dnsdist/debian-bookworm/rules | 1 + builder-support/debian/dnsdist/debian-buster/control | 1 + builder-support/debian/dnsdist/debian-buster/rules | 1 + builder-support/dockerfiles/Dockerfile.dnsdist | 2 +- builder-support/specs/dnsdist.spec | 2 ++ 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/builder-support/debian/dnsdist/debian-bookworm/control b/builder-support/debian/dnsdist/debian-bookworm/control index 023b966cfbec..2521d8c70d56 100644 --- a/builder-support/debian/dnsdist/debian-bookworm/control +++ b/builder-support/debian/dnsdist/debian-bookworm/control @@ -23,6 +23,7 @@ Build-Depends: debhelper (>= 10), libwslay-dev, libxdp-dev [linux-any], pkg-config, + python3-yaml, ragel, systemd [linux-any] Standards-Version: 4.1.5 diff --git a/builder-support/debian/dnsdist/debian-bookworm/rules b/builder-support/debian/dnsdist/debian-bookworm/rules index a633dc0f3e19..5291c3bcb250 100755 --- a/builder-support/debian/dnsdist/debian-bookworm/rules +++ b/builder-support/debian/dnsdist/debian-bookworm/rules @@ -59,6 +59,7 @@ override_dh_auto_configure: --enable-dns-over-tls \ --enable-dnscrypt \ --enable-dnstap \ + --enable-yaml \ --with-ebpf \ --with-gnutls \ --with-h2o \ diff --git a/builder-support/debian/dnsdist/debian-buster/control b/builder-support/debian/dnsdist/debian-buster/control index f42fa0ad13e9..4259f478b12b 100644 --- a/builder-support/debian/dnsdist/debian-buster/control +++ b/builder-support/debian/dnsdist/debian-buster/control @@ -21,6 +21,7 @@ Build-Depends: debhelper (>= 10), libsystemd-dev [linux-any], libwslay-dev, pkg-config, + python3-yaml, ragel, systemd [linux-any] Standards-Version: 4.1.5 diff --git a/builder-support/debian/dnsdist/debian-buster/rules b/builder-support/debian/dnsdist/debian-buster/rules index 9202097f01e3..3b732061a778 100755 --- a/builder-support/debian/dnsdist/debian-buster/rules +++ b/builder-support/debian/dnsdist/debian-buster/rules @@ -52,6 +52,7 @@ override_dh_auto_configure: --enable-dns-over-tls \ --enable-dnscrypt \ --enable-dnstap \ + --enable-yaml \ --with-ebpf \ --with-gnutls \ --with-h2o \ diff --git a/builder-support/dockerfiles/Dockerfile.dnsdist b/builder-support/dockerfiles/Dockerfile.dnsdist index 94438c308c86..ffea154e97dd 100644 --- a/builder-support/dockerfiles/Dockerfile.dnsdist +++ b/builder-support/dockerfiles/Dockerfile.dnsdist @@ -2,7 +2,7 @@ FROM alpine:3.18 as dnsdist ARG BUILDER_CACHE_BUSTER= RUN apk add --no-cache gcc g++ make tar autoconf automake protobuf-dev lua-dev \ - libtool file boost-dev ragel python3 git libedit-dev bash + libtool file boost-dev ragel python3 py3-yaml git libedit-dev bash ADD builder/helpers/set-configure-ac-version.sh /dnsdist/builder/helpers/ ADD COPYING /dnsdist/ diff --git a/builder-support/specs/dnsdist.spec b/builder-support/specs/dnsdist.spec index 182b7887a283..428e1ddfc338 100644 --- a/builder-support/specs/dnsdist.spec +++ b/builder-support/specs/dnsdist.spec @@ -9,6 +9,7 @@ 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 @@ -109,6 +110,7 @@ export RANLIB=gcc-ranlib --enable-dns-over-quic \ --enable-dns-over-http3 \ --with-quiche \ + --enable-yaml \ %endif PKG_CONFIG_PATH=/usr/lib/pkgconfig:/opt/lib64/pkgconfig %endif From b5f033e6e39e5ee3b3ec51122206bc5d8e3f7fb2 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 20 Jan 2025 12:33:17 +0100 Subject: [PATCH 2/4] dnsdist: Wild shot at building our packages with clang++ --- .../debian/dnsdist/debian-bookworm/control | 2 ++ .../debian/dnsdist/debian-bookworm/rules | 6 ++++++ .../debian/dnsdist/debian-buster/control | 2 ++ .../debian/dnsdist/debian-buster/rules | 6 ++++++ builder-support/dockerfiles/Dockerfile.dnsdist | 1 - builder-support/specs/dnsdist.spec | 17 ++++++++++++++++- 6 files changed, 32 insertions(+), 2 deletions(-) diff --git a/builder-support/debian/dnsdist/debian-bookworm/control b/builder-support/debian/dnsdist/debian-bookworm/control index 2521d8c70d56..4796af969091 100644 --- a/builder-support/debian/dnsdist/debian-bookworm/control +++ b/builder-support/debian/dnsdist/debian-bookworm/control @@ -4,6 +4,7 @@ Priority: optional Maintainer: PowerDNS.COM BV Uploaders: PowerDNS.COM BV 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, diff --git a/builder-support/debian/dnsdist/debian-bookworm/rules b/builder-support/debian/dnsdist/debian-bookworm/rules index 5291c3bcb250..4fcc760301e3 100755 --- a/builder-support/debian/dnsdist/debian-bookworm/rules +++ b/builder-support/debian/dnsdist/debian-bookworm/rules @@ -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) diff --git a/builder-support/debian/dnsdist/debian-buster/control b/builder-support/debian/dnsdist/debian-buster/control index 4259f478b12b..d9cb1f5d265f 100644 --- a/builder-support/debian/dnsdist/debian-buster/control +++ b/builder-support/debian/dnsdist/debian-buster/control @@ -4,6 +4,7 @@ Priority: optional Maintainer: PowerDNS.COM BV Uploaders: PowerDNS.COM BV 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, diff --git a/builder-support/debian/dnsdist/debian-buster/rules b/builder-support/debian/dnsdist/debian-buster/rules index 3b732061a778..ce9621d127fc 100755 --- a/builder-support/debian/dnsdist/debian-buster/rules +++ b/builder-support/debian/dnsdist/debian-buster/rules @@ -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) diff --git a/builder-support/dockerfiles/Dockerfile.dnsdist b/builder-support/dockerfiles/Dockerfile.dnsdist index ffea154e97dd..b1f096b04e11 100644 --- a/builder-support/dockerfiles/Dockerfile.dnsdist +++ b/builder-support/dockerfiles/Dockerfile.dnsdist @@ -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/ - diff --git a/builder-support/specs/dnsdist.spec b/builder-support/specs/dnsdist.spec index 428e1ddfc338..476b279c8859 100644 --- a/builder-support/specs/dnsdist.spec +++ b/builder-support/specs/dnsdist.spec @@ -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 From 5b8539a9f69427202a58dd602f8628a8e1080b47 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 20 Jan 2025 15:43:28 +0100 Subject: [PATCH 3/4] dnsdist: Add another missing `` include for EL-8 --- pdns/dnsdistdist/test-dnsdistrules_cc.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/pdns/dnsdistdist/test-dnsdistrules_cc.cc b/pdns/dnsdistdist/test-dnsdistrules_cc.cc index 692b50dbfb6e..f113aa2d525a 100644 --- a/pdns/dnsdistdist/test-dnsdistrules_cc.cc +++ b/pdns/dnsdistdist/test-dnsdistrules_cc.cc @@ -6,6 +6,7 @@ #define BOOST_TEST_NO_MAIN #include +#include #include #include "dnsdist-rules.hh" From cd1a7d7b2be5a3e3fcbf1c7f8f0c62ad9a322f38 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 20 Jan 2025 18:28:40 +0100 Subject: [PATCH 4/4] dnsdist: Add more context to the new build settings So we can actually check later if they are still needed. --- builder-support/debian/dnsdist/debian-bookworm/rules | 4 ++-- builder-support/debian/dnsdist/debian-buster/rules | 4 ++-- builder-support/specs/dnsdist.spec | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/builder-support/debian/dnsdist/debian-bookworm/rules b/builder-support/debian/dnsdist/debian-bookworm/rules index 4fcc760301e3..c02ed55e8004 100755 --- a/builder-support/debian/dnsdist/debian-bookworm/rules +++ b/builder-support/debian/dnsdist/debian-bookworm/rules @@ -11,8 +11,8 @@ 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 +# build-id SHA1 prevents an issue with the debug symbols ("export: `-Wl,--build-id=sha1': not a valid identifier") +# and the --no-as-needed -ldl an issue with the dlsym not being found ("ld.lld: error: undefined symbol: dlsym eferenced by weak.rs:142 (library/std/src/sys/pal/unix/weak.rs:142) [...] in archive ./dnsdist-rust-lib/rust/libdnsdist_rust.a) LDFLAGS += -fuse-ld=lld -Wl,--build-id=sha1 -Wl,--no-as-needed -ldl CC=clang CXX=clang++ diff --git a/builder-support/debian/dnsdist/debian-buster/rules b/builder-support/debian/dnsdist/debian-buster/rules index ce9621d127fc..a19db4f1b939 100755 --- a/builder-support/debian/dnsdist/debian-buster/rules +++ b/builder-support/debian/dnsdist/debian-buster/rules @@ -11,8 +11,8 @@ 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 +# build-id SHA1 prevents an issue with the debug symbols ("export: `-Wl,--build-id=sha1': not a valid identifier") +# and the --no-as-needed -ldl an issue with the dlsym not being found ("ld.lld: error: undefined symbol: dlsym eferenced by weak.rs:142 (library/std/src/sys/pal/unix/weak.rs:142) [...] in archive ./dnsdist-rust-lib/rust/libdnsdist_rust.a) LDFLAGS += -fuse-ld=lld -Wl,--build-id=sha1 -Wl,--no-as-needed -ldl CC=clang CXX=clang++ diff --git a/builder-support/specs/dnsdist.spec b/builder-support/specs/dnsdist.spec index 476b279c8859..42e156fdb341 100644 --- a/builder-support/specs/dnsdist.spec +++ b/builder-support/specs/dnsdist.spec @@ -81,8 +81,8 @@ export LDFLAGS=-L/usr/lib64/boost169 # 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 +# build-id SHA1 prevents an issue with the debug symbols ("export: `-Wl,--build-id=sha1': not a valid identifier") +# and the --no-as-needed -ldl an issue with the dlsym not being found ("ld.lld: error: undefined symbol: dlsym eferenced by weak.rs:142 (library/std/src/sys/pal/unix/weak.rs:142) [...] in archive ./dnsdist-rust-lib/rust/libdnsdist_rust.a) export LDFLAGS="-fuse-ld=lld -Wl,--build-id=sha1 -Wl,--no-as-needed -ldl" %endif