xmake-io / xmake

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

set_symbols("debug", "hidden")对于GCC在mode.releasedbg下不能生成.sym #5859

Closed wagcheg closed 3 days ago

wagcheg commented 1 week ago

Xmake 版本

v2.9.6+20241030

操作系统版本和架构

Linux 6.11.5-arch1-1

描述问题

使用set_symbols("debug", "hidden")时releasedbg模式下不能生成.sym

期待的结果

releasedbg模式下能生成.sym

工程配置

symbol.zip

附加信息和错误日志

$ xmake -vr checking for gcc ... /usr/bin/gcc checking for zig ... no checking for zig ... no checking for nim ... no checking for nim ... no checking for gcc ... /usr/bin/gcc checking for the c++ compiler (cxx) ... gcc checking for /usr/bin/gcc ... ok checking for flags (-fPIC) ... ok checking for flags (-fvisibility-inlines-hidden) ... ok checking for flags (-O3) ... ok checking for flags (-DNDEBUG) ... ok [ 50%]: cache compiling.releasedbg main.cpp /usr/bin/gcc -c -m64 -g -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -o build/.objs/main/linux/x86_64/releasedbg/main.cpp.o main.cpp checking for flags (-MMD -MF) ... ok checking for flags (-fdiagnostics-color=always) ... ok checking for g++ ... /usr/bin/g++ checking for the linker (ld) ... g++ checking for /usr/bin/g++ ... ok checking for flags (-fPIC) ... ok [ 75%]: linking.releasedbg main /usr/bin/g++ -o build/linux/x86_64/releasedbg/main build/.objs/main/linux/x86_64/releasedbg/main.cpp.o -m64 -s [100%]: build ok, spent 1.202s

Issues-translate-bot commented 1 week ago

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


Title: set_symbols("debug", "hidden") cannot generate .sym for GCC under mode.releasedbg

waruqi commented 1 week ago

使用set_symbols("debug", "hidden")时releasedbg模式下不能生成.sym

你要么设置 debug 要么设置 hidden ,这两是互斥的,另外 releasedbg mode 内置了对 debug symbols 设置,所以才能生成 .sym ,你又去改成 hidden ,干掉了,等于改写了 releasedbg 内部的配置,那这个 releasedbg 也就不是 releasedbg 了,仅仅只是 mode name 还是它而已。

Issues-translate-bot commented 1 week ago

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


When using set_symbols("debug", "hidden"), .sym cannot be generated in releasedbg mode

You either set debug or hidden, which are mutually exclusive. In addition, releasedbg mode has built-in settings for debug symbols, so .sym can be generated. If you change it to hidden, it is equivalent to rewriting the internal configuration of releasedbg. Then This releasedbg is no longer releasedbg, it is just the mode name.

wagcheg commented 1 week ago

https://xmake.io/#/manual/project_target?id=set-symbol-info 这个用法是在manual找到的

像DLL一样生成隐藏符号的so并分离sym并不是一个无用的需求 尽管set_symbols("debug")+add_cxxflags("-fvisibility=hidden")+add_cxxflags("-fvisibility-inlines-hidden")也能实现 但是还是希望有一个良好的API

waruqi commented 6 days ago

再试试,xmake update -s dev

Issues-translate-bot commented 6 days ago

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


Try again, xmake update -s dev

wagcheg commented 3 days ago

正常了

Issues-translate-bot commented 3 days ago

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


It's normal