[PATCH] Fix linkage to libutil and libkvm on FreeBSD 11
Roman Bogorodskiy
bogorodskiy at gmail.com
Sat Sep 5 02:45:57 UTC 2020
Daniel P. Berrangé wrote:
> 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.
>
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
> meson.build | 16 +++++++---------
> src/bhyve/meson.build | 15 +++++++++++----
> src/util/meson.build | 26 +++++++++++++++++---------
> 3 files changed, 35 insertions(+), 22 deletions(-)
>
> Using the CI patch I posted earlier to add FreeBSD 11:
>
> https://gitlab.com/berrange/libvirt/-/pipelines/185834799
>
>
> diff --git a/meson.build b/meson.build
> index 1eadea33bf..c30ff187aa 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -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 = disabler()
> endif
>
> libiscsi_version = '1.18.0'
> @@ -1203,11 +1204,9 @@ 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)
> + else
> + intl_dep = disabler()
> endif
> if not have_gettext and get_option('nls').enabled()
> error('gettext() is required to build libvirt')
Looks like this error is issued even if we found intl_dep.
Should this check be updated to:
if not (have_gettext or intl_dep.found()) and get_option('nls').enabled()
error(...)
?
> @@ -1235,6 +1234,8 @@ if not get_option('nls').disabled()
> have_gnu_gettext_tools = true
> endif
> endif
> +else
> + intl_dep = disabler()
> endif
>
> numactl_dep = cc.find_library('numa', required: get_option('numactl'))
> @@ -1402,9 +1403,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')
Roman Bogorodskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200905/2f589683/attachment-0001.sig>
More information about the libvir-list
mailing list