alliedmodders / ambuild

AlliedModders C++ Build System
BSD 3-Clause "New" or "Revised" License
61 stars 32 forks source link

-g3 switch clang #61

Open Amaroq7 opened 6 years ago

Amaroq7 commented 6 years ago

Every time I build SourcePawn using Clang I get -g3 switch specified. Doesn't matter if I pass --enable-optimize or not.

Passing --enable-debug causes that -g3 is specified twice because of https://github.com/alliedmodders/sourcepawn/blob/d653700024004082b2787b2d95e66eba7d2f598e/AMBuildScript#L77.

From what I found this behavior was added to ambuild back in 2013. https://github.com/alliedmodders/ambuild/commit/2f9a0bee9b2b50f08a57e0eed8ab795b0ec0bc7a https://bugs.alliedmods.net/show_bug.cgi?id=5997#c15

But then removed for GCC in 2015. https://github.com/alliedmodders/ambuild/commit/1864bb90bca2c6ba6dfba00b333ba2c1ab1dab4a#diff-1427703f7513811334a37d948e0648bcL101 https://github.com/alliedmodders/ambuild/commit/1864bb90bca2c6ba6dfba00b333ba2c1ab1dab4a#diff-a119ca3177c6ded3d2f16a88cbe924d1R68

What is the reason of specifying -g3 switch by default? Is there any way to disable that without manually tweaking ambuild sources?

dvander commented 4 years ago

Sorry for seeing this so very late. By default AMBuild adds full symbolic debug information to binaries. There is no way to toggle this off. Obviously that's bad for packaging purposes, so it does have a toggle to strip debug information into a separate file. So, users get stripped binaries, but the symbols are retained for Breakpad and the symbol server.

If you want a toggle to entirely stop symbolic information, I think that'd be an easy feature to add, but I'm curious what the use case is given that stripping is supported.

nosoop commented 3 years ago

I stumbled on this issue as well — AMBuild does not pass -g3 to GCC; the flag only applies to Clang. I'd be fine with either option as long as they are consistent across the two.

dvander commented 3 years ago

AMBuild treats the compilers almost identically, so that is surprising. What version?

nosoop commented 3 years ago

I'm able to reproduce this on the latest metamod-source with the following configuration command:

python ../configure.py -s tf2 --hl2sdk-root '/path/to/hl2sdkroot'

The compilers are GCC 8.3 / Clang 7.0 (Debian Buster), and the AMBuild package installed is 6ad11a19bff17c8010778a634c9f0ff242603164 (latest at time of writing).

Attached are the results of ambuild --show-steps for each: build-steps-clang.txt / build-steps-gcc.txt

This also affects AMBuild API version 2.1, which is what my fork of rcbot2 uses (linked to an older commit; newer ones strip the symbols out at link time use the --symbol-files option as intended).