]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: suppress "ignoring duplicate libraries" warning on macOS
authorLaine Stump <laine@redhat.com>
Fri, 3 Nov 2023 17:07:19 +0000 (13:07 -0400)
committerLaine Stump <laine@redhat.com>
Fri, 3 Nov 2023 19:56:37 +0000 (15:56 -0400)
Xcode 15, which provides the compiler toolchain for building libvirt
on macOS has switched to a new linker that warns about duplicated
"-lblah" options on the ld commandline. In practice this is impossible
to prevent in a large project, and also harmless.

Fortunately the new ld command also has an option,
-no_warn_duplicate_libraries, that supresses this harmless/pointless
warning, meson has a simple way to check if that option is supported,
and libvirt's meson.build files already have examples of adding an
option to the ld commandline if it's available.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
meson.build
src/meson.build
tests/meson.build
tools/meson.build

index 755e9187e252872b176fbd02a5fc768e26de51fd..62481a008d1f930b73b475ec2db99708bc35d5af 100644 (file)
@@ -542,6 +542,10 @@ libvirt_no_indirect = cc.get_supported_link_arguments([
   '-Wl,--no-copy-dt-needed-entries',
 ])
 
+libvirt_no_warn_duplicate_libraries = cc.get_supported_link_arguments([
+  '-Wl,-no_warn_duplicate_libraries',
+])
+
 if host_machine.system() == 'windows'
   version_script_flags = '-Wl,'
 elif host_machine.system() == 'darwin'
index 5fc4d03b4a5fe26f449d046bbb3051f0e477cd9f..6538c436281653a0c4398b02e41f96672b42aac8 100644 (file)
@@ -18,6 +18,7 @@ src_dep = declare_dependency(
   link_args: (
     libvirt_relro
     + libvirt_no_indirect
+    + libvirt_no_warn_duplicate_libraries
     + coverage_flags
     + driver_modules_flags
     + win32_link_flags
index b235c5f4dd41e414188ce5673a99030f5b01bcff..e1cd57654a39492a7b5ce066951b03d42b5ed0f5 100644 (file)
@@ -28,6 +28,7 @@ tests_dep = declare_dependency(
   ],
   link_args: (
     libvirt_export_dynamic
+    + libvirt_no_warn_duplicate_libraries
     + libvirt_flat_namespace
     + coverage_flags
   ),
index f2d58cfdcbfb209870eaa5550aa1f5a1ee37d8f3..c72f760a1ddf6e9f4aee3789df5f1b40e555861e 100644 (file)
@@ -16,6 +16,7 @@ tools_dep = declare_dependency(
     libvirt_relro
     + libvirt_no_indirect
     + libvirt_no_undefined
+    + libvirt_no_warn_duplicate_libraries
   ),
 )