Skip to contentSkip to conversation

skopeo: avoid overriding GOBUILDFLAGS set in go.bbclass

PATCH New [email protected] 1 participant 1 message Jul 21, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 skopeo: avoid overriding GOBUILDFLAGS set in go.bbclass

From: Chen Qi <[email protected]>

When MACHINE is riscv64, skopeo fails to build with the following error message:

ERROR: QA Issue: skopeo: ELF binary /usr/sbin/skopeo has relocations in .text [textrel]

To reproduce the issue, run the following command:
MACHINE=qemuriscv64 bitbake skopeo

In go.bbclass, we have:
"""
export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath"
...
python() {
if 'mips' in d.getVar('TARGET_ARCH') or 'riscv32' in d.getVar('TARGET_ARCH'):
d.appendVar('INSANE_SKIP:%s' % d.getVar('PN'), " textrel")
else:
d.appendVar('GOBUILDFLAGS', ' -buildmode=pie')
}
"""

The '-v -trimpath' and arch depedent '-buildmode=pie' is generally reasonable. And we can see we'll need to use anonymous python function to handle PIE. So we should avoid overriding it unless necessary.

---
 recipes-containers/skopeo/skopeo_git.bb | 1 -
 1 file changed, 1 deletion(-)
recipes-containers/skopeo/skopeo_git.bb +0 -1
index c5518cdc..32938108 100644
@@ -60,7 +60,6 @@ do_compile() {
 	export CGO_LDFLAGS="${TARGET_LDFLAGS}"
 
 	export GO111MODULE=off
-	export GOBUILDFLAGS="-trimpath"
 	export EXTRA_LDFLAGS="-s -w"
 
 	oe_runmake bin/skopeo
Signature · 1 line
2.34.1