Skip to content

CMAKE Release build defaults to -O3 but RelWithDebInfo build defaults to -O2 #507

@illwieckz

Description

@illwieckz

It looks like CMAKE Release build defaults to -O3 but RelWithDebInfo build defaults to -O2:

CMakeCache.txt
79:CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
103:CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
CMakeCache.txt
76:CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
100:CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG

When I'm working on Unvanquished/Daemon, I either do a Debug build to run on a debugger, or do a Release build to test for performance, meaning I never test the optimization level of our release builds,. On the other hand, that means I'm testing O3 since years without faciing specific issues.

There are maybe strong reason to use O2 when producing debug symbols, but on the other hand, maybe we would want to default to O3 in our released builds?

Note: doing O3 release builds may make Debian unhappy: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=640214

But I don't care that much as we're not integrated in their repo, and they are free to optimize less if they want to.

My main concern would be: how much O3 is problematic for debugging RelWithDebInfo builds?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions