diff options
author | Amy Fong <amy.fong@windriver.com> | 2015-10-06 14:41:10 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2015-10-13 11:29:57 -0400 |
commit | 7360250a0f3694d1090e009ec344b2f18fc98514 (patch) | |
tree | b80030edebac8dc99883ed2614888bef1fffad93 | |
parent | ac2adfb1696f191f15bcfeb13dab2d10fd6b7ce1 (diff) | |
download | meta-virtualization-7360250a0f3694d1090e009ec344b2f18fc98514.tar.gz |
Backport go-cross: fix the bug of cross building error
submitted to upstream https://github.com/errordeveloper/oe-meta-go
go-cross: fix the bug of cross building error
When a package's recipe inherit "cross" bbclass, its CC and CXX are defined
as the host native gcc and g++ instead of the host cross toolchain, fot this
case, CC_FOR_TARGET and CXX_FOR_TARGET should be defined the same with CC and
CXX, instead they are should be define as host cross toolchain's CC and CXX,
otherwise, it will build failed for target arm architecture as below:
| # Building packages and commands for linux/arm.
| + CC='gcc '
| + bitbake_build/tmp/work/x86_64-wrs-linux-gnueabi/go-cross/1.4-r0/go/pkg/tool/linux_amd64/go_bootstrap install -ccflags '' -gcflags '' -ldflags '' -v std
| runtime
| errors
| sync/atomic
| unicode
| unicode/utf8
| math
| sort
| encoding
| unicode/utf16
| container/list
| crypto/subtle
| runtime/cgo
| container/ring
| image/color
| runtime/race
| # runtime/cgo
| gcc: error: unrecognized command line option '-marm'
Signed-off-by: fupan li <fupan.li@windriver.com>
Signed-off-by: Amy Fong <amy.fong@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r-- | recipes-devtools/go-cross/go-cross_1.3.bb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/recipes-devtools/go-cross/go-cross_1.3.bb b/recipes-devtools/go-cross/go-cross_1.3.bb index 87231428..9ecc295d 100644 --- a/recipes-devtools/go-cross/go-cross_1.3.bb +++ b/recipes-devtools/go-cross/go-cross_1.3.bb | |||
@@ -5,6 +5,8 @@ DESCRIPTION = "\ | |||
5 | HOMEPAGE = "https://golang.org/" | 5 | HOMEPAGE = "https://golang.org/" |
6 | LICENSE = "BSD-3-Clause" | 6 | LICENSE = "BSD-3-Clause" |
7 | 7 | ||
8 | DEPENDS = "virtual/${TARGET_PREFIX}gcc" | ||
9 | |||
8 | SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz" | 10 | SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz" |
9 | 11 | ||
10 | S = "${WORKDIR}/go/" | 12 | S = "${WORKDIR}/go/" |
@@ -44,8 +46,8 @@ do_compile() { | |||
44 | ## TODO: consider setting GO_EXTLINK_ENABLED | 46 | ## TODO: consider setting GO_EXTLINK_ENABLED |
45 | 47 | ||
46 | export CC="${BUILD_CC}" | 48 | export CC="${BUILD_CC}" |
47 | export CC_FOR_TARGET="${CC}" | 49 | export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" |
48 | export CXX_FOR_TARGET="${CXX}" | 50 | export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" |
49 | export GO_CCFLAGS="${HOST_CFLAGS}" | 51 | export GO_CCFLAGS="${HOST_CFLAGS}" |
50 | export GO_LDFLAGS="${HOST_LDFLAGS}" | 52 | export GO_LDFLAGS="${HOST_LDFLAGS}" |
51 | 53 | ||