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: Use ldflags in win-{gvproxy,sshproxy} targets #279

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

cfergeau
Copy link
Collaborator

The windowsgui binary is currently 50% bigger than its non-windowsgui
counterpart. This size difference is gone when win-gvproxy is built with
'-s -w' as the other binaries.

@cfergeau
Copy link
Collaborator Author

cfergeau commented Oct 9, 2023

@n1hility can you take a look?

@n1hility
Copy link
Member

@cfergeau I can see stripping DWARF, but with trying to get more analysis out of crashes/hangs, I wonder if we should not strip symbols? crash dumps and debug backtraces (native stacks) are near impossible to gather without these.

@cfergeau
Copy link
Collaborator Author

@cfergeau I can see stripping DWARF, but with trying to get more analysis out of crashes/hangs, I wonder if we should not strip symbols? crash dumps and debug backtraces (native stacks) are near impossible to gather without these.

I could have described this PR as "use same build/linker flags for all binaries", which would make the discussion about stripping the binaries slightly orthogonal to the PR :)

To be honest, so far, with go programs, I did not have many (any?) bugs where the only information to fix it was a backtrace, so between debug symbols and a 30% to 50% increase in binary size, the choice is easily made. But maybe you had a different experience with that?
What we could do is strip binaries by default, but add a 'debug' tarball to the release artifacts, so that people can switch to the debug binaries if needed? This would be a similar approach to that of linux distros which ship debug infos in separate packages?

The windowsgui binary is currently 50% bigger than its non-windowsgui
counterpart. This size difference is gone when win-gvproxy is built with
'-s -w' as the other binaries.

Signed-off-by: Christophe Fergeau <[email protected]>
@praveenkumar
Copy link
Contributor

@cfergeau I can see stripping DWARF, but with trying to get more analysis out of crashes/hangs, I wonder if we should not strip symbols? crash dumps and debug backtraces (native stacks) are near impossible to gather without these.

What we could do is strip binaries by default, but add a 'debug' tarball to the release artifacts, so that people can switch to the debug binaries if needed? This would be a similar approach to that of linux distros which ship debug infos in separate packages?

I think that is better approach if we really want to ship debug info as part of binary. By default better to have same linker flag for each target.


# gvproxy for windows is compiled as a windows GUI to support backgrounding
.PHONY: win-gvproxy
win-gvproxy:
GOOS=windows go build -ldflags -H=windowsgui -o bin/gvproxy.exe ./cmd/gvproxy
GOOS=windows go build -ldflags "$(LDFLAGS) -H=windowsgui" -o bin/gvproxy.exe ./cmd/gvproxy
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏼

Copy link
Contributor

openshift-ci bot commented Dec 20, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfergeau, praveenkumar

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

The pull request process is described 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

@praveenkumar praveenkumar merged commit 3a47ad7 into containers:main Dec 20, 2023
16 of 18 checks passed
@cfergeau cfergeau deleted the ldflags branch December 20, 2023 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants