Skip to contentSkip to conversation

yq: fix do_compile failure caused by CGO_ENABLED="0"

PATCH In review Li Zhou 2 participants 2 messages Apr 8 – Apr 9

lore
Share & tools
lore

Li Zhou

author
#0 lore raw

PATCH 1/1 yq: fix do_compile failure caused by CGO_ENABLED="0"

New version of yq need set CGO_ENABLED="0" when compiling, and this causes do_compile failure for 32 bits target as below:
-buildmode=pie requires external (cgo) linking, but cgo is not enabled

Tool go's internal linker doesn't support PIE for linux 32 bits target, so -buildmode=pie requires external (cgo) linking on ARM and x86. To fix this conflict with CGO_ENABLED="0", remove "-buildmode=pie" from GOBUILDFLAGS.

---
 recipes-devtools/yq/yq_git.bb | 4 ++++
 1 file changed, 4 insertions(+)
recipes-devtools/yq/yq_git.bb +4 -0
index ac19f2c4..759cd616 100644
@@ -35,6 +35,10 @@ GO_MOD_DISCOVERY_GIT_REF = "${SRCREV_yq}"
 inherit go goarch ptest
 inherit go-mod-discovery
 
+# GO's internal linker doesn't support PIE for linux 32 bits target,
+# so -buildmode=pie requires external (cgo) linking on ARM and x86.
+GOBUILDFLAGS:remove = "-buildmode=pie"
+
 do_compile() {
     cd ${S}/src/import
 
Signature · 1 line
2.51.2
#1 lore raw

merged.

Bruce

In message: [meta-virtualization][PATCH] yq: fix do_compile failure caused by CGO_ENABLED="0"

Quoted 42 lines · on 08/04/2026 Li Zhou via lists.yoctoproject.org wrote:

New version of yq need set CGO_ENABLED="0" when compiling, and this causes do_compile failure for 32 bits target as below:
-buildmode=pie requires external (cgo) linking, but cgo is not enabled

Tool go's internal linker doesn't support PIE for linux 32 bits target, so -buildmode=pie requires external (cgo) linking on ARM and x86. To fix this conflict with CGO_ENABLED="0", remove "-buildmode=pie" from GOBUILDFLAGS.

---
 recipes-devtools/yq/yq_git.bb | 4 ++++
 1 file changed, 4 insertions(+)
recipes-devtools/yq/yq_git.bb +4 -0
index ac19f2c4..759cd616 100644
@@ -35,6 +35,10 @@ GO_MOD_DISCOVERY_GIT_REF = "${SRCREV_yq}"
 inherit go goarch ptest
 inherit go-mod-discovery
 
+# GO's internal linker doesn't support PIE for linux 32 bits target,
+# so -buildmode=pie requires external (cgo) linking on ARM and x86.
+GOBUILDFLAGS:remove = "-buildmode=pie"
+
 do_compile() {
     cd ${S}/src/import
 
Signature · 11 lines
2.51.2



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