From 1a317693ec91a6c90e970bd9aa44261edea432c0 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 21 Mar 2025 09:53:23 +0100 Subject: [PATCH] dnsdist: Better handling of the `dlsym` missing symbol in our Rust lib --- builder-support/debian/dnsdist/debian-bookworm/rules | 3 +-- builder-support/debian/dnsdist/debian-bullseye/rules | 3 +-- builder-support/specs/dnsdist.spec | 3 +-- pdns/dnsdistdist/meson.build | 3 +++ 4 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 ee60781ecf..2888faadf3 100755 --- a/builder-support/debian/dnsdist/debian-bookworm/rules +++ b/builder-support/debian/dnsdist/debian-bookworm/rules @@ -42,10 +42,9 @@ override_dh_auto_clean: #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 -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) override_dh_auto_configure: - LDFLAGS="-latomic -fuse-ld=lld -Wl,--build-id=sha1 -ldl" \ + LDFLAGS="-latomic -fuse-ld=lld -Wl,--build-id=sha1" \ CC=clang \ CXX=clang++ \ PKG_CONFIG_PATH=/opt/lib/pkgconfig dh_auto_configure -- \ diff --git a/builder-support/debian/dnsdist/debian-bullseye/rules b/builder-support/debian/dnsdist/debian-bullseye/rules index 81b9bf7c95..db6f96b4b6 100755 --- a/builder-support/debian/dnsdist/debian-bullseye/rules +++ b/builder-support/debian/dnsdist/debian-bullseye/rules @@ -35,10 +35,9 @@ override_dh_auto_clean: #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 -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) override_dh_auto_configure: - LDFLAGS="-latomic -fuse-ld=lld -Wl,--build-id=sha1 -ldl" \ + LDFLAGS="-latomic -fuse-ld=lld -Wl,--build-id=sha1" \ CC=clang \ CXX=clang++ \ PKG_CONFIG_PATH=/opt/lib/pkgconfig dh_auto_configure -- \ diff --git a/builder-support/specs/dnsdist.spec b/builder-support/specs/dnsdist.spec index b7181686d7..ffc1d6a31e 100644 --- a/builder-support/specs/dnsdist.spec +++ b/builder-support/specs/dnsdist.spec @@ -73,8 +73,7 @@ dnsdist is a high-performance DNS loadbalancer that is scriptable in Lua. 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 -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 -ldl" +export LDFLAGS="-fuse-ld=lld -Wl,--build-id=sha1" %if 0%{?rhel} < 9 # starting with EL-9 we get these hardening settings for free by just setting the right toolchain (see above) diff --git a/pdns/dnsdistdist/meson.build b/pdns/dnsdistdist/meson.build index 039486d2fc..3e2ae94020 100644 --- a/pdns/dnsdistdist/meson.build +++ b/pdns/dnsdistdist/meson.build @@ -108,8 +108,10 @@ endif if get_option('yaml').allowed() subdir('dnsdist-rust-lib') + subdir('meson' / 'dlopen') # our Rust static library needs dlopen else dep_dnsdist_rust_lib = declare_dependency() + dep_dlopen = declare_dependency() endif common_sources += files( @@ -335,6 +337,7 @@ deps = [ dep_arc4random, dep_boost, dep_cdb, + dep_dlopen, dep_dnstap, dep_htmlfiles, dep_ipcrypt, -- 2.47.2