[OE-core] [v2][PATCH 1/2] go.bbclass: Export GOARM

Khem Raj raj.khem at gmail.com
Fri Mar 15 04:39:26 UTC 2019


On Thu, Mar 14, 2019 at 1:05 PM Mark Asselstine
<mark.asselstine at windriver.com> wrote:
>
> When building GO packages for ARM (v5, v6, v7) it is expected that the
> GOARM env variable is set during the build. Not having GOARM exported
> will result in GO binaries which can't be executed on the target
> (terminate with segfault). Per https://github.com/golang/go/wiki/GoArm
>
> We already have the logic in goarch.bbclass to determine the correct
> value of GOARM (see GOARM_TARGET), but currently this is only used to
> build go itself (go-cross_1.*.bb requires go-cross.inc --> export
> GOARM = "${TARGET_GOARM}").
>
> Here we export GOARM but we do it such that it is only exported if we
> are building for 'arm' and only when recipes requiring/inheriting
> go.bbclass are be used to build for the target.
>
> Signed-off-by: Mark Asselstine <mark.asselstine at windriver.com>
> ---
>
> V2
> * Avoid potential undefined situations
>
>  meta/classes/go.bbclass | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
> index af331f8..5af4c3e 100644
> --- a/meta/classes/go.bbclass
> +++ b/meta/classes/go.bbclass
> @@ -8,6 +8,10 @@ GOROOT = "${STAGING_LIBDIR}/go"
>  export GOROOT
>  export GOROOT_FINAL = "${libdir}/go"
>
> +GOARM[export] = "0"
> +GOARM_arm_class-target = "${TARGET_GOARM}"
> +GOARM_arm_class-target[export] = "1"
> +

while this works, I think it would be nicer to handle it for all

export GOHOSTOS = "${BUILD_GOOS}"
export GOHOSTARCH = "${BUILD_GOARCH}"
export GOOS = "${TARGET_GOOS}"
export GOARCH = "${TARGET_GOARCH}"
export GOARM = "${TARGET_GOARM}"
export GO386 = "${TARGET_GO386}"
export GOMIPS = "${TARGET_GOMIPS}"

these should all be replicated into bbclass.

>  DEPENDS_GOLANG_class-target = "virtual/${TUNE_PKGARCH}-go virtual/${TARGET_PREFIX}go-runtime"
>  DEPENDS_GOLANG_class-native = "go-native"
>  DEPENDS_GOLANG_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk virtual/${TARGET_PREFIX}go-runtime"
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


More information about the Openembedded-core mailing list