-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
mode.release win下 不产生pdb文件 #907
Comments
mode.release 规则不会生成任何符号文件,如果要生成,请用 mode.releasedbg add_rules("mode.releasedbg")
target("test")
... xmake f -m releasedbg
xmake 或者自己通过 if is_mode("release") then
set_symbols("debug")
end |
xmake f -m releasedbg if is_mode("release") then |
需要实现的vs一样的效果 即是release优化 并能产生pdb文件 |
仔细看前面说明,要先配置
不会,你那里看出来跟debug完全一样了? |
配置了 add_rules("mode.releasedbg") 还是不产生pdb 没有ida看 release下汇编 只是看了文件大小 完全一样 |
xmake f -m releasedbg
checking for the architecture ... x64
checking for the Microsoft Visual Studio (x64) version ... 2019
Y:\test>xmake -rv
checking for the link.exe ... C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29109\bin\HostX64\x64\link.exe
checking for the linker (ld) ... link.exe
checking for the c++ compiler (cxx) ... cl.exe
checking for the C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29109\bin\HostX64\x64\cl.exe ... ok
checking for the flags (-Zi -FS -Fd) ... ok
checking for the flags (-Ox -fp:fast) ... ok
checking for the ccache ... no
[ 50%]: compiling.releasedbg src\main.cpp
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\VC\\Tools\\MSVC\\14.27.29109\\bin\\HostX64\\x64\\cl.exe" -c -FS -Zi -Fdbuild\windows\x64\releasedbg\compile.test.pdb -Ox -fp:fast -nologo -Fobuild\.objs\test\windows\x64\releasedbg\src\main.cpp.obj src\main.cpp
checking for the flags (/sourceDependencies C:\Users\ruki\AppData\Local\Temp\.xmake\200730\_ADB0D9F01E9C4C3080631FFAA3FA4A40.json) ... ok
[ 75%]: linking.releasedbg test.exe
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\VC\\Tools\\MSVC\\14.27.29109\\bin\\HostX64\\x64\\link.exe" -debug -pdb:build\windows\x64\releasedbg\test.pdb -nologo -dynamicbase -nxcompat -machine:x64 -out:build\windows\x64\releasedbg\test.exe build\.objs\test\windows\x64\releasedbg\src\main.cpp.obj
[100%]: build ok!
|
奇怪了 D:\temp\t>xmake build -r -v |
刚还把 配置目录 .xmake 删除 再次重新配置 还是releasedbg 不产生pdb |
-- add modes: debug and release |
$ xmake f -m releasedbg -cvD
$ xmake -rvD 执行下上面的命令,给我个完整的output看下, 另外xmake.lua上面的完整么 |
D:\temp\t>xmake f -m releasedbg -c -v -D D:\temp\t>xmake -r -v -D |
xmake.lua 也完整发我下呢 |
工程使用 xmake create t 创建的默认例子 |
不对,你确定用的是最新版本xmake? 执行下 xmake --version看看呢? 从2.3.6开始,vs编译器我会用全路径,不可能还是只有cl.exe。。。 你是不是装了两个xmake,一个在 program files 一个在 program files (x86),然后用的还是老的版本? |
果然 之前装过一个老版本 后面安装新版本 以为会覆盖 |
理论上是会覆盖,具体为啥没覆盖 我回头查下安装脚本,可能是最近迁移到github action ci上做的安装包,里面判断x86/x64失效了,所以64的包也装到 program files (x86)目录 |
新版本可以了 release下 也是产生pdb的 但名字是 compile.t.pdb 应用名t.exe 应该t.pdb 更合适 |
这个是编译obj的中间pdb文件,不用管它,实际最终还有个 t.pdb的。link之后。 |
releasedbg 产生的exe 还是没有优化 看了下文件和debug exe一样大 |
你不能光看大小,你对比下 xmake -v的完整编译flags么。。都是-Ox优化,releasedbg下唯一的区别就是:
其他两者的编译和link的flags完全一摸一样了。。而影响可执行程序大小的就是这个 /debug 选项。。这仅仅只是注入调试信息。。程序本身运行还是优化过的。。不能说大小不同 变大了 就是没优化的。。 你可以 看下/debug的文档 https://docs.microsoft.com/en-us/cpp/build/reference/debug-generate-debug-info?view=vs-2019 这个flags并不影响优化,如果你去掉,确实会小,跟release的大小一致,但是可执行程序跟pdb没有关联了,我估计调试器也不会自动认你生成的pdb了,那你生成的pdb调试器不认,又有啥用呢?
|
这个对比了vs hello的例子 debug大小 35kb release大小 8kb |
我刚上面不是说的很明白了么,就多了个 |
您没有明白我的意思 其实希望xmake做到和vs一致的效果 这样才比较方便 |
release产生pdb 而不是releasedbg |
首先,是否release产生pdb是用户的事情,xmake默认不处理编译模式,不管是release还是releasedbg对xmake而言,都是无所谓的。按理都是用户自己判断和设置,例如: if is_mode("release") then
set_optimize("fast")
set_symbols("debug")
end 如果不设置,默认最简单的工程,用户不管切那个mode,都是一样的效果,xmake不会自动追加什么设置 target("test")
set_kind("binary")
add_files("src/.c") 至于, 也可以自己定义自己的编译模式,比如 所以,对于内置的, 如果内置的编译模式规则,满足不了用户需求,那就是用户需要自己配置的事情,不会因为某个用户说不方便,就改了,到时候另外一个用户说这样又不行,再去改回来。 |
所以你非要release有pdb,那就自己配置,也就三行代码: if is_mode("release") then
set_symbols("debug")
end 如果觉得这三行都懒得配置,觉得不方便,那我也没办法,毕竟每个用户的需求都不同,每个需求,都去改内置的rules,永远不可能满足所有用户,xmake的初衷,就是提供了足够的灵活,用户可以自己定制。 |
下面这样 可以接受 |
也就是需要 set_symbols("debug") 能在连接阶段 不使用/debug |
不用/debug,link完连pdb都不会生成,vs也都是带了的。。 你这里的问题,压根就不是 pdb的问题,跟生成pdb 跟/debug都没任何关系 , 是如何最小化编译的问题。。 你跟vs的命令对下么。。它link时候额外加了
只不过是带了 至于mode.xxx 的内置模式 我后期也会考虑改进下,但要过段时间了,你先自己根据自己的需求,缺啥flags,自己对着vs加呗,这跟xmake也没关系。。。自己缺啥flags就自己加啥flags |
对的 就是这个问题 |
那你就自己加下么,内置的 mode.release规则 是 fast优先 ,不是 size 优先,只有 mode.minsizerel 模式才是 minsize + release |
这个我dev分支改进了下,只要带有 所以默认的release/minsizerel/releasedbg都会生效。。你可以直接采用下面的配置就行了 if is_mode("release") then
set_symbols("debug")
end 或者直接使用mode.releasedbg规则都可以。。请更新到dev分支尝试:xmake update -s dev |
这个先这样吧,回头有问题再开新issues |
测试了当前最新版本的xmake
xmake create test
xmake build test
release模式下 只产生了test.exe 应该产生对应的pdb文件
The text was updated successfully, but these errors were encountered: