Skip to contentSkip to conversation

skopeo: avoid overriding GOBUILDFLAGS set in go.bbclass

PATCH ChenQi 2 participants 2 messages Aug 13, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

ChenQi

author
#1 lore raw

ping

Quoted 52 lines · Chen Qi via lists.yoctoproject.org

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 -2
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
 
-=-=-=-=-=-=-=-=-=-=-=-

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

#2 lore raw

I'm still considering it.

But all merges are held for a bit as I finalize the M3 package updates and system level testing.

Generally speaking, I don't really want any of the values from the go classes as they've caused me more issues than I can count. I prefer to keep the recipes handling their own flags. But as I said, I'll consider this once I'm through updates.

Bruce

Quoted 64 lines · ChenQi

ping

Quoted 6 lines · Chen Qi via lists.yoctoproject.org

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]

Quoted 10 lines

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'):

Quoted 7 lines

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.

Quoted 1 line

And we can see we'll need to use anonymous python function to handle

PIE. So we

Review

Quoted 8 lines

should avoid overriding it unless necessary.

---
  recipes-containers/skopeo/skopeo_git.bb | 1 -
  1 file changed, 1 deletion(-)
(quoted diff) +0 -0

b/recipes-containers/skopeo/skopeo_git.bb

Quoted 13 lines

index c5518cdc..32938108 100644

recipes-containers/skopeo/skopeo_git.bb +0 -2
@@ -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
 
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 2 lines

Links: You receive all messages sent to this group. View/Reply Online (#9326):

https://lists.yoctoproject.org/g/meta-virtualization/message/9326

Quoted 3 lines

Mute This Topic: https://lists.yoctoproject.org/mt/114265288/3618072
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub

[[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

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