Skip to contentSkip to conversation

kubernetes: skip textrel QA warning

PATCH In review [email protected] 3 participants 4 messages Apr 30, 2024 – Nov 19, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kubernetes: skip textrel QA warning

From: Changqing Li <[email protected]>

-buildmode=pie need cgo is enabled, but for kubernetes, some build targets are static, and cgo is disable in build script directly, refer [1]. If we add -buildmode=pie by default, will cause these static target build failed with error "-buildmode=pie requires external (cgo) linking, but cgo is not enabled".

This warning is acceptable, so just skip it.

[1] https://github.com/kubernetes/kubernetes/blob/master/hack/lib/golang.sh#L811

---
 recipes-containers/kubernetes/kubernetes_git.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-containers/kubernetes/kubernetes_git.bb +1 -1
index d7874dfa..044175eb 100644
@@ -126,7 +126,7 @@ PACKAGES =+ "kubeadm kubectl kubelet kube-proxy ${PN}-misc ${PN}-host"
 ALLOW_EMPTY:${PN} = "1"
 INSANE_SKIP:${PN} += "ldflags already-stripped"
 INSANE_SKIP:${PN}-misc += "ldflags already-stripped textrel"
-INSANE_SKIP:kubelet += "ldflags already-stripped"
+INSANE_SKIP:${MLPREFIX}kubelet += "ldflags already-stripped textrel"
 
 # Note: we are explicitly *not* adding docker to the rdepends, since we allow
 #       backends like cri-o to be used.
Signature · 1 line
2.25.1
#1 lore raw

merged.

Bruce

In message: [master][scarthgap][meta-virtualization][PATCH] kubernetes: skip textrel QA warning

Quoted 43 lines · on 30/04/2024 Changqing Li via lists.yoctoproject.org wrote:

From: Changqing Li <[email protected]>

-buildmode=pie need cgo is enabled, but for kubernetes, some build targets are static, and cgo is disable in build script directly, refer [1]. If we add -buildmode=pie by default, will cause these static target build failed with error "-buildmode=pie requires external (cgo) linking, but cgo is not enabled".

This warning is acceptable, so just skip it.

[1] https://github.com/kubernetes/kubernetes/blob/master/hack/lib/golang.sh#L811

---
 recipes-containers/kubernetes/kubernetes_git.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-containers/kubernetes/kubernetes_git.bb +1 -1
index d7874dfa..044175eb 100644
@@ -126,7 +126,7 @@ PACKAGES =+ "kubeadm kubectl kubelet kube-proxy ${PN}-misc ${PN}-host"
 ALLOW_EMPTY:${PN} = "1"
 INSANE_SKIP:${PN} += "ldflags already-stripped"
 INSANE_SKIP:${PN}-misc += "ldflags already-stripped textrel"
-INSANE_SKIP:kubelet += "ldflags already-stripped"
+INSANE_SKIP:${MLPREFIX}kubelet += "ldflags already-stripped textrel"
 
 # Note: we are explicitly *not* adding docker to the rdepends, since we allow
 #       backends like cri-o to be used.
Signature · 11 lines
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8706): https://lists.yoctoproject.org/g/meta-virtualization/message/8706
Mute This Topic: https://lists.yoctoproject.org/mt/105816435/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
#2 lore raw

Hi Changqing Li, Bruce!

My understanding is that CGO is disabled directly in the build script because building statically can fail on certain environments that don’t have all the required static libraries. However, for meta-layer builds with Yocto, could we enable CGO and set -extldflags "-static"
so that we can apply some default security flags from Yocto, such as PIE and RELRO?

https://git.yoctoproject.org/poky/plain/meta/conf/distro/include/security_flags.inc?h=scarthgap

Could there be any runtime issues when enabling CGO and building statically? I hope to receive your feedback.
Hieu

#3 lore raw
Quoted 10 lines · On Fri, Nov 14, 2025 at 12:50 AM nvhieudt11 via lists.yoctoproject.org…

Hi Changqing Li, Bruce!

My understanding is that CGO is disabled directly in the build script because building statically can fail on certain environments that don’t have all the required static libraries. However, for meta-layer builds with Yocto, could we enable CGO and set -extldflags "-static" so that we can apply some default security flags from Yocto, such as PIE and RELRO?

Quoted 5 lines

https://git.yoctoproject.org/poky/plain/meta/conf/distro/include/security_flags.inc?h=scarthgap

Could there be any runtime issues when enabling CGO and building statically?

I used to build most of the go applications using -static, but have moved away from it in most
cases as it was causing other integration issues (and possible security and footprint issues).
I'm not pulling up all the runtime issues from memory but can dig more another time.

If we do want this to be something enabled via an image or distro feature (or even packageconfig)
that is possible, but I wouldn't make it the default.

Bruce

Quoted 14 lines

I hope to receive your feedback.
Hieu

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#9440):
https://lists.yoctoproject.org/g/meta-virtualization/message/9440
Mute This Topic: https://lists.yoctoproject.org/mt/105816435/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II