Skip to content
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

build(c): set -g3 in debug/relwithdebuginfo builds #1609

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

lidavidm
Copy link
Member

@lidavidm lidavidm commented Mar 12, 2024

Fixes #1608.

@lidavidm
Copy link
Member Author

Packaging builds being fixed by #1612

@lidavidm lidavidm marked this pull request as ready for review March 12, 2024 17:46
Comment on lines 98 to 99
string(APPEND C_RELWITHDEBINFO_FLAGS " -Og -ggdb")
string(APPEND CXX_RELWITHDEBINFO_FLAGS " -Og -ggdb")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about removing -Og here because RelWithDebInfo is one of optimization builds?

Comment on lines 96 to 99
string(APPEND C_DEBUG_FLAGS " -Og -ggdb")
string(APPEND CXX_DEBUG_FLAGS " -Og -ggdb")
string(APPEND C_RELWITHDEBINFO_FLAGS " -Og -ggdb")
string(APPEND CXX_RELWITHDEBINFO_FLAGS " -Og -ggdb")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using -g3 instead of -ggdb?
-g3 provides more debug information than -ggdb.
For example, we can use expand macro in gdb with -g3.


if("${_lower_build_type}" STREQUAL "debug" AND "${CMAKE_CXX_FLAGS}" MATCHES "-O2")
# Activate scripts for Conda compilers set CXXFLAGS etc. with -O2.
message(WARNING "This is a debug build, but your CXXFLAGS have -O2. This is common in Conda environments.\nReset your CFLAGS, CPPFLAGS, and CXXFLAGS to -Og for debugging."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: Users can use -DCMAKE_C_FLAGS_DEBUG=-Og -DCMAKE_CXX_FLAGS_DEBUG=-Og instead of resetting CFLAGS/CXXFLAGS.

Here are my related tries on apache/arrow:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give this a shot, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use multiple -O options, with or without level numbers, the last such option is the one that is effective.

Ah, I think this is what I was not understanding earlier.

@lidavidm lidavidm changed the title build(c): set -Og -ggdb and warn about Conda setting -O2 build(c): set -Og -g3 and warn about Conda setting -O2 Mar 12, 2024
@lidavidm lidavidm force-pushed the gh-1608 branch 2 times, most recently from 8b08a1c to 4c2e832 Compare March 12, 2024 21:34
@lidavidm lidavidm changed the title build(c): set -Og -g3 and warn about Conda setting -O2 build(c): set -g3 in debug/relwithdebuginfo builds Mar 13, 2024
@lidavidm lidavidm merged commit 9f991ad into apache:main Mar 13, 2024
55 of 56 checks passed
@lidavidm lidavidm deleted the gh-1608 branch March 13, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

c: set -Og -ggdb3 in debug builds
2 participants