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

Make binaries not stripped #221

Merged

Conversation

juanluisvaladas
Copy link
Contributor

By explicitly defining ldflags we remove the -s flag making the binary
produced by the compiler not stripped.

By explicitly defining ldflags we remove the -s flag making the binary
produced by the compiler not stripped.
@juanluisvaladas
Copy link
Contributor Author

$ make
go build -mod=vendor -trimpath -ldflags "-w -X github.com/openshift/sdn/pkg/version.versionFromGit="v0.0.0-alpha.0-246-g76e9d81" -X github.com/openshift/sdn/pkg/version.commitFromGit="76e9d8125" -X github.com/openshift/sdn/pkg/version.gitTreeState="clean" -X github.com/openshift/sdn/pkg/version.buildDate="2020-11-13T16:02:24Z" " github.com/openshift/sdn/cmd/network-controller
go build -mod=vendor -trimpath -ldflags "-w -X github.com/openshift/sdn/pkg/version.versionFromGit="v0.0.0-alpha.0-246-g76e9d81" -X github.com/openshift/sdn/pkg/version.commitFromGit="76e9d8125" -X github.com/openshift/sdn/pkg/version.gitTreeState="clean" -X github.com/openshift/sdn/pkg/version.buildDate="2020-11-13T16:02:24Z" " github.com/openshift/sdn/cmd/openshift-sdn
go build -mod=vendor -trimpath -ldflags "-w -X github.com/openshift/sdn/pkg/version.versionFromGit="v0.0.0-alpha.0-246-g76e9d81" -X github.com/openshift/sdn/pkg/version.commitFromGit="76e9d8125" -X github.com/openshift/sdn/pkg/version.gitTreeState="clean" -X github.com/openshift/sdn/pkg/version.buildDate="2020-11-13T16:02:24Z" " github.com/openshift/sdn/cmd/sdn-cni-plugin
go build -mod=vendor -trimpath -ldflags "-w -X github.com/openshift/sdn/pkg/version.versionFromGit="v0.0.0-alpha.0-246-g76e9d81" -X github.com/openshift/sdn/pkg/version.commitFromGit="76e9d8125" -X github.com/openshift/sdn/pkg/version.gitTreeState="clean" -X github.com/openshift/sdn/pkg/version.buildDate="2020-11-13T16:02:24Z" " github.com/containernetworking/plugins/plugins/ipam/host-local
go build -mod=vendor -trimpath -ldflags "-w -X github.com/openshift/sdn/pkg/version.versionFromGit="v0.0.0-alpha.0-246-g76e9d81" -X github.com/openshift/sdn/pkg/version.commitFromGit="76e9d8125" -X github.com/openshift/sdn/pkg/version.gitTreeState="clean" -X github.com/openshift/sdn/pkg/version.buildDate="2020-11-13T16:02:24Z" " k8s.io/kubernetes/cmd/kube-proxy
[jdesousa@systemv /home/jdesousa/go/src/github.com/openshift/sdn] (build-not-stripped)
$ file openshift-sdn 
openshift-sdn: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=03d1ef18e5dd6676db6b108a00658e877bf19fb3, for GNU/Linux 3.2.0, not stripped
[jdesousa@systemv /home/jdesousa/go/src/github.com/openshift/sdn] (build-not-stripped)
$ git checkout -
Switched to branch 'master'
Your branch is up to date with 'origin/master'.

[jdesousa@systemv /home/jdesousa/go/src/github.com/openshift/sdn] (master)
$ make
go build -mod=vendor -trimpath -ldflags "-s -w -X github.com/openshift/sdn/pkg/version.versionFromGit="v0.0.0-alpha.0-245-gf665e21" -X github.com/openshift/sdn/pkg/version.commitFromGit="f665e2195" -X github.com/openshift/sdn/pkg/version.gitTreeState="clean" -X github.com/openshift/sdn/pkg/version.buildDate="2020-11-13T16:03:10Z" " github.com/openshift/sdn/cmd/network-controller
go build -mod=vendor -trimpath -ldflags "-s -w -X github.com/openshift/sdn/pkg/version.versionFromGit="v0.0.0-alpha.0-245-gf665e21" -X github.com/openshift/sdn/pkg/version.commitFromGit="f665e2195" -X github.com/openshift/sdn/pkg/version.gitTreeState="clean" -X github.com/openshift/sdn/pkg/version.buildDate="2020-11-13T16:03:10Z" " github.com/openshift/sdn/cmd/openshift-sdn
go build -mod=vendor -trimpath -ldflags "-s -w -X github.com/openshift/sdn/pkg/version.versionFromGit="v0.0.0-alpha.0-245-gf665e21" -X github.com/openshift/sdn/pkg/version.commitFromGit="f665e2195" -X github.com/openshift/sdn/pkg/version.gitTreeState="clean" -X github.com/openshift/sdn/pkg/version.buildDate="2020-11-13T16:03:10Z" " github.com/openshift/sdn/cmd/sdn-cni-plugin
go build -mod=vendor -trimpath -ldflags "-s -w -X github.com/openshift/sdn/pkg/version.versionFromGit="v0.0.0-alpha.0-245-gf665e21" -X github.com/openshift/sdn/pkg/version.commitFromGit="f665e2195" -X github.com/openshift/sdn/pkg/version.gitTreeState="clean" -X github.com/openshift/sdn/pkg/version.buildDate="2020-11-13T16:03:10Z" " github.com/containernetworking/plugins/plugins/ipam/host-local
go build -mod=vendor -trimpath -ldflags "-s -w -X github.com/openshift/sdn/pkg/version.versionFromGit="v0.0.0-alpha.0-245-gf665e21" -X github.com/openshift/sdn/pkg/version.commitFromGit="f665e2195" -X github.com/openshift/sdn/pkg/version.gitTreeState="clean" -X github.com/openshift/sdn/pkg/version.buildDate="2020-11-13T16:03:10Z" " k8s.io/kubernetes/cmd/kube-proxy
[jdesousa@systemv /home/jdesousa/go/src/github.com/openshift/sdn] (master)
$ file openshift-sdn 
openshift-sdn: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=49de3e090bfc7c8e6ccc90e8dfbbeb97221e5525, for GNU/Linux 3.2.0, stripped

@juanluisvaladas
Copy link
Contributor Author

/retest

@squeed
Copy link
Contributor

squeed commented Nov 16, 2020

Do we just want to do this for all go binaries? Should we get this up in library-go?

@juanluisvaladas
Copy link
Contributor Author

I don't think that's something everyone wants to do, the build-machinery-go sets the -s explicitly and, I assume, deliberately:
https://github.com/openshift/build-machinery-go/blob/cd7e6e844b551f45007dd5a3200c140f6b5f6215/make/lib/golang.mk#L63

@squeed
Copy link
Contributor

squeed commented Nov 18, 2020

huh, fair enough.

@squeed
Copy link
Contributor

squeed commented Nov 18, 2020

/approve
/lgtm

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: juanluisvaladas, squeed

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

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 18, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

6 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 060eaa2 into openshift:master Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants