meson: Don't attempt to use version scripts on macOS

macOS libraries don't support symbol versioning, so the only
result that we achieve by passing additional flags to the linker
is a bunch of messages like

  ld: warning: ignoring file .../libvirt/build/src/libvirt.syms,
  building for macOS-x86_64 but attempting to link with file built
  for unknown-unsupported file format ( 0x23 0x20 0x57 0x41 ... )

being produced during the build.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Andrea Bolognani 2022-05-05 15:29:00 +02:00
parent fac80100c0
commit b05dfcdfcb
4 changed files with 47 additions and 30 deletions

View File

@ -510,6 +510,9 @@ libvirt_no_indirect = cc.get_supported_link_arguments([
if host_machine.system() == 'windows'
version_script_flags = '-Wl,'
elif host_machine.system() == 'darwin'
# macOS libraries don't support symbol versioning
version_script_flags = ''
else
test_file = '@0@/src/libvirt_qemu.syms'.format(meson.source_root())
if cc.has_link_argument('-Wl,--version-script=@0@'.format(test_file))

View File

@ -92,14 +92,16 @@ endif
libvirt_admin_link_args = [
libvirt_nodelete,
'@0@@1@'.format(
]
libvirt_admin_link_depends = []
if version_script_flags != ''
libvirt_admin_link_args += '@0@@1@'.format(
version_script_flags,
libvirt_admin_syms_path,
),
]
libvirt_admin_link_depends = [
libvirt_admin_syms_file,
]
)
libvirt_admin_link_depends += libvirt_admin_syms_file
endif
if conf.has('WITH_REMOTE')
admin_driver_lib = static_library(

View File

@ -379,14 +379,16 @@ libvirt_link_args = [
libvirt_flat_namespace,
libvirt_no_undefined,
libvirt_nodelete,
'@0@@1@'.format(
]
libvirt_link_depends = []
if version_script_flags != ''
libvirt_link_args += '@0@@1@'.format(
version_script_flags,
libvirt_syms_path,
),
]
libvirt_link_depends = [
libvirt_syms_file,
]
)
libvirt_link_depends += libvirt_syms_file
endif
libvirt_lib = shared_library(
'virt',
@ -431,14 +433,16 @@ endif
libvirt_qemu_link_args = [
libvirt_nodelete,
'@0@@1@'.format(
]
libvirt_qemu_link_depends = []
if version_script_flags != ''
libvirt_qemu_link_args += '@0@@1@'.format(
version_script_flags,
libvirt_qemu_syms_path,
),
]
libvirt_qemu_link_depends = [
libvirt_qemu_syms_file,
]
)
libvirt_qemu_link_depends += libvirt_qemu_syms_file
endif
libvirt_qemu_sources = files(
'libvirt-qemu.c',
@ -488,14 +492,16 @@ endif
libvirt_lxc_link_args = [
libvirt_nodelete,
'@0@@1@'.format(
]
libvirt_lxc_link_depends = []
if version_script_flags != ''
libvirt_lxc_link_args += '@0@@1@'.format(
version_script_flags,
libvirt_lxc_syms_path,
),
]
libvirt_lxc_link_depends = [
libvirt_lxc_syms_file,
]
)
libvirt_lxc_link_depends += libvirt_lxc_syms_file
endif
libvirt_lxc_sources = files(
'libvirt-lxc.c',

View File

@ -55,11 +55,14 @@ nss_libvirt_syms_path = nss_libvirt_syms_file
nss_libvirt_link_args = [
libvirt_export_dynamic,
coverage_flags,
'@0@@1@'.format(
]
if version_script_flags != ''
nss_libvirt_link_args += '@0@@1@'.format(
version_script_flags,
nss_libvirt_syms_path,
),
]
)
endif
nss_libvirt_lib = shared_library(
'nss_libvirt',
@ -79,11 +82,14 @@ nss_libvirt_guest_syms_path = nss_libvirt_guest_syms_file
nss_libvirt_guest_link_args = [
libvirt_export_dynamic,
coverage_flags,
'@0@@1@'.format(
]
if version_script_flags != ''
nss_libvirt_guest_link_args += '@0@@1@'.format(
version_script_flags,
nss_libvirt_guest_syms_path,
),
]
)
endif
nss_libvirt_guest_lib = shared_library(
'nss_libvirt_guest',