From 5f0fcf15d5679348e2e8fd42ccd2de88e4a939ed Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 14 Aug 2024 23:56:04 +0800 Subject: check platform packages --- xmake/modules/private/action/require/impl/package.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index 1c7eaf9e5..510d9a23f 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -852,6 +852,17 @@ function _select_package_runtimes(package) end end +-- check platform toolchains, package maybe use host platform, it's toolchain has been not checked yet. +-- @see https://github.com/xmake-io/xmake/issues/5455 +function _check_package_platform_toolchains(package) + if not package:toolchains() then + local platform_inst = platform.load(package:plat(), package:arch()) + if not platform_inst:check() then + raise("no any matched platform for this package(%s)!", package:name()) + end + end +end + -- load required packages function _load_package(packagename, requireinfo, opt) @@ -1004,6 +1015,9 @@ function _load_package(packagename, requireinfo, opt) end end + -- check package platform toolchains first, package:has_tool will be called in on_load + _check_package_platform_toolchains(package) + -- do load package:_load() -- cgit v1.3.1