Skip to contentSkip to conversation

umoci: adjust inherit and fix CGO settings

PATCH In review Chen Qi 2 participants 6 messages Jun 10, 2022

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH 1/5 umoci: adjust inherit and fix CGO settings

go.bbclass already inherits goarch.bbclass.

The CGO_CFLAGS and CGO_LDFLAGS should use target flags as set in oe-core's go.bbclass, not the SDK related ones.

---
 recipes-containers/umoci/umoci_git.bb | 4 ----
 1 file changed, 4 deletions(-)
recipes-containers/umoci/umoci_git.bb +0 -4
index a2c0827..525a967 100644
@@ -14,7 +14,6 @@ PV = "v0.4.7-dev+git${SRCPV}"
 S = "${WORKDIR}/github.com/opencontainers/umoci"
 GO_IMPORT = "github.com/opencontainers/umoci"
 
-inherit goarch
 inherit go
 
 # This disables seccomp and apparmor, which are on by default in the
@@ -53,7 +52,6 @@ do_compile:class-native () {
 }
 
 do_compile() {
-    export GOARCH="${TARGET_GOARCH}"
     export GOPATH="${WORKDIR}/git/"
 
     # Pass the needed cflags/ldflags so that cgo
@@ -61,8 +59,6 @@ do_compile() {
     export CGO_ENABLED="1"
     export CFLAGS=""
     export LDFLAGS=""
-    export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
-    export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
 
     export GO111MODULE=off
 
Signature · 1 line
2.36.0
author
#1 lore raw

PATCH 2/5 oci-runtime-tools: adjust inherit and fix CGO settings

go.bbclass already inherits goarch.bbclass.

The CGO_CFLAGS and CGO_LDFLAGS should use target flags as set in oe-core's go.bbclass, not the SDK related ones.

---
 .../oci-runtime-tools/oci-runtime-tools_git.bb               | 5 -----
 1 file changed, 5 deletions(-)
recipes-containers/oci-runtime-tools/oci-runtime-tools_git.bb +0 -5
index 838d24b..b953ab4 100644
@@ -13,12 +13,9 @@ GO_IMPORT = "import"
 
 INSANE_SKIP:${PN} += "ldflags textrel"
 
-inherit goarch
 inherit go
 
 do_compile() {
-	export GOARCH="${TARGET_GOARCH}"
-	export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
 	export GOPATH="${S}/src/import:${S}/src/import/vendor"
 
 	# Pass the needed cflags/ldflags so that cgo
@@ -26,8 +23,6 @@ do_compile() {
 	export CGO_ENABLED="1"
 	export CFLAGS=""
 	export LDFLAGS=""
-	export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
-	export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
 	export GO111MODULE=off
 
 	# fixes:
Signature · 1 line
2.36.0
#2 lore raw

Re: [meta-virtualization][PATCH 2/5] oci-runtime-tools: adjust inherit and fix CGO settings

Quoted 5 lines · Chen Qi

go.bbclass already inherits goarch.bbclass.

The CGO_CFLAGS and CGO_LDFLAGS should use target flags as set in oe-core's go.bbclass, not the SDK related ones.

While that may be true, I've had significant issues with the go bbclass in the past, so I'm going to keep all of the explicit flag setting.

Feel free to send adjustments to the flags, but I won't be dropping them.

Bruce

Quoted 44 lines
---
 .../oci-runtime-tools/oci-runtime-tools_git.bb               | 5 -----
 1 file changed, 5 deletions(-)
recipes-containers/oci-runtime-tools/oci-runtime-tools_git.bb +0 -6
index 838d24b..b953ab4 100644
@@ -13,12 +13,9 @@ GO_IMPORT = "import"
 
 INSANE_SKIP:${PN} += "ldflags textrel"
 
-inherit goarch
 inherit go
 
 do_compile() {
-       export GOARCH="${TARGET_GOARCH}"
-       export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
        export GOPATH="${S}/src/import:${S}/src/import/vendor"
 
        # Pass the needed cflags/ldflags so that cgo
@@ -26,8 +23,6 @@ do_compile() {
        export CGO_ENABLED="1"
        export CFLAGS=""
        export LDFLAGS=""
-       export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
-       export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
        export GO111MODULE=off
 
        # fixes:
--

2.36.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7359): https://lists.yoctoproject.org/g/meta-virtualization/message/7359
Mute This Topic: https://lists.yoctoproject.org/mt/91664849/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
author
#3 lore raw

PATCH 3/5 riddler: adjust inherit and fix CGO settings

In reply to Chen Qi

go.bbclass already inherits goarch.bbclass.

The CGO_CFLAGS and CGO_LDFLAGS should use target flags as set in oe-core's go.bbclass, not the SDK related ones.

---
 recipes-containers/riddler/riddler_git.bb | 5 -----
 1 file changed, 5 deletions(-)
recipes-containers/riddler/riddler_git.bb +0 -5
index be751d6..d92e732 100644
@@ -13,7 +13,6 @@ GO_IMPORT = "import"
 
 S = "${WORKDIR}/git"
 
-inherit goarch
 inherit go
 
 # In addition to hosts go does not like, we do not build for mips.
@@ -25,8 +24,6 @@ COMPATIBLE_HOST:mipsarch = "null"
 EXTRA_OEMAKE="BUILDTAGS=''"
 
 do_compile() {
-	export GOARCH="${TARGET_GOARCH}"
-	export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
 	# Setup vendor directory so that it can be used in GOPATH.
 	#
 	# Go looks in a src directory under any directory in GOPATH but riddler
@@ -44,8 +41,6 @@ do_compile() {
 	export CGO_ENABLED="1"
 	export CFLAGS=""
 	export LDFLAGS=""
-	export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
-	export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
 	export GO111MODULE=off
 
 	cd ${S}/src/import
Signature · 1 line
2.36.0
author
#4 lore raw

PATCH 4/5 oci-image-tools: adjust inherit and fix CGO settings

In reply to Chen Qi

go.bbclass already inherits goarch.bbclass.

The CGO_CFLAGS and CGO_LDFLAGS should use target flags as set in oe-core's go.bbclass, not the SDK related ones.

---
 recipes-containers/oci-image-tools/oci-image-tools_git.bb | 5 -----
 1 file changed, 5 deletions(-)
recipes-containers/oci-image-tools/oci-image-tools_git.bb +0 -5
index 8bafd2a..5d2f7c9 100644
@@ -20,7 +20,6 @@ SRCREV = "11f9988298305d36f64248a6ee55318e60bf170b"
 PV = "1.0.0-rc3+git${SRCPV}"
 GO_IMPORT = "import"
 
-inherit goarch
 inherit go
 
 # This disables seccomp and apparmor, which are on by default in the
@@ -28,8 +27,6 @@ inherit go
 EXTRA_OEMAKE="BUILDTAGS=''"
 
 do_compile() {
-	export GOARCH="${TARGET_GOARCH}"
-	export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
 	# Setup vendor directory so that it can be used in GOPATH.
 	#
 	# Go looks in a src directory under any directory in GOPATH but riddler
@@ -48,8 +45,6 @@ do_compile() {
 	export CGO_ENABLED="1"
 	export CFLAGS=""
 	export LDFLAGS=""
-	export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
-	export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
 	export GO111MODULE=off
 
 	cd ${S}/src/import
Signature · 1 line
2.36.0
author
#5 lore raw

PATCH 5/5 netns: adjust inherit and fix CGO settings

In reply to Chen Qi

go.bbclass already inherits goarch.bbclass.

The CGO_CFLAGS and CGO_LDFLAGS should use target flags as set in oe-core's go.bbclass, not the SDK related ones.

---
 recipes-networking/netns/netns_git.bb | 5 -----
 1 file changed, 5 deletions(-)
recipes-networking/netns/netns_git.bb +0 -5
index cd17e1a..cf5ce39 100644
@@ -12,14 +12,11 @@ GO_IMPORT = "import"
 
 S = "${WORKDIR}/git"
 
-inherit goarch
 inherit go
 
 EXTRA_OEMAKE = "GO='${GO}'"
 
 do_compile() {
-	export GOARCH="${TARGET_GOARCH}"
-	export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
 	# Setup vendor directory so that it can be used in GOPATH.
 	#
 	# Go looks in a src directory under any directory in GOPATH but netns
@@ -37,8 +34,6 @@ do_compile() {
 	export CGO_ENABLED="1"
 	export CFLAGS=""
 	export LDFLAGS=""
-	export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
-	export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
 	export GOFLAGS="-mod=vendor"
 
 	cd ${S}/src/import
Signature · 1 line
2.36.0