* [PATCH 1/2] kubernetes: building unstripped binaries
@ 2019-09-02 8:36 Hongxu Jia
2019-09-02 8:36 ` [PATCH 2/2] containerd-opencontainers: " Hongxu Jia
2019-09-02 9:10 ` [PATCH 1/2] kubernetes: " Hongxu Jia
0 siblings, 2 replies; 5+ messages in thread
From: Hongxu Jia @ 2019-09-02 8:36 UTC (permalink / raw)
To: bruce.ashfield, meta-virtualization
Specify GOLDFLAGS as an empty string for building unstripped binaries, which allows
you to use code debugging tools like delve. When GOLDFLAGS is unspecified, it defaults
to "-s -w" which strips debug information. Other flags that can be used for GOLDFLAGS
are documented at https://golang.org/cmd/link/ [1]
[1] https://github.com/kubernetes/kubernetes/blob/master/build/root/Makefile#L82
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
recipes-containers/kubernetes/kubernetes_git.bb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/recipes-containers/kubernetes/kubernetes_git.bb b/recipes-containers/kubernetes/kubernetes_git.bb
index b7862ec..821f51f 100644
--- a/recipes-containers/kubernetes/kubernetes_git.bb
+++ b/recipes-containers/kubernetes/kubernetes_git.bb
@@ -54,7 +54,7 @@ do_compile() {
export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
# to limit what is built, use 'WHAT', i.e. make WHAT=cmd/kubelet
- make cross KUBE_BUILD_PLATFORMS=${GOOS}/${GOARCH}
+ make cross KUBE_BUILD_PLATFORMS=${GOOS}/${GOARCH} GOLDFLAGS=""
}
do_install() {
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] containerd-opencontainers: building unstripped binaries
2019-09-02 8:36 [PATCH 1/2] kubernetes: building unstripped binaries Hongxu Jia
@ 2019-09-02 8:36 ` Hongxu Jia
2019-09-03 20:01 ` Bruce Ashfield
2019-09-02 9:10 ` [PATCH 1/2] kubernetes: " Hongxu Jia
1 sibling, 1 reply; 5+ messages in thread
From: Hongxu Jia @ 2019-09-02 8:36 UTC (permalink / raw)
To: bruce.ashfield, meta-virtualization
It defaults to "-s -w" [1] which strips debug information, refresh a backported
patch to build unstripped binaries
https://golang.org/cmd/link/
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
.../0001-Add-build-option-GODEBUG-1.patch | 42 ++++++++++++++++++++++
.../containerd/containerd-opencontainers_git.bb | 3 ++
2 files changed, 45 insertions(+)
create mode 100644 recipes-containers/containerd/containerd-opencontainers/0001-Add-build-option-GODEBUG-1.patch
diff --git a/recipes-containers/containerd/containerd-opencontainers/0001-Add-build-option-GODEBUG-1.patch b/recipes-containers/containerd/containerd-opencontainers/0001-Add-build-option-GODEBUG-1.patch
new file mode 100644
index 0000000..05c4f15
--- /dev/null
+++ b/recipes-containers/containerd/containerd-opencontainers/0001-Add-build-option-GODEBUG-1.patch
@@ -0,0 +1,42 @@
+From 84874e47aa2025b8e73df0286c44f3b8a1d9fdb2 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Mon, 2 Sep 2019 16:20:07 +0800
+Subject: [PATCH] Add build option "GODEBUG=1"
+
+Make will generate GDB friendly binary with this build option.
+
+Signed-off-by: Hui Zhu <teawater@hyper.sh>
+
+Upstream-Status: Backport [c5a0c7f491b435e4eb45972903b00e2d8ed46495]
+
+Partly backport and refresh to v1.2.7
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ src/import/Makefile | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/import/Makefile b/src/import/Makefile
+index 4355395..4fb5d3b 100644
+--- a/src/import/Makefile
++++ b/src/import/Makefile
+@@ -75,11 +75,15 @@ TEST_REQUIRES_ROOT_PACKAGES=$(filter \
+ COMMANDS=ctr containerd containerd-stress
+ MANPAGES=ctr.1 containerd.1 containerd-config.1 containerd-config.toml.5
+
++ifndef GODEBUG
++ EXTRA_LDFLAGS += -s -w
++endif
++
+ # Build tags seccomp and apparmor are needed by CRI plugin.
+ BUILDTAGS ?= seccomp apparmor
+ GO_TAGS=$(if $(BUILDTAGS),-tags "$(BUILDTAGS)",)
+-GO_LDFLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)'
+-SHIM_GO_LDFLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -extldflags "-static"'
++GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)'
++SHIM_GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -extldflags "-static" $(EXTRA_LDFLAGS)'
+
+ #Replaces ":" (*nix), ";" (windows) with newline for easy parsing
+ GOPATHS=$(shell echo ${GOPATH} | tr ":" "\n" | tr ";" "\n")
+--
+2.7.4
+
diff --git a/recipes-containers/containerd/containerd-opencontainers_git.bb b/recipes-containers/containerd/containerd-opencontainers_git.bb
index 424de74..347eae5 100644
--- a/recipes-containers/containerd/containerd-opencontainers_git.bb
+++ b/recipes-containers/containerd/containerd-opencontainers_git.bb
@@ -1,6 +1,7 @@
SRCREV = "fd103cb716352c7e19768e4fed057f71d68902a0"
SRC_URI = "git://github.com/containerd/containerd;branch=release/1.2 \
file://0001-build-use-oe-provided-GO-and-flags.patch \
+ file://0001-Add-build-option-GODEBUG-1.patch \
"
include containerd.inc
@@ -9,5 +10,7 @@ LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=1269f40c0d099c21a871163984590d
CONTAINERD_VERSION = "v1.2.7"
+EXTRA_OEMAKE += "GODEBUG=1"
+
PROVIDES += "virtual/containerd"
RPROVIDES_${PN} = "virtual/containerd"
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] kubernetes: building unstripped binaries
2019-09-02 8:36 [PATCH 1/2] kubernetes: building unstripped binaries Hongxu Jia
2019-09-02 8:36 ` [PATCH 2/2] containerd-opencontainers: " Hongxu Jia
@ 2019-09-02 9:10 ` Hongxu Jia
2019-09-03 20:01 ` Bruce Ashfield
1 sibling, 1 reply; 5+ messages in thread
From: Hongxu Jia @ 2019-09-02 9:10 UTC (permalink / raw)
To: bruce.ashfield, meta-virtualization
On 9/2/19 4:36 PM, Hongxu Jia wrote:
> Specify GOLDFLAGS as an empty string for building unstripped binaries, which allows
> you to use code debugging tools like delve. When GOLDFLAGS is unspecified, it defaults
> to "-s -w" which strips debug information. Other flags that can be used for GOLDFLAGS
> are documented at https://golang.org/cmd/link/ [1]
Clarify one thing, make the binary *unstripped* at do_compile time,
thus Yocto will split it to stripped + dbg
//Hongxu
> [1] https://github.com/kubernetes/kubernetes/blob/master/build/root/Makefile#L82
>
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
> recipes-containers/kubernetes/kubernetes_git.bb | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/recipes-containers/kubernetes/kubernetes_git.bb b/recipes-containers/kubernetes/kubernetes_git.bb
> index b7862ec..821f51f 100644
> --- a/recipes-containers/kubernetes/kubernetes_git.bb
> +++ b/recipes-containers/kubernetes/kubernetes_git.bb
> @@ -54,7 +54,7 @@ do_compile() {
> export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
> export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
> # to limit what is built, use 'WHAT', i.e. make WHAT=cmd/kubelet
> - make cross KUBE_BUILD_PLATFORMS=${GOOS}/${GOARCH}
> + make cross KUBE_BUILD_PLATFORMS=${GOOS}/${GOARCH} GOLDFLAGS=""
> }
>
> do_install() {
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] containerd-opencontainers: building unstripped binaries
2019-09-02 8:36 ` [PATCH 2/2] containerd-opencontainers: " Hongxu Jia
@ 2019-09-03 20:01 ` Bruce Ashfield
0 siblings, 0 replies; 5+ messages in thread
From: Bruce Ashfield @ 2019-09-03 20:01 UTC (permalink / raw)
To: Hongxu Jia; +Cc: meta-virtualization
merged
Bruce
On Mon, Sep 2, 2019 at 4:37 AM Hongxu Jia <hongxu.jia@windriver.com> wrote:
>
> It defaults to "-s -w" [1] which strips debug information, refresh a backported
> patch to build unstripped binaries
>
> https://golang.org/cmd/link/
>
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
> .../0001-Add-build-option-GODEBUG-1.patch | 42 ++++++++++++++++++++++
> .../containerd/containerd-opencontainers_git.bb | 3 ++
> 2 files changed, 45 insertions(+)
> create mode 100644 recipes-containers/containerd/containerd-opencontainers/0001-Add-build-option-GODEBUG-1.patch
>
> diff --git a/recipes-containers/containerd/containerd-opencontainers/0001-Add-build-option-GODEBUG-1.patch b/recipes-containers/containerd/containerd-opencontainers/0001-Add-build-option-GODEBUG-1.patch
> new file mode 100644
> index 0000000..05c4f15
> --- /dev/null
> +++ b/recipes-containers/containerd/containerd-opencontainers/0001-Add-build-option-GODEBUG-1.patch
> @@ -0,0 +1,42 @@
> +From 84874e47aa2025b8e73df0286c44f3b8a1d9fdb2 Mon Sep 17 00:00:00 2001
> +From: Hongxu Jia <hongxu.jia@windriver.com>
> +Date: Mon, 2 Sep 2019 16:20:07 +0800
> +Subject: [PATCH] Add build option "GODEBUG=1"
> +
> +Make will generate GDB friendly binary with this build option.
> +
> +Signed-off-by: Hui Zhu <teawater@hyper.sh>
> +
> +Upstream-Status: Backport [c5a0c7f491b435e4eb45972903b00e2d8ed46495]
> +
> +Partly backport and refresh to v1.2.7
> +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> +---
> + src/import/Makefile | 8 ++++++--
> + 1 file changed, 6 insertions(+), 2 deletions(-)
> +
> +diff --git a/src/import/Makefile b/src/import/Makefile
> +index 4355395..4fb5d3b 100644
> +--- a/src/import/Makefile
> ++++ b/src/import/Makefile
> +@@ -75,11 +75,15 @@ TEST_REQUIRES_ROOT_PACKAGES=$(filter \
> + COMMANDS=ctr containerd containerd-stress
> + MANPAGES=ctr.1 containerd.1 containerd-config.1 containerd-config.toml.5
> +
> ++ifndef GODEBUG
> ++ EXTRA_LDFLAGS += -s -w
> ++endif
> ++
> + # Build tags seccomp and apparmor are needed by CRI plugin.
> + BUILDTAGS ?= seccomp apparmor
> + GO_TAGS=$(if $(BUILDTAGS),-tags "$(BUILDTAGS)",)
> +-GO_LDFLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)'
> +-SHIM_GO_LDFLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -extldflags "-static"'
> ++GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)'
> ++SHIM_GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -extldflags "-static" $(EXTRA_LDFLAGS)'
> +
> + #Replaces ":" (*nix), ";" (windows) with newline for easy parsing
> + GOPATHS=$(shell echo ${GOPATH} | tr ":" "\n" | tr ";" "\n")
> +--
> +2.7.4
> +
> diff --git a/recipes-containers/containerd/containerd-opencontainers_git.bb b/recipes-containers/containerd/containerd-opencontainers_git.bb
> index 424de74..347eae5 100644
> --- a/recipes-containers/containerd/containerd-opencontainers_git.bb
> +++ b/recipes-containers/containerd/containerd-opencontainers_git.bb
> @@ -1,6 +1,7 @@
> SRCREV = "fd103cb716352c7e19768e4fed057f71d68902a0"
> SRC_URI = "git://github.com/containerd/containerd;branch=release/1.2 \
> file://0001-build-use-oe-provided-GO-and-flags.patch \
> + file://0001-Add-build-option-GODEBUG-1.patch \
> "
>
> include containerd.inc
> @@ -9,5 +10,7 @@ LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=1269f40c0d099c21a871163984590d
>
> CONTAINERD_VERSION = "v1.2.7"
>
> +EXTRA_OEMAKE += "GODEBUG=1"
> +
> PROVIDES += "virtual/containerd"
> RPROVIDES_${PN} = "virtual/containerd"
> --
> 2.7.4
>
--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] kubernetes: building unstripped binaries
2019-09-02 9:10 ` [PATCH 1/2] kubernetes: " Hongxu Jia
@ 2019-09-03 20:01 ` Bruce Ashfield
0 siblings, 0 replies; 5+ messages in thread
From: Bruce Ashfield @ 2019-09-03 20:01 UTC (permalink / raw)
To: Hongxu Jia; +Cc: meta-virtualization
merged
Bruce
On Mon, Sep 2, 2019 at 5:10 AM Hongxu Jia <hongxu.jia@windriver.com> wrote:
>
> On 9/2/19 4:36 PM, Hongxu Jia wrote:
> > Specify GOLDFLAGS as an empty string for building unstripped binaries, which allows
> > you to use code debugging tools like delve. When GOLDFLAGS is unspecified, it defaults
> > to "-s -w" which strips debug information. Other flags that can be used for GOLDFLAGS
> > are documented at https://golang.org/cmd/link/ [1]
>
> Clarify one thing, make the binary *unstripped* at do_compile time,
>
> thus Yocto will split it to stripped + dbg
>
> //Hongxu
>
>
> > [1] https://github.com/kubernetes/kubernetes/blob/master/build/root/Makefile#L82
> >
> > Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> > ---
> > recipes-containers/kubernetes/kubernetes_git.bb | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/recipes-containers/kubernetes/kubernetes_git.bb b/recipes-containers/kubernetes/kubernetes_git.bb
> > index b7862ec..821f51f 100644
> > --- a/recipes-containers/kubernetes/kubernetes_git.bb
> > +++ b/recipes-containers/kubernetes/kubernetes_git.bb
> > @@ -54,7 +54,7 @@ do_compile() {
> > export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
> > export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
> > # to limit what is built, use 'WHAT', i.e. make WHAT=cmd/kubelet
> > - make cross KUBE_BUILD_PLATFORMS=${GOOS}/${GOARCH}
> > + make cross KUBE_BUILD_PLATFORMS=${GOOS}/${GOARCH} GOLDFLAGS=""
> > }
> >
> > do_install() {
>
>
--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-09-03 20:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02 8:36 [PATCH 1/2] kubernetes: building unstripped binaries Hongxu Jia
2019-09-02 8:36 ` [PATCH 2/2] containerd-opencontainers: " Hongxu Jia
2019-09-03 20:01 ` Bruce Ashfield
2019-09-02 9:10 ` [PATCH 1/2] kubernetes: " Hongxu Jia
2019-09-03 20:01 ` Bruce Ashfield
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.