mirror of
git://git.yoctoproject.org/meta-virtualization.git
synced 2025-07-19 12:50:22 +02:00
docker-*: prevent -march being exported in arm builds
* don't export CGO_CFLAGS/CGO_CXXFLAGS like the previous version didn't before: https://git.yoctoproject.org/meta-virtualization/commit/?id=aceed7bf95cc8a42c8f470d8edf3c6f03d49da00 * both docker-moby and docker-ce have the same issue as shown with qemuarm build: docker-moby: http://errors.yoctoproject.org/Errors/Details/690021/ docker-ce: http://errors.yoctoproject.org/Errors/Details/690020/ Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
parent
e43d530e99
commit
9a78db8a91
|
@ -41,7 +41,7 @@ SRC_URI = "\
|
|||
git://github.com/docker/cli;branch=23.0;name=cli;destsuffix=git/cli;protocol=https \
|
||||
file://0001-libnetwork-use-GO-instead-of-go.patch \
|
||||
file://docker.init \
|
||||
file://0001-dynbinary-use-go-cross-compiler.patch \
|
||||
file://0001-dynbinary-use-go-cross-compiler.patch;patchdir=src/import \
|
||||
file://0001-cli-use-external-GO111MODULE-and-cross-compiler.patch \
|
||||
"
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ SRC_URI = "\
|
|||
file://docker.init \
|
||||
file://0001-libnetwork-use-GO-instead-of-go.patch \
|
||||
file://0001-cli-use-external-GO111MODULE-and-cross-compiler.patch \
|
||||
file://0001-dynbinary-use-go-cross-compiler.patch \
|
||||
file://0001-dynbinary-use-go-cross-compiler.patch;patchdir=src/import \
|
||||
"
|
||||
|
||||
DOCKER_COMMIT = "${SRCREV_moby}"
|
||||
|
|
|
@ -1,20 +1,106 @@
|
|||
From bbf600cc4d46c3f7ec0c1b486790a2402d41f550 Mon Sep 17 00:00:00 2001
|
||||
From 3ce6089417b8c6c4e8279e6ef60213436ebf8793 Mon Sep 17 00:00:00 2001
|
||||
From: Bruce Ashfield <bruce.ashfield@gmail.com>
|
||||
Date: Tue, 30 Jun 2020 22:23:33 -0400
|
||||
Subject: [PATCH] dynbinary: use go cross compiler
|
||||
|
||||
MJ: use ${GO} also in "go env" calls, because native go:
|
||||
$ go env GOARM
|
||||
5
|
||||
while go cross compiler for my target:
|
||||
$ ${GO} env GOARM
|
||||
7
|
||||
this can lead to:
|
||||
error: switch '-mcpu=cortex-a9' conflicts with switch '-march=armv5t' [-Werror]
|
||||
|
||||
but even after fixing it to use "better" -march it still doesn't match with -mcpu
|
||||
set in our GOBUILDFLAGS, causing e.g.:
|
||||
error: switch '-mcpu=cortex-a9' conflicts with switch '-march=armv7-a+simd' [-Werror]
|
||||
|
||||
so drop CGO_CFLAGS/CGO_CXXFLAGS as in OE builds we don't need them
|
||||
as long as ${GO} and GOBUILDFLAGS are respected
|
||||
|
||||
it was added in:
|
||||
https://github.com/moby/moby/commit/12558c8d6ea9f388b54eb94ba6b9eb4a9fc5c9f2
|
||||
|
||||
and it wasn't an issue before:
|
||||
https://github.com/moby/moby/commit/8c12a6648b368cc2acaea0339d6c57c920ed265c
|
||||
|
||||
because it was using 'case "${GOARM}" in' and ${GOARM} was empty in our builds
|
||||
|
||||
Upstream-Status: Inappropriate [embedded specific]
|
||||
|
||||
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
|
||||
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
|
||||
---
|
||||
hack/make/.binary | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
hack/make/.binary | 37 ++++++++-----------------------------
|
||||
1 file changed, 8 insertions(+), 29 deletions(-)
|
||||
|
||||
Index: git/src/import/hack/make/.binary
|
||||
===================================================================
|
||||
--- git.orig/src/import/hack/make/.binary
|
||||
+++ git/src/import/hack/make/.binary
|
||||
@@ -66,7 +66,7 @@
|
||||
diff --git a/hack/make/.binary b/hack/make/.binary
|
||||
index 39c00cd50c..de32ad1cc7 100644
|
||||
--- a/hack/make/.binary
|
||||
+++ b/hack/make/.binary
|
||||
@@ -3,7 +3,7 @@ set -e
|
||||
|
||||
# a helper to provide ".exe" when it's appropriate
|
||||
binary_extension() {
|
||||
- if [ "$(go env GOOS)" = 'windows' ]; then
|
||||
+ if [ "$(${GO} env GOOS)" = 'windows' ]; then
|
||||
echo -n '.exe'
|
||||
fi
|
||||
}
|
||||
@@ -16,33 +16,12 @@ source "${MAKEDIR}/.go-autogen"
|
||||
(
|
||||
export GOGC=${DOCKER_BUILD_GOGC:-1000}
|
||||
|
||||
- if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
|
||||
- # must be cross-compiling!
|
||||
- if [ "$(go env GOOS)/$(go env GOARCH)" = "linux/arm" ]; then
|
||||
- # specify name of the target ARM architecture
|
||||
- case "$(go env GOARM)" in
|
||||
- 5)
|
||||
- export CGO_CFLAGS="-march=armv5t"
|
||||
- export CGO_CXXFLAGS="-march=armv5t"
|
||||
- ;;
|
||||
- 6)
|
||||
- export CGO_CFLAGS="-march=armv6"
|
||||
- export CGO_CXXFLAGS="-march=armv6"
|
||||
- ;;
|
||||
- 7)
|
||||
- export CGO_CFLAGS="-march=armv7-a"
|
||||
- export CGO_CXXFLAGS="-march=armv7-a"
|
||||
- ;;
|
||||
- esac
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
# -buildmode=pie is not supported on Windows arm64 and Linux mips*, ppc64be
|
||||
# https://github.com/golang/go/blob/go1.19.4/src/cmd/internal/sys/supported.go#L125-L132
|
||||
if ! [ "$DOCKER_STATIC" = "1" ]; then
|
||||
# -buildmode=pie not supported when -race is enabled
|
||||
if [[ " $BUILDFLAGS " != *" -race "* ]]; then
|
||||
- case "$(go env GOOS)/$(go env GOARCH)" in
|
||||
+ case "$(${GO} env GOOS)/$(${GO} env GOARCH)" in
|
||||
windows/arm64 | linux/mips* | linux/ppc64) ;;
|
||||
*)
|
||||
BUILDFLAGS+=("-buildmode=pie")
|
||||
@@ -54,11 +33,11 @@ source "${MAKEDIR}/.go-autogen"
|
||||
# only necessary for non-sandboxed invocation where TARGETPLATFORM is empty
|
||||
PLATFORM_NAME=$TARGETPLATFORM
|
||||
if [ -z "$PLATFORM_NAME" ]; then
|
||||
- PLATFORM_NAME="$(go env GOOS)/$(go env GOARCH)"
|
||||
- if [ -n "$(go env GOARM)" ]; then
|
||||
- PLATFORM_NAME+="/v$(go env GOARM)"
|
||||
- elif [ -n "$(go env GOAMD64)" ] && [ "$(go env GOAMD64)" != "v1" ]; then
|
||||
- PLATFORM_NAME+="/$(go env GOAMD64)"
|
||||
+ PLATFORM_NAME="$(${GO} env GOOS)/$(${GO} env GOARCH)"
|
||||
+ if [ -n "$(${GO} env GOARM)" ]; then
|
||||
+ PLATFORM_NAME+="/v$(${GO} env GOARM)"
|
||||
+ elif [ -n "$(${GO} env GOAMD64)" ] && [ "$(${GO} env GOAMD64)" != "v1" ]; then
|
||||
+ PLATFORM_NAME+="/$(${GO} env GOAMD64)"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -66,7 +45,7 @@ source "${MAKEDIR}/.go-autogen"
|
||||
if [ -n "$DOCKER_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue
Block a user