xmake icon indicating copy to clipboard operation
xmake copied to clipboard

set_runtime("MT")会导致android配置失败

Open lishinko opened this issue 2 months ago • 3 comments

Xmake 版本

3.04

操作系统版本和架构

Windows 11 10.0.26100

描述问题

set_runtime("MT")会导致生成android版本的cmake的时候出现如下错误:

-- Android: Targeting API '21' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64' -- Android: Selected uniCMake Error at D:/Program Files/CMake/share/cmake-3.28/Modules/Platform/Android-Common.cmake:30 (message): The CMAKE_ANDR-- Configuring incomplete, errors occurred! alues: none system c++_static c++_shared gabi++_static gabi++_shared gnustl_static gnustl_shared stlport_static stlport_shared Call Stack (most recent call first): D:/Program Files/CMake/share/cmake-3.28/Modules/Platform/Android-Clang.cmake:52 (include) D:/Program Files/CMake/share/cmake-3.28/Modules/Platform/Android-Clang-C.cmake:1 (include)

这里连CMake的错误输出都不正常了,说明xmake在错误日志输出方面可能有多线程问题。 具体到本问题,解决办法就是:

if is_plat("windows") then set_runtime("MT") else if is_plat("android") then set_runtime("c++_static") end

我觉得,xmake在这里应该提供更加友好的错误输出: 你不能在Android平台使用windows专用的“MT” runtime

期待的结果

xmake报错说MT不能用在android平台上

工程配置

在xmake.lua中设置 set_runtime("MT") 然后生成android即可复现

附加信息和错误日志

lishinko avatar Oct 20 '25 02:10 lishinko

Bot detected the issue body's language is not English, translate it automatically.


Title: set_runtime("MT") will cause android configuration to fail

Issues-translate-bot avatar Oct 20 '25 03:10 Issues-translate-bot

可以提个 pr 过来,在这里加上 runtimes 检测就行了。https://github.com/xmake-io/xmake/tree/dev/xmake/modules/private/check/checkers/api/target

waruqi avatar Oct 20 '25 15:10 waruqi

Bot detected the issue body's language is not English, translate it automatically.


You can submit a PR and just add runtimes detection here. https://github.com/xmake-io/xmake/tree/dev/xmake/modules/private/check/checkers/api/target

Issues-translate-bot avatar Oct 20 '25 15:10 Issues-translate-bot