diff --git a/builder-support/debian/dnsdist/debian-bookworm/control b/builder-support/debian/dnsdist/debian-bookworm/control index 023b966cfbec..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,7 +23,9 @@ Build-Depends: debhelper (>= 10), libsystemd-dev [linux-any], libwslay-dev, libxdp-dev [linux-any], + lld, 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..c02ed55e8004 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 ("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++ # Only enable systemd integration on Linux operating systems ifeq ($(DEB_HOST_ARCH_OS),linux) @@ -59,6 +65,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..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,7 +21,9 @@ Build-Depends: debhelper (>= 10), libssl-dev, libsystemd-dev [linux-any], libwslay-dev, + lld, 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..a19db4f1b939 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 ("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++ # Only enable systemd integration on Linux operating systems ifeq ($(DEB_HOST_ARCH_OS),linux) @@ -52,6 +58,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..b1f096b04e11 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/ @@ -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 182b7887a283..42e156fdb341 100644 --- a/builder-support/specs/dnsdist.spec +++ b/builder-support/specs/dnsdist.spec @@ -21,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 @@ -71,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 ("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 export AR=gcc-ar export RANLIB=gcc-ranlib @@ -109,6 +123,9 @@ 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 %endif 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"