From nobody Sun May 5 12:56:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599225899; cv=none; d=zohomail.com; s=zohoarc; b=IJh2+eSQFJ2+bKyQPbr42tRDYmp5v/A4XFOYl0WDqQPfeeyQYnnMkGVD+U2aPiPwPR6OBTrX9F9ZXPbY8e2uoodhwFqSUihfj/e2nYdk1NT35/LizT+zWbKh9q4DVlVOYuZIGiJ3j77e8VB9huHY2h0RnDrf85AMgu++4+U6fow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599225899; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Y89nwXLoGg4uM22L68PChL8nHRpP0pjxGcsMR6CeTxA=; b=Hj5mUGlEg6lhA5kMDhX8xu8MnFLoTM7R/wqyLChtHWMlIQWMIlKaukQ3jq71iT8F+bJMm272PnPun2Lp+ScFm+7oVQMUPNHuwQyqNejAz16aEHcQiVoefUtMbAgo3d1QPOXQT6x5BiUtesbxck2E9hbSvsdQDzFEKf8JcPchTyc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1599225899753245.70942117876257; Fri, 4 Sep 2020 06:24:59 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-135-v2eHcDPBOUuCR7RMJGGX6Q-1; Fri, 04 Sep 2020 09:24:51 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E96E18BA287; Fri, 4 Sep 2020 13:24:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF29D7E66D; Fri, 4 Sep 2020 13:24:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 84C3179DBD; Fri, 4 Sep 2020 13:24:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 084DO1kM004048 for ; Fri, 4 Sep 2020 09:24:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 403525C269; Fri, 4 Sep 2020 13:24:01 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-114-5.ams2.redhat.com [10.36.114.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E2CB5C1D0; Fri, 4 Sep 2020 13:23:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599225898; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Y89nwXLoGg4uM22L68PChL8nHRpP0pjxGcsMR6CeTxA=; b=NRtGcoojkmZ3sROtFkbgSfzTennpQGwMup4jz1xSDbnhHUBA93/dY6U+Vrx0VSQseqmAHv S6cGBhHPTg+3NOfg+BVI3CkDpZoxaLeFxwcLh5k6oD4GGJv6YOZVqIyznbBxpx8nRcvlfg aINr2G0CSVMd7lKVteD2NWRCVkzxQHk= X-MC-Unique: v2eHcDPBOUuCR7RMJGGX6Q-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [PATCH] Fix linkage to libutil and libkvm on FreeBSD 11 Date: Fri, 4 Sep 2020 14:23:48 +0100 Message-Id: <20200904132348.761918-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Pavel Hrdina , Roman Bogorodskiy X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 Reviewed-by: J=C3=A1n Tomko --- 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() =3D=3D 'freebsd' kvm_dep =3D cc.find_library('kvm') - add_project_link_arguments('-lkvm', language: 'c') +else + kvm_dep =3D disabler() endif =20 libiscsi_version =3D '1.18.0' @@ -1203,11 +1204,9 @@ have_gnu_gettext_tools =3D false if not get_option('nls').disabled() have_gettext =3D cc.has_function('gettext') if not have_gettext - intl_lib =3D cc.find_library('intl', required: false) - have_gettext =3D intl_lib.found() - if have_gettext - add_project_link_arguments('-lintl', language: 'c') - endif + intl_dep =3D cc.find_library('intl', required: false) + else + intl_dep =3D disabler() endif if not have_gettext and get_option('nls').enabled() error('gettext() is required to build libvirt') @@ -1235,6 +1234,8 @@ if not get_option('nls').disabled() have_gnu_gettext_tools =3D true endif endif +else + intl_dep =3D disabler() endif =20 numactl_dep =3D cc.find_library('numa', required: get_option('numactl')) @@ -1402,9 +1403,6 @@ if udev_dep.found() endif =20 util_dep =3D cc.find_library('util', required: false) -if util_dep.found() - add_project_link_arguments('-lutil', language: 'c') -endif =20 if not get_option('virtualport').disabled() if cc.has_header_symbol('linux/if_link.h', 'IFLA_PORT_MAX') diff --git a/src/bhyve/meson.build b/src/bhyve/meson.build index 7d54718820..c382f64aee 100644 --- a/src/bhyve/meson.build +++ b/src/bhyve/meson.build @@ -14,15 +14,22 @@ driver_source_files +=3D bhyve_sources stateful_driver_source_files +=3D bhyve_sources =20 if conf.has('WITH_BHYVE') + bhyve_driver_deps =3D [ + access_dep, + src_dep, + ] + if kvm_dep.found() + bhyve_driver_deps +=3D kvm_dep + endif + if util_dep.found() + bhyve_driver_deps +=3D util_dep + endif bhyve_driver_impl =3D static_library( 'virt_driver_bhyve_impl', [ bhyve_sources, ], - dependencies: [ - access_dep, - src_dep, - ], + dependencies: bhyve_driver_deps, include_directories: [ conf_inc_dir, hypervisor_inc_dir, diff --git a/src/util/meson.build b/src/util/meson.build index f7092cc3f1..c899f232e6 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -172,15 +172,7 @@ io_helper_sources =3D [ 'iohelper.c', ] =20 -virt_util_lib =3D static_library( - 'virt_util', - [ - util_sources, - util_public_sources, - keycode_gen_sources, - dtrace_gen_headers, - ], - dependencies: [ +virt_util_deps =3D [ acl_dep, audit_dep, capng_dep, @@ -195,7 +187,23 @@ virt_util_lib =3D static_library( thread_dep, win32_dep, yajl_dep, + ] +if util_dep.found() + virt_util_deps +=3D util_dep +endif +if intl_dep.found() + virt_util_deps +=3D intl_dep +endif + +virt_util_lib =3D static_library( + 'virt_util', + [ + util_sources, + util_public_sources, + keycode_gen_sources, + dtrace_gen_headers, ], + dependencies: virt_util_deps, ) =20 libvirt_libs +=3D virt_util_lib --=20 2.26.2