From patchwork Thu Apr 21 15:25:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Ziegler X-Patchwork-Id: 1620215 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KkhFp22yjz9s5V for ; Fri, 22 Apr 2022 01:26:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 20B21841C5; Thu, 21 Apr 2022 15:26:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BeJJa441O1h7; Thu, 21 Apr 2022 15:26:03 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 034F78412A; Thu, 21 Apr 2022 15:26:02 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id B969E1BF304 for ; Thu, 21 Apr 2022 15:25:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A760C6F593 for ; Thu, 21 Apr 2022 15:25:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PWs840xddcYT for ; Thu, 21 Apr 2022 15:25:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from serv15.avernis.de (serv15.avernis.de [176.9.89.163]) by smtp3.osuosl.org (Postfix) with ESMTPS id 1CF8C61391 for ; Thu, 21 Apr 2022 15:25:57 +0000 (UTC) Received: from iago.. (unknown [151.37.170.42]) by serv15.avernis.de (Postfix) with ESMTPSA id 69CC6C5431E5; Thu, 21 Apr 2022 17:25:55 +0200 (CEST) From: Andreas Ziegler To: buildroot@buildroot.org Date: Thu, 21 Apr 2022 17:25:30 +0200 Message-Id: <20220421152530.3900282-1-br015@umbiko.net> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.5 at serv15.avernis.de X-Virus-Status: Clean Subject: [Buildroot] [PATCH 1/1] meson-package: prevent cmake find_package() picking up host libraries X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Le Bihan , Andreas Ziegler Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" The meson build system uses (1) pkg-config and (2) cmake find_package to locate dependencies and stops only if a package is found. Cmake uses a toolchain file that is generated by meson from the existing configuration [1]. The cmake toolchain file misses CMAKE_FIND_ROOT_PATH and CMAKE_FIND_ROOT_PATH_* settings, and find_package() falls back to the default behaviour and looks for dependencies on the build machine (the Buildroot HOST_DIR). Use a feature introduced in meson 0.56.0 [2] to pass the Buildroot toolchain file to cmake instead of using a meson-generated one. Fixes the following build failures: http://autobuild.buildroot.org/results/056/05673ed04c6f044f1b56b9d5342d61653be43a18/ http://autobuild.buildroot.org/results/f0a/f0a9e719114f19dc9d20622ed85dd4f8e968c20f/ http://autobuild.buildroot.org/results/527/527ee199813abbacd61c3fa32b517ea60af60659/ [1[ see mesonbuild/cmake/toolchain.py [2] see https://mesonbuild.com/CMake-module.html#cross-compilation Signed-off-by: Andreas Ziegler --- package/pkg-meson.mk | 1 + support/misc/cross-compilation.conf.in | 3 +++ 2 files changed, 4 insertions(+) diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index 9e70d49b60..f1390a18d0 100644 --- a/package/pkg-meson.mk +++ b/package/pkg-meson.mk @@ -81,6 +81,7 @@ define PKG_MESON_CROSSCONFIG_SED -e "s%@TARGET_CXXFLAGS@%$(call make-sq-comma-list,$($(strip $(2))))%g" \ -e "s%@BR2_CMAKE@%$(BR2_CMAKE)%g" \ -e "s%@PKGCONF_HOST_BINARY@%$(HOST_DIR)/bin/pkgconf%g" \ + -e "s%@HOST_DIR@%$(HOST_DIR)%g" \ -e "s%@STAGING_DIR@%$(STAGING_DIR)%g" \ -e "s%@STATIC@%$(if $(BR2_STATIC_LIBS),true,false)%g" \ $(TOPDIR)/support/misc/cross-compilation.conf.in diff --git a/support/misc/cross-compilation.conf.in b/support/misc/cross-compilation.conf.in index 1977a83501..235e5a8495 100644 --- a/support/misc/cross-compilation.conf.in +++ b/support/misc/cross-compilation.conf.in @@ -26,6 +26,9 @@ needs_exe_wrapper = true sys_root = '@STAGING_DIR@' pkg_config_libdir = '@STAGING_DIR@/usr/lib/pkgconfig:@STAGING_DIR@/usr/share/pkgconfig' pkg_config_static = '@STATIC@' +# enable meson build to pass a toolchain file to cmake +cmake_toolchain_file = '@HOST_DIR@/share/buildroot/toolchainfile.cmake' +cmake_defaults = false [host_machine] system = 'linux'