diff options
author | Mark Asselstine <mark.asselstine@windriver.com> | 2019-03-18 11:21:52 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-10 13:46:17 +0100 |
commit | bb04858ea65a4808c3164c77b69855bb8ebc4075 (patch) | |
tree | d738860870507921de47a1f9348dbd42921c6fb8 | |
parent | 4d1000a303ac6417fef0a7ea91f00ce14673127a (diff) | |
download | poky-bb04858ea65a4808c3164c77b69855bb8ebc4075.tar.gz |
go.bbclass: Export more GO* environment variables
Currently we are not doing a good job of consolidating GO environment
variables used by the go build system in the go.bbclass, instead we
are relying on the individual GO recipe authors to perform the
exports. This can result in inconsistent build results and often
binaries that are not properly cross compiled, resulting in segfaults
when the applications are run on the target.
For example the GO documentation recommends that the environment
include a value assigned to GOARM when cross building for ARMv5, ARMv6
and ARMv7 (https://github.com/golang/go/wiki/GoArm).
In order to avoid polluting the build scripts with unnecessary
exports, such as run.do_compile, we attempt to only export variables
when they apply to a specific arch.
(From OE-Core rev: 6300c4a83f7c8fc88702798ffe25bd6d57091673)
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/go.bbclass | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass index 7069c5fec0..78c2d6880f 100644 --- a/meta/classes/go.bbclass +++ b/meta/classes/go.bbclass | |||
@@ -8,6 +8,25 @@ GOROOT = "${STAGING_LIBDIR}/go" | |||
8 | export GOROOT | 8 | export GOROOT |
9 | export GOROOT_FINAL = "${libdir}/go" | 9 | export GOROOT_FINAL = "${libdir}/go" |
10 | 10 | ||
11 | export GOARCH = "${TARGET_GOARCH}" | ||
12 | export GOOS = "${TARGET_GOOS}" | ||
13 | export GOHOSTARCH="${BUILD_GOARCH}" | ||
14 | export GOHOSTOS="${BUILD_GOOS}" | ||
15 | |||
16 | GOARM[export] = "0" | ||
17 | GOARM_arm_class-target = "${TARGET_GOARM}" | ||
18 | GOARM_arm_class-target[export] = "1" | ||
19 | |||
20 | GO386[export] = "0" | ||
21 | GO386_x86_class-target = "${TARGET_GO386}" | ||
22 | GO386_x86_class-target[export] = "1" | ||
23 | GO386_i586_class-target = "${TARGET_GO386}" | ||
24 | GO386_i586_class-target[export] = "1" | ||
25 | |||
26 | GOMIPS[export] = "0" | ||
27 | GOMIPS_mips_class-target = "${TARGET_GOMIPS}" | ||
28 | GOMIPS_mips_class-target[export] = "1" | ||
29 | |||
11 | DEPENDS_GOLANG_class-target = "virtual/${TUNE_PKGARCH}-go virtual/${TARGET_PREFIX}go-runtime" | 30 | DEPENDS_GOLANG_class-target = "virtual/${TUNE_PKGARCH}-go virtual/${TARGET_PREFIX}go-runtime" |
12 | DEPENDS_GOLANG_class-native = "go-native" | 31 | DEPENDS_GOLANG_class-native = "go-native" |
13 | DEPENDS_GOLANG_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk virtual/${TARGET_PREFIX}go-runtime" | 32 | DEPENDS_GOLANG_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk virtual/${TARGET_PREFIX}go-runtime" |