msys2 clang64编译
#6059
Replies: 2 comments
-
set_toolchains("clang")和add_cflags("--target=x86_64-w64-windows-gnu")不起任何作用。 |
Beta Was this translation helpful? Give feedback.
0 replies
-
需要设置平台 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
xmake版本:2.9.7
系统版本:Windows 11 24h2
vscode插件版本:目前最新版
简要描述:
Windows 的MSYS2的Clang64环境下,没有clang64 msvc运行库,用的ucrt运行库,是否添加在Windows 编译时,添加gcc/clang/llvm的运行库,另外还有winthread 和pthread多线程选项。
问题描述:
一般情况下,vs code插件在xmake下栏中设置"mingw -x86_64 clang"能够默认设置clang编译器cflags选项,使用"--target=x86_64-w64-windows-gnu"。
当我编译一个git库的时候,会自动跳回使用"windows -x86_64 msvc "设置,这时clang编译器的cflags选项使用"--target=x86_64-w64-windows-msvc"。
在查阅Wiki时,找到如下解释:

我觉得这不是很有必要,除非使用clang-cl和msvc交叉编译。
例子(伪脚本):
未编译git库时,设置vs code插件"mingw -x86_64 Debug clang",使用一下xmake.lua构建,默认使用"--target=x86_64-w64-windows-gnu"标识。
当我添加git库,使用以下脚本时,vs code自动设置回"windows -x86_64 Release clang",并使用"--target=x86_64-w64-windows-msvc"的clang cflags标识。
xmake # 提示是否修改pkg,按y确认后,编译完后就重置终端跳回使用msvc标识。
使用mavc标识选项后,连接的库对不上,后面根本编译不了。
Beta Was this translation helpful? Give feedback.
All reactions