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

Li Zhou <[email protected]> Wed, 8 Apr 2026 16:40:52 +0800
Newsgroups org.yoctoproject.lists.meta-virtualization
Message-ID <[email protected]>
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.

Signed-off-by: Li Zhou <[email protected]>
---
 recipes-devtools/yq/yq_git.bb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/recipes-devtools/yq/yq_git.bb b/recipes-devtools/yq/yq_git.bb
index ac19f2c4..759cd616 100644
--- a/recipes-devtools/yq/yq_git.bb
+++ b/recipes-devtools/yq/yq_git.bb
@@ -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
 
-- 
2.51.2