]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix linkage to libutil and libkvm on FreeBSD 11
authorDaniel P. Berrangé <berrange@redhat.com>
Fri, 4 Sep 2020 11:52:13 +0000 (12:52 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 10 Sep 2020 12:11:46 +0000 (13:11 +0100)
We are currently adding -lutil and -lkvm to the linker using the
add_project_link_arguments method. On FreeBSD 11.4, this results in
build errors because the args appear too early in the command line.

We need to pass the libraries as dependencies so that they get placed
at the same point in the linker args as other dependencies.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
meson.build
src/bhyve/meson.build
src/util/meson.build

index 33eaa9ff56d98751c6947d25196c0ac428cfb399..bcb978292b690f2c810cfafb69f507fa2d77331e 100644 (file)
@@ -1086,7 +1086,8 @@ endif
 # Check for BSD kvm (kernel memory interface)
 if host_machine.system() == 'freebsd'
   kvm_dep = cc.find_library('kvm')
-  add_project_link_arguments('-lkvm', language: 'c')
+else
+  kvm_dep = dependency('', required: false)
 endif
 
 libiscsi_version = '1.18.0'
@@ -1203,11 +1204,10 @@ have_gnu_gettext_tools = false
 if not get_option('nls').disabled()
   have_gettext = cc.has_function('gettext')
   if not have_gettext
-    intl_lib = cc.find_library('intl', required: false)
-    have_gettext = intl_lib.found()
-    if have_gettext
-      add_project_link_arguments('-lintl', language: 'c')
-    endif
+    intl_dep = cc.find_library('intl', required: false)
+    have_gettext = intl_dep.found()
+  else
+    intl_dep = dependency('', required: false)
   endif
   if not have_gettext and get_option('nls').enabled()
     error('gettext() is required to build libvirt')
@@ -1235,6 +1235,8 @@ if not get_option('nls').disabled()
       have_gnu_gettext_tools = true
     endif
   endif
+else
+  intl_dep = dependency('', required: false)
 endif
 
 numactl_dep = cc.find_library('numa', required: get_option('numactl'))
@@ -1402,9 +1404,6 @@ if udev_dep.found()
 endif
 
 util_dep = cc.find_library('util', required: false)
-if util_dep.found()
-  add_project_link_arguments('-lutil', language: 'c')
-endif
 
 if not get_option('virtualport').disabled()
   if cc.has_header_symbol('linux/if_link.h', 'IFLA_PORT_MAX')
index 7d54718820d05d87e25827ff48e21a6d10fcfaa3..975f93a9c03829ae0fc872fb4aa2f49da5d3bfba 100644 (file)
@@ -21,7 +21,9 @@ if conf.has('WITH_BHYVE')
     ],
     dependencies: [
       access_dep,
+      kvm_dep,
       src_dep,
+      util_dep,
     ],
     include_directories: [
       conf_inc_dir,
index f7092cc3f1644110c754adbafc45871df7c3b8b7..bf556e7ae689d4a3894229b5e24d848fc1e6809e 100644 (file)
@@ -187,12 +187,14 @@ virt_util_lib = static_library(
     dbus_dep,
     devmapper_dep,
     gnutls_dep,
+    intl_dep,
     libnl_dep,
     m_dep,
     numactl_dep,
     secdriver_dep,
     src_dep,
     thread_dep,
+    util_dep,
     win32_dep,
     yajl_dep,
   ],