From nobody Sun Feb 8 17:04:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1682588488; cv=none; d=zohomail.com; s=zohoarc; b=j3Ij+sKxxHHTkfCJ8p2DyME43xKp3/EZrX95C23lBLDvALARcHIRLOB2QFzdVLJ4Bd6CFb5qeodk21ScLKmKei5b0NjGPjElBLmr0qlHuy2dTwexMcsjyrfOPcL0yYE8JaSkPpEmUBU5jVaBNqqbMEdyGSINQerMfrs19OQXxtQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682588488; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=ibNsQ8RWSOJK631Dm15Qkggvq+Pg/vgh1skrjA02nHc=; b=cjp7P+//v0bsFMeD7Dw/5subgxfIh6RFlcWMrVWj6vg8JXFk8g3DTW9pPRihjfjdfqjA4YN/50SChaFWY12DTjVhFPLRUsDb5isKnF3rsPZvEc3YCc6RZo/h0p9iRmIerA7mWd+DEXm86CoFqzsXp7svoTUgnEEGpytqGE9ZCvs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 16825884880895.1470983694373444; Thu, 27 Apr 2023 02:41:28 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-313--THQjGY8PXWS5W5wIXDo_A-1; Thu, 27 Apr 2023 05:41:25 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C95BAA0F38B; Thu, 27 Apr 2023 09:41:22 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5C1740C2064; Thu, 27 Apr 2023 09:41:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B41611946A49; Thu, 27 Apr 2023 09:41:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AA3331946A45 for ; Thu, 27 Apr 2023 09:41:20 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 899FE1415304; Thu, 27 Apr 2023 09:41:20 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.225.231]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C95214152F6 for ; Thu, 27 Apr 2023 09:41:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682588487; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=ibNsQ8RWSOJK631Dm15Qkggvq+Pg/vgh1skrjA02nHc=; b=We/K+Amp0bBeuuF7xpjJMFxesxwxN8x24lqRuSSNW23WQ+GMrUvFGciQ+TRIILFMAC35FV ONoOJtqvgqoOVxJKz0zQHbY+GZx/ZmFgJQFHOmr/Tz+/zteKxrryfoqkxWahmBjhGTFmiP H9GBLgjJ5nn+8pV4mSp9dL0ejAPT2Ls= X-MC-Unique: -THQjGY8PXWS5W5wIXDo_A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH] meson: Check usability of linux/kvm.h Date: Thu, 27 Apr 2023 11:41:18 +0200 Message-Id: <20230427094118.58470-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682588488708100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This fixes cross-building in some scenarios. Specifically, when building for armv7l on x86_64, has_header() will see the x86_64 version of the header and consider it usable. Later, when an attempt is made to actually use it, the compiler will quickly realize that things can't quite work. The reason why we haven't hit this in our CI is that we only ever install the foreign version of header files. When building the Debian package, however, some of the Debian-specific tooling will bring in the native version of the Linux headers in addition to the foreign one, causing Meson to misreport the header's availability status. Checking for its actual usability, as opposed to mere presence, is enough to make things work correctly in all cases. https://bugs.debian.org/1024504 Suggested-by: Helmut Grohne Signed-off-by: Andrea Bolognani --- meson.build | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index d35d5e076b..21a4bd5b37 100644 --- a/meson.build +++ b/meson.build @@ -614,7 +614,6 @@ headers =3D [ 'asm/hwcap.h', 'ifaddrs.h', 'libtasn1.h', - 'linux/kvm.h', 'mntent.h', 'net/ethernet.h', 'net/if.h', @@ -635,12 +634,24 @@ if host_machine.system() =3D=3D 'freebsd' headers +=3D 'libutil.h' endif =20 +# headers for which we need to check actual usability. in most +# cases, checking for presence is enough (and it's way faster) +check_headers =3D [ + 'linux/kvm.h', +] + foreach name : headers if cc.has_header(name) conf.set('WITH_@0@'.format(name.underscorify().to_upper()), 1) endif endforeach =20 +foreach name : check_headers + if cc.check_header(name) + conf.set('WITH_@0@'.format(name.underscorify().to_upper()), 1) + endif +endforeach + # check for kernel header required by src/util/virnetdevbridge.c if host_machine.system() =3D=3D 'linux' if not cc.has_header('linux/sockios.h') --=20 2.40.0