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

Makefile: add a DBG variable #108371

Merged
merged 2 commits into from
Mar 3, 2022
Merged

Conversation

thockin
Copy link
Member

@thockin thockin commented Feb 26, 2022

Now make DBG=1 will produce binaries with no optimizaions and no inlining, but with symbols and DWARF information.

This also sets the various compile flags to use "all=" syntax. Otherwise things like trimpath only apply to the CLI-listed packages and nothing else (which seems egregiously wrong).

Worth noting: this builds tools (like codegens) with debugging too. We could make it more sophisticated if that seems a problem (e.g. a different flag or value)

To discuss: "DBG" vs "KUBE_DBG" vs make debug vs ...

/kind cleanup

NONE

@thockin thockin added the sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. label Feb 26, 2022
@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. labels Feb 26, 2022
@k8s-ci-robot
Copy link
Contributor

@thockin: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Feb 26, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: thockin

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 26, 2022
@thockin
Copy link
Member Author

thockin commented Feb 26, 2022

/retest

@liggitt
Copy link
Member

liggitt commented Feb 26, 2022

Something went sideways with the build flags used to stamp in version info:

could not parse pre-release/metadata (-master+$Format:%H$) in version "v0.0.0-master+$Format:%H$"
[422](https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/108371/pull-kubernetes-e2e-kind/1497697707278471168#1:build-log.txt%3A422)

@k8s-triage-robot
Copy link

Unknown CLA label state. Rechecking for CLA labels.

Send feedback to sig-contributor-experience at kubernetes/community.

/check-cla
/easycla

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 27, 2022
@thockin
Copy link
Member Author

thockin commented Feb 27, 2022

/retest

@liggitt
Copy link
Member

liggitt commented Feb 27, 2022

the error looks like a legitimate issue with the build flags

@thockin thockin changed the title Makefile: add a DBG variable WIP: Makefile: add a DBG variable Feb 27, 2022
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 27, 2022
@thockin thockin force-pushed the makefile-dbg-flag branch 2 times, most recently from 33c6020 to 50bd113 Compare February 27, 2022 18:26
@thockin
Copy link
Member Author

thockin commented Feb 27, 2022

/retest

@thockin
Copy link
Member Author

thockin commented Feb 27, 2022

Flags errors seem to be fixed. I had mis-understood the go docs before. Better now.

@thockin thockin changed the title WIP: Makefile: add a DBG variable Makefile: add a DBG variable Feb 27, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 27, 2022
@thockin
Copy link
Member Author

thockin commented Mar 1, 2022

rebased

Now `make DBG=1` will produce binaries with no optimizaions and no
inlining, but with symbols and DWARF information.
This has somewhat subtle implications.  For a concrete example, this
changes the `-trimpath` behavior from only affecting the named pkg to
affecting all pkgs, which broke ginkgo, which seems to try to strip its
own `pwd` prefix.  But since that runs in run-in-gopath, and not in
KUBE_ROOT, it fails to strip anything.

e.g.

before this, strings in the binary would be like
    /home/user/kube/_output/local/go/src/k8s.io/kubernetes/vendor/github.com/onsi/ginkgo/...
Ginkgo would find its own root as
    /home/user/kube/_output/local/go/src/k8s.io/kubernetes/
so it would produce
    vendor/github.com/onsi/ginkgo/...
in logs.

after this, strings in the binary strip the KUBE_ROOT and be like:
    _output/local/go/src/k8s.io/kubernetes/vendor/github.com/onsi/ginkgo/...
Ginkgo would find its own root as
    /home/user/kube/_output/local/go/src/k8s.io/kubernetes/
so it would not strip anything, and produce
    _output/local/go/src/k8s.io/kubernetes/vendor/github.com/onsi/ginkgo/...
in logs.
@thockin
Copy link
Member Author

thockin commented Mar 1, 2022

I broke the "all=" change to a distinct commit

@thockin
Copy link
Member Author

thockin commented Mar 1, 2022

/retest

@dims
Copy link
Member

dims commented Mar 3, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 3, 2022
@k8s-ci-robot k8s-ci-robot merged commit 4dda765 into kubernetes:master Mar 3, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.24 milestone Mar 3, 2022
chendave added a commit to chendave/kubernetes that referenced this pull request Mar 9, 2022
With the merging of kubernetes#108371, the old way to build the debug binaries
won't work anymore.

Signed-off-by: Dave Chen <dave.chen@arm.com>
@thockin thockin deleted the makefile-dbg-flag branch July 6, 2022 20:50
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants