[meta-virtualization] [PATCH V2] docker: improve hardcoded CC for cross compile

Bruce Ashfield bruce.ashfield at gmail.com
Fri Jul 19 12:17:26 PDT 2019


Thanks.

I have this staged and will merge it once my build + runtime tests are done.

Bruce

On Wed, Jul 17, 2019 at 5:54 AM Hongxu Jia <hongxu.jia at windriver.com> wrote:
>
> Since commit applied in moby [61a3285 Support cross-compile for arm]
> it hardcoded var-CC to support cross-compile for arm
>
> Correct it with "${parameter:-word}" format, it is helpful for user
> define toolchains
>
> (Use Default Values.  If parameter is unset or null, the expansion of
> word is substituted.  Otherwise, the value of parameter is substituted.)
>
> https://github.com/moby/moby/commit/61a3285864d3f1b489f48f765b61b2c7bd300372
>
> Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
> ---
>  recipes-containers/docker/docker_git.bb            |  3 +-
>  ...001-imporve-hardcoded-CC-on-cross-compile.patch | 61 ++++++++++++++++++++++
>  2 files changed, 63 insertions(+), 1 deletion(-)
>  create mode 100644 recipes-containers/docker/files/0001-imporve-hardcoded-CC-on-cross-compile.patch
>
> diff --git a/recipes-containers/docker/docker_git.bb b/recipes-containers/docker/docker_git.bb
> index 5b2f3b0..feca536 100644
> --- a/recipes-containers/docker/docker_git.bb
> +++ b/recipes-containers/docker/docker_git.bb
> @@ -43,7 +43,8 @@ SRC_URI = "\
>         git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=git/libnetwork \
>         git://github.com/docker/cli;branch=19.03;name=cli;destsuffix=git/cli \
>         file://docker.init \
> -        file://0001-libnetwork-use-GO-instead-of-go.patch \
> +       file://0001-libnetwork-use-GO-instead-of-go.patch \
> +       file://0001-imporve-hardcoded-CC-on-cross-compile.patch \
>         "
>
>  require docker.inc
> diff --git a/recipes-containers/docker/files/0001-imporve-hardcoded-CC-on-cross-compile.patch b/recipes-containers/docker/files/0001-imporve-hardcoded-CC-on-cross-compile.patch
> new file mode 100644
> index 0000000..554d282
> --- /dev/null
> +++ b/recipes-containers/docker/files/0001-imporve-hardcoded-CC-on-cross-compile.patch
> @@ -0,0 +1,61 @@
> +From 975b3a8e761b20e570120e8ca99b19da8012cae5 Mon Sep 17 00:00:00 2001
> +From: Hongxu Jia <hongxu.jia at windriver.com>
> +Date: Wed, 17 Jul 2019 17:34:04 +0800
> +Subject: [PATCH] imporve hardcoded CC on cross compile
> +
> +Since commit applied in moby [61a3285 Support cross-compile for arm]
> +it hardcoded var-CC to support cross-compile for arm
> +
> +Correct it with "${parameter:-word}" format, it is helpful for user
> +define toolchains
> +
> +(Use Default Values.  If parameter is unset or null, the expansion of
> +word is substituted.  Otherwise, the value of parameter is substituted.)
> +
> +Upstream-Status: Submitted [https://github.com/moby/moby/pull/39546]
> +
> +Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
> +---
> + hack/make/.binary | 10 +++++-----
> + 1 file changed, 5 insertions(+), 5 deletions(-)
> +
> +diff --git a/src/import/hack/make/.binary b/src/import/hack/make/.binary
> +index 53de674..66f4ca0 100644
> +--- a/src/import/hack/make/.binary
> ++++ b/src/import/hack/make/.binary
> +@@ -44,27 +44,27 @@ if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARC
> +       # must be cross-compiling!
> +       case "$(go env GOOS)/$(go env GOARCH)" in
> +               windows/amd64)
> +-                      export CC=x86_64-w64-mingw32-gcc
> ++                      export CC="${CC:-x86_64-w64-mingw32-gcc}"
> +                       export CGO_ENABLED=1
> +                       ;;
> +               linux/arm)
> +                       case "${GOARM}" in
> +                       5|"")
> +-                              export CC=arm-linux-gnueabi-gcc
> ++                              export CC="${CC:-arm-linux-gnueabi-gcc}"
> +                               export CGO_ENABLED=1
> +                               ;;
> +                       7)
> +-                              export CC=arm-linux-gnueabihf-gcc
> ++                              export CC="${CC:-arm-linux-gnueabihf-gcc}"
> +                               export CGO_ENABLED=1
> +                               ;;
> +                       esac
> +                       ;;
> +               linux/arm64)
> +-                      export CC=aarch64-linux-gnu-gcc
> ++                      export CC="${CC:-aarch64-linux-gnu-gcc}"
> +                       export CGO_ENABLED=1
> +                       ;;
> +               linux/amd64)
> +-                      export CC=x86_64-linux-gnu-gcc
> ++                      export CC="${CC:-x86_64-linux-gnu-gcc}"
> +                       export CGO_ENABLED=1
> +                       ;;
> +       esac
> +--
> +2.7.4
> +
> --
> 2.7.4
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


More information about the meta-virtualization mailing list