Hello, I want to know how to cross compile in docker
Just run hover build *** --docker
Just run
hover build *** --docker
Do I need to write a Dockerfile?
Nope. Automatically done for you.
@qianniancn did it work?
@jld3103 Sorry, failed to cross compile to Linux on Windows platform.
It's early morning Beijing time. I'm going to bed. I'll see what the problem is tomorrow.
What Windows version do you have? Docker doesn't work on all Windows versions. They only let you use it on professional versions. Anyway you could still install a Linux toolchain on your Windows machine.
@jld3103 My windows is professional. Docker can be built normally.
Ok then lets look at it later when you are awake again
bxe@DESKTOP-85PRBV1 MINGW64 /e/GoDev/flutter-examples/text_demo (master)
$ hover build linux --docker
hover: Cleaning the build directory
hover: ⚠ The go-flutter project tries to stay compatible with the beta channel of Flutter.
hover: ⚠ It's advised to use the beta channel: flutter channel beta
hover: Building flutter bundle
hover: Using engine from cache
hover: Compiling go binary using docker container
Running this docker command: C:\Program Files\Docker\Docker\resources\bin\docker.exe run --rm --mount type=bind,source=E:\GoDev\flutter-examples\text_demo,target=/app --mount type=bind,source=C:\Users\bxe\AppData\Local\hover\engine,target=/root/.cache/hover/engine --mount type=bind,source=C:\Users\bxe\AppData\Local\hover\docker-go-cache,target=/go-cache --env GOCACHE=/go-cache goflutter/hover:v0.41.2 hover-safe.sh build linux --skip-flutter-build-bundle --skip-engine-download
docker container: Unable to find image 'goflutter/hover:v0.41.2' locally
docker container: v0.41.2: Pulling from goflutter/hover
docker container: f15005b0235f: Pulling fs layer
docker container: 41ebfd3d2fd0: Pulling fs layer
docker container: b998346ba308: Pulling fs layer
docker container: f01ec562c947: Pulling fs layer
docker container: c5e092b8639b: Pulling fs layer
docker container: 4feb95896f3c: Pulling fs layer
docker container: c7b88469670a: Pulling fs layer
docker container: ff08e1e38924: Pulling fs layer
docker container: 8f48c2e5d9a1: Pulling fs layer
docker container: 898ab219a8f7: Pulling fs layer
docker container: a321a30e9b5a: Pulling fs layer
docker container: 7be16483962b: Pulling fs layer
docker container: b38563578968: Pulling fs layer
docker container: 5e880f0b891c: Pulling fs layer
docker container: dd4652a98f16: Pulling fs layer
docker container: eed742cd3cac: Pulling fs layer
docker container: d52b7c12ff95: Pulling fs layer
docker container: 9f8d8c408daf: Pulling fs layer
docker container: 647404ffebc1: Pulling fs layer
docker container: 125f0978dd80: Pulling fs layer
docker container: 09f16f36222a: Pulling fs layer
docker container: 962eb487295b: Pulling fs layer
docker container: ba682a75cbdc: Pulling fs layer
docker container: 463dff8aae61: Pulling fs layer
docker container: bb0707a71154: Pulling fs layer
docker container: bd87e4511c9a: Pulling fs layer
docker container: bf857a5bedea: Pulling fs layer
docker container: ec1ab69c8442: Pulling fs layer
docker container: 943712b2a011: Pulling fs layer
docker container: eed742cd3cac: Waiting
docker container: d52b7c12ff95: Waiting
docker container: 9f8d8c408daf: Waiting
docker container: 647404ffebc1: Waiting
docker container: 125f0978dd80: Waiting
docker container: 09f16f36222a: Waiting
docker container: 962eb487295b: Waiting
docker container: ba682a75cbdc: Waiting
docker container: 463dff8aae61: Waiting
docker container: bb0707a71154: Waiting
docker container: bd87e4511c9a: Waiting
docker container: f01ec562c947: Waiting
docker container: c5e092b8639b: Waiting
docker container: 4feb95896f3c: Waiting
docker container: c7b88469670a: Waiting
docker container: ff08e1e38924: Waiting
docker container: 8f48c2e5d9a1: Waiting
docker container: 898ab219a8f7: Waiting
docker container: a321a30e9b5a: Waiting
docker container: 7be16483962b: Waiting
docker container: b38563578968: Waiting
docker container: bf857a5bedea: Waiting
docker container: 5e880f0b891c: Waiting
docker container: dd4652a98f16: Waiting
docker container: 943712b2a011: Waiting
docker container: ec1ab69c8442: Waiting
docker container: 41ebfd3d2fd0: Verifying Checksum
docker container: 41ebfd3d2fd0: Download complete
docker container: f01ec562c947: Verifying Checksum
docker container: f01ec562c947: Download complete
docker container: b998346ba308: Verifying Checksum
docker container: b998346ba308: Download complete
docker container: f15005b0235f: Verifying Checksum
docker container: f15005b0235f: Download complete
docker container: c7b88469670a: Verifying Checksum
docker container: c7b88469670a: Download complete
docker container: c5e092b8639b: Verifying Checksum
docker container: c5e092b8639b: Download complete
docker container: f15005b0235f: Pull complete
docker container: ff08e1e38924: Download complete
docker container: 41ebfd3d2fd0: Pull complete
docker container: b998346ba308: Pull complete
docker container: f01ec562c947: Pull complete
docker container: c5e092b8639b: Pull complete
docker container: 8f48c2e5d9a1: Verifying Checksum
docker container: 8f48c2e5d9a1: Download complete
docker container: 4feb95896f3c: Verifying Checksum
docker container: 4feb95896f3c: Download complete
docker container: 7be16483962b: Verifying Checksum
docker container: 7be16483962b: Download complete
docker container: 898ab219a8f7: Verifying Checksum
docker container: 898ab219a8f7: Download complete
docker container: b38563578968: Verifying Checksum
docker container: b38563578968: Download complete
docker container: 4feb95896f3c: Pull complete
docker container: c7b88469670a: Pull complete
docker container: ff08e1e38924: Pull complete
docker container: dd4652a98f16: Verifying Checksum
docker container: dd4652a98f16: Download complete
docker container: 8f48c2e5d9a1: Pull complete
docker container: eed742cd3cac: Verifying Checksum
docker container: eed742cd3cac: Download complete
docker container: d52b7c12ff95: Verifying Checksum
docker container: d52b7c12ff95: Download complete
docker container: 9f8d8c408daf: Verifying Checksum
docker container: 9f8d8c408daf: Download complete
docker container: 898ab219a8f7: Pull complete
docker container: 647404ffebc1: Verifying Checksum
docker container: 647404ffebc1: Download complete
docker container: a321a30e9b5a: Verifying Checksum
docker container: a321a30e9b5a: Download complete
docker container: 125f0978dd80: Verifying Checksum
docker container: 125f0978dd80: Download complete
docker container: 962eb487295b: Verifying Checksum
docker container: 962eb487295b: Download complete
docker container: a321a30e9b5a: Pull complete
docker container: 7be16483962b: Pull complete
docker container: b38563578968: Pull complete
docker container: 5e880f0b891c: Verifying Checksum
docker container: 5e880f0b891c: Download complete
docker container: 463dff8aae61: Verifying Checksum
docker container: 463dff8aae61: Download complete
docker container: bb0707a71154: Verifying Checksum
docker container: bb0707a71154: Download complete
docker container: bd87e4511c9a: Verifying Checksum
docker container: bd87e4511c9a: Download complete
docker container: 5e880f0b891c: Pull complete
docker container: dd4652a98f16: Pull complete
docker container: eed742cd3cac: Pull complete
docker container: d52b7c12ff95: Pull complete
docker container: 9f8d8c408daf: Pull complete
docker container: 647404ffebc1: Pull complete
docker container: bf857a5bedea: Download complete
docker container: 125f0978dd80: Pull complete
docker container: ec1ab69c8442: Verifying Checksum
docker container: ec1ab69c8442: Download complete
docker container: 943712b2a011: Verifying Checksum
docker container: 943712b2a011: Download complete
docker container: 09f16f36222a: Verifying Checksum
docker container: 09f16f36222a: Download complete
docker container: 09f16f36222a: Pull complete
docker container: 962eb487295b: Pull complete
docker container: ba682a75cbdc: Download complete
docker container: ba682a75cbdc: Pull complete
docker container: 463dff8aae61: Pull complete
docker container: bb0707a71154: Pull complete
docker container: bd87e4511c9a: Pull complete
docker container: bf857a5bedea: Pull complete
docker container: ec1ab69c8442: Pull complete
docker container: 943712b2a011: Pull complete
docker container: Digest: sha256:320d9ac35fd25574b2faf5abaad3c7dcbfe7e645f7a4cf7b35d910f0ecc9479a
docker container: Status: Downloaded newer image for goflutter/hover:v0.41.2
docker container: hover: Checking available release on Github
docker container: hover: Failed to retrieve the organization name: open android/app/src/main/AndroidManifest.xml: no such file or directory
docker container: hover: Compiling 'go-flutter' and plugins
docker container: hover: Go build failed: exit status 1
docker container: go: github.com/go-flutter-desktop/[email protected]: Get https://proxy.golang.org/github.com/go-flutter-desktop/go-flutter/@v/v0.38.0.mod: dial tcp 216.58.200.241:443: connect: connection refused
hover: Docker run failed: exit status 1
@jld3103 It seems that it is caused by Chinese network problems. #406 #392
In China, Google's services, including golang.org, are inaccessible.
Is it possible to add GOPROXY to the dockerfile? https://goproxy.io/ or https://goproxy.cn/

hover should automatically pickup your GOPROXY in the docker container. Another problem you are running into is that you have no AndroidManifest.xml which hover needs to find the organization name. You can create a simple placeholder manifest with only your organization name.
@jld3103 The question is still this:

$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\bxe\AppData\Local\go-build
set GOENV=C:\Users\bxe\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\bxe\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=D:\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\bxe\AppData\Local\Temp\go-build053072714=/tmp/go-build -gno-record-gcc-switches
@pchampio
@jld3103 I'm not following the development of the hover toolkit.
hover should automatically pickup your GOPROXY in the docker container
Is this true?
@qianniancn what's the output of:
docker run --rm -it goflutter/hover:latest go env
Edit - Additional info.
@jld3103
$ GOPROXY=https://something.com go env GOPROXY
https://something.com
$ GOPROXY=https://something.com docker run --rm -it goflutter/hover:latest go env GOPROXY
https://proxy.golang.org,direct
@pchampio It seems that the local GOPROXYis not mapped in the docker.
$ docker run --rm goflutter/hover:v0.41.2 go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build286771234=/tmp/go-build -gno-record-gcc-switches"
It should be while running with docker. I'll look into that later this day
Can we close this in favor of #392 ?
This issue is about docker compiling.
The host compiling issue was resolved by:
go env -w GOPROXY=https://goproxy.cn,direct
This issue isn't resolved!
It seems that the host GOPROXY is not mapped in the docker.
GOPROXY seems to need to be mapped into docker
That should already be happening https://github.com/go-flutter-desktop/hover/blob/7ba55114fc956a2d2ef52276538010b3d7a45142/cmd/docker.go#L63 I don't understand why it doesn't work
The output of go env GOPROXY should be used instead of Getenv!
❯ go env GOPROXY
https://proxy.golang.org,direct
❯ GOPROXY=https://something.com go env GOPROXY
https://something.com
❯ go env -w GOPROXY=https://something_2.com
❯ echo $GOPROXY
❯ go env GOPROXY
https://something_2.com
@qianniancn can you try https://github.com/go-flutter-desktop/hover/pull/114 ? You need to clone the branch and then do a go install in the cloned hover directory. To go back just install hover normally again.
@jld3103 Well, I'll have a look tomorrow. I have a headache today.
This issue has been resolved in go-flutter-desktop/hover#114 , thank you all
