]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: Fix build with -Dtest_coverage=true
authorJiri Denemark <jdenemar@redhat.com>
Fri, 15 Jan 2021 21:35:09 +0000 (22:35 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 19 Jan 2021 15:25:50 +0000 (16:25 +0100)
As can be seen in commit 8a62a1592ae00eab4eb153c02661e56b9d8d9032 (from
autoconf era), the coverage flags have to be used also when linking
objects. However, this was not reflected when we switched to meson.

Without this patch linking fails with undefined references to various
__gcov_* symbols.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
tests/meson.build
tools/nss/meson.build
tools/wireshark/src/meson.build

index f1d91ca50d47d7a1a565dcd1f4d585efbd489521..23255dd62ad6ca6632c6f8697b03e2aeb04d1a5e 100644 (file)
@@ -26,7 +26,10 @@ tests_dep = declare_dependency(
     top_inc_dir,
     util_inc_dir,
   ],
-  link_args: libvirt_export_dynamic,
+  link_args: (
+    libvirt_export_dynamic
+    + coverage_flags
+  ),
 )
 
 tests_env = [
@@ -228,9 +231,6 @@ executable(
   dependencies: [
     tests_dep,
   ],
-  link_args: [
-    coverage_flags,
-  ],
 )
 
 
index cf3eec9b24a1c7d99e742a0f733813452a829002..198936f3d42e1827d0f03ff3b27a198bdc4fa59c 100644 (file)
@@ -66,6 +66,7 @@ nss_libvirt_lib = shared_module(
   link_args: [
     nss_libvirt_syms,
     libvirt_export_dynamic,
+    coverage_flags,
   ],
   link_whole: [
     nss_libvirt_impl,
@@ -81,6 +82,7 @@ nss_libvirt_guest_lib = shared_library(
   link_args: [
     nss_libvirt_guest_syms,
     libvirt_export_dynamic,
+    coverage_flags,
   ],
   link_whole: [
     nss_libvirt_guest_impl,
index 49ccc9bb86e6abd72d3c56a4c452bfbd38ba654c..9b452dc5ca7d194a7d3e0e7bd68fd8aa9cf714c0 100644 (file)
@@ -12,6 +12,9 @@ shared_library(
     xdr_dep,
     tools_dep,
   ],
+  link_args: [
+    coverage_flags
+  ],
   install: true,
   install_dir: wireshark_plugindir,
 )