-
-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
开启asan时,包会自动使用debug版本 #6139
Comments
Title: When asan is enabled, the package fmt will automatically use the debug version |
是否 debug 只跟 没有根据 asan 去设置 debug 的逻辑,除非 cmake 自己切了。你可以调下 包 |
Whether debugging is only related to the There is no logic to set debug based on asan, unless cmake cuts it by itself. You can adjust the package |
并不只是fmt的问题,貌似是开启asan会设置debug=true,对项目和packages都生效了,但是tsan只对项目生效了,对packages不生效 |
It's not just a problem with fmt. It seems that if you enable asan, you will set debug=true, which will take effect on both the project and packages, but tsan only takes effect on the project and does not take effect on packages. |
那跟 debug 是两个问题,目前包仅仅支持 asan 不支持 tsan |
That is two different problems with debug. Currently, the package only supports asan but not tsan. |
目前实现 xmake/xmake/core/package/package.lua Lines 698 to 701 in 774980f
|
Currently implemented xmake/xmake/core/package/package.lua Lines 698 to 701 in 774980f
|
哦,目前 asan 是默认 debug 的,因为要看栈,否则跑出来也看不到栈。除非单独加 |
Oh, currently asan is the default debug because you have to look at the stack, otherwise you won’t be able to see the stack even if you run out. Unless |
谢谢,我已经了解这个现象出现的原因。 |
Thank you, I already understand the reason for this phenomenon.
|
1 similar comment
Thank you, I already understand the reason for this phenomenon.
|
这只是能取栈把,没加 |
This is just a stack handle, without adding |
是的,需要加-g来定位具体代码行号,请问下tsan msan ubsan也都是按照debug方式编译的,但是引入的包还是用的release版本,后续会增加对包的支持吗 |
Yes, you need to add -g to locate the specific code line number. Can you ask if tsan msan ubsan is also compiled according to debug mode, but the packages introduced still use the release version. Will the package support be added in the future? |
这几个不太常用,目前不考虑,后面看情况。 可以自己直接传 cxflags ldflags 给 add_requires 来开启 |
These are not commonly used, so I won’t consider it at the moment, and it depends on the situation later. You can directly pass cxflags ldflags to add_requires to start |
Xmake 版本
2.9.6
操作系统版本和架构
Linux debian 6.1.0-28-amd64
描述问题
set_policy("build.sanitizer.address", true)
add_requires("fmt =10.2.1", { system = false, debug=false, configs = { shared = true}})
add_requires("zeromq =4.3.4", { system = false, configs = { shared = true}})
target ("test")
add_packages("fmt")
add_packages("zeromq")
set_kind("binary")
add_files("test.cpp")
xmake f -m asan
xmake -av
添加的so为debug版本
换成tsan的方式set_policy("build.sanitizer.thread", true)使用的则是release版本的so
工程配置
xmake.lua
set_policy("build.sanitizer.address", true)
add_requires("fmt =10.2.1", { system = false, debug=false, configs = { shared = true}})
add_requires("zeromq =4.3.4", { system = false, configs = { shared = true}})
target ("test")
test.cpp
#include <fmt/format.h>
#include
#include <assert.h>
static void test() {
std::string s = fmt::format("{}", "hello");
assert(s == "hello");
}
int main()
{
test();
return 0;
}
附加信息和错误日志
/usr/bin/g++ -o bin/test build/.objs/test/linux/x86_64/asan/test.cpp.o -m64 -L/home/qwqe/.xmake/packages/f/fmt/10.2.1/3b4266b216a9438eb7a3de6ef0d67a72/lib -L/home/qwqe/.xmake/packages/z/zeromq/4.3.4/653b8975302f43ab9b0e57200b529ebb/lib -lfmtd -lzmq -lpthread -fsanitize=address
The text was updated successfully, but these errors were encountered: