aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2023-02-10 01:52:08 +0100
committerThomas Huth <thuth@redhat.com>2023-02-14 09:02:42 +0100
commit550c6d97ded04f5dc2da7b34d7a95284271304a5 (patch)
tree5fdcb9b73c1a2e27441199b0a906b666148fea8a /meson.build
parentbc71d58fd7f149081f89fb3a414ceb79691049db (diff)
meson: Disable libdw for static builds by default
Static QEMU build fails on Debian Bullseye: /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libdw.a(debuginfod-client.o): in function `__libdwfl_debuginfod_init': (.text.startup+0x17): undefined reference to `dlopen' The reason is that pkg-config does not suggest -ldl for libdw, and adding --extra-ldflags="-ldl" resolves the issue. However, static linking with libdw is an unclear topic: * Linux perf does it. * Debian's libdw-dev description says: Only link to the static version for special cases and when you don't need anything from the ebl backends. * As the error message above indicates, -ldl is also needed for debuginfod support. The functionality provided by libdw is needed for analyzing performance of JITed code, which is mostly useful to developers and researchers. Therefore, in order to avoid unpleasant surprises for people who don't need this, simply disable libdw for static builds by default. It can still be enabled explicitly if needed. Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20230210005208.438142-2-iii@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build3
1 files changed, 2 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 50eb670511..0026bba0ce 100644
--- a/meson.build
+++ b/meson.build
@@ -1650,7 +1650,8 @@ endif
# libdw
libdw = not_found
-if not get_option('libdw').auto() or have_system or have_user
+if not get_option('libdw').auto() or \
+ (not enable_static and (have_system or have_user))
libdw = dependency('libdw',
method: 'pkg-config',
kwargs: static_kwargs,