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

Add RelWithDebInfo target. #3440

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shane-lawrence
Copy link
Contributor

@shane-lawrence shane-lawrence commented Dec 23, 2024

Signed-off-by: Shane Lawrence shane@lawrence.dev

What type of PR is this?
/kind feature

Any specific area of the project related to this PR?
/area build

What this PR does / why we need it:
Debug binaries can behave differently from release binaries, which can make it hard to reproduce Release bugs in a Debug environment for certain edge cases. However, the release target doesn't produce debug symbols so it is difficult to trace certain kinds of bugs.

This PR adds the cmake-standard RelWithDebInfo target so we can create a binary that behaves exactly the same as the release target but has debug symbols available in a separate file.

Which issue(s) this PR fixes:
Fixes #2268.

Special notes for your reviewer:
This PR requires additional testing to ensure that the binary really is the same as the release binary. This first attempt might also need additional changes to conform to the existing style and good coding practices for this project.

Does this PR introduce a user-facing change?:
NO

NONE

…ug symbols file.

Signed-off-by: Shane Lawrence <shane@lawrence.dev>
@poiana
Copy link
Contributor

poiana commented Dec 23, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: shane-lawrence
Once this PR has been reviewed and has the lgtm label, please assign lucaguerra for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@shane-lawrence
Copy link
Contributor Author

I've only tried to remove debug symbols from the original binary, but I'm seeing a substantial change in file size compared to the release binary. Building with bundled deps and no specified CMAKE_BUILD_TYPE (defaults to Release), I get a userspace/falco/falco binary that's 398MB. Building with CMAKE_BUILD_TYPE=RelWithDebInfo, I get a userspace/falco/falco.debug file that's 222MB and a userspace/falco/falco binary that's 90% smaller at only 26MB. The binary seems to work the same though.

Signed-off-by: Shane Lawrence <shane@lawrence.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

RelWithDebInfo build
2 participants