xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
10.14k stars 782 forks source link

在windows vs2022上无法启用ASan #5396

Open myzhan opened 3 months ago

myzhan commented 3 months ago

Xmake 版本

2.9.2

操作系统版本和架构

Windows11 家庭版 23H2

描述问题

  1. vs 2022,已经安装 address sanitizer
  2. xmake f -k static --policies=build.sanitizer.address -p windows -a x64 --vs=2022 --vw_toolset=14.0
  3. xmake b
  4. 报错,ASan 没生效 warning: add_cflags("-fsanitize=address") is ignored, please pass {force = true} or call set_policy("check.auto_ignore_flags", false) if you want to set it.

期待的结果

xmake 配合 vs2022 可以使用 ASan

工程配置

附加信息和错误日志

Issues-translate-bot commented 3 months ago

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


Title: Cannot enable ASan on windows vs2022

star-hengxing commented 3 months ago

xmake f -k static --policies=build.sanitizer.address -p windows -a x64 --vs=2022 --vw_toolset=14.0

这个 toolset 版本支持?我记得是从 v142 工具链开始

waruqi commented 3 months ago

vw_toolset 参数也不对。。没这个名字。只有 vs_toolset

另外,提供下 -vD logs

Issues-translate-bot commented 3 months ago

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


The vw_toolset parameter is also incorrect. . There is no such name. only vs_toolset

In addition, provide -vD logs

myzhan commented 3 months ago

vw_toolset 参数也不对。。没这个名字。只有 vs_toolset

另外,提供下 -vD logs

sorry,我手打笔误。按照 @star-hengxing 的指引,我把 toolset 改成 14.2。能识别这个参数了,但是编译报错。

修改完 toolset 后的命令

xmake f -p windows -a x64 -k static -y --vs=2019 --vs_toolset=14.2 --policies=build.sanitizer.address -vD

依赖 lua,所以 xmake f 的时候会先编译 lua,编译报错。

日志如下 log.txt

Issues-translate-bot commented 3 months ago

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


The vw_toolset parameter is also incorrect. . There is no such name. only vs_toolset

In addition, provide -vD logs

Sorry, I made a typo. Following @star-hengxing's guidance, I changed the toolset to 14.2. This parameter can be recognized, but the compilation error is reported.

Command after modifying toolset

xmake f -p windows -a x64 -k static -y --vs=2019 --vs_toolset=14.2 --policies=build.sanitizer.address -vD

It depends on lua, so when xmake f is used, lua will be compiled first, and an error will be reported during compilation.

The log is as follows log.txt

myzhan commented 3 months ago

继续升级 vs toolset,能编译成功了。

xmake f -p windows -a x64 -k static -y --vs=2022 --vs_toolset=14.4 --policies=build.sanitizer.address -vD

运行的时候报错,看起来跟 xmake 没关系,我继续查 ASan 的兼容性列表。

==4304==AddressSanitizer: detect_leaks is not supported on this platform