Closed sidevesh closed 3 years ago
Would love to implement and fix this myself :) Just need some directions though on what the issue might be for not being able to support this.
Are you sure you have the latest code? You also need to run ./install-with-docker-image.sh
to update the image locally.
What you show should be fixed in the latest version (I tagged it now).
Anyway I'll look at the code and see if the problem is there.
Ok I see the problem. Let me fix it quickly
You can either use that PR or the hidden --ignore-host-os
flag for now.
hey @jld3103 , so I did the exact same change to get linux packages working with docker, didn't work though with the following error:
swapn@Swapnils-MacBook-Pro tomatoroapp % hover build linux-deb --docker
hover: Downloading engine for platform linux-release at version 5babba6c4d25fa237bbf755ab85c9a0c50b3c6ec...
Download completed in 45.03s
hover: Failed to strip /Users/swapn/Library/Caches/hover/engine/linux-release/libflutter_engine.so: exit status 1
also am I correct in assuming that compiling windows-msi would not work at all except when building on base os windows itself, docker or no docker ?
Is that the full log?
From hover doctor
I can see that your flutter channel is unknown. Please switch to beta, dev or master. That might fix the problem.
Cross-compiling windows-msi is possible from windows, docker and linux or darwin with wine and msi-tools.
okay, even on beta flutter, the linux-deb packaging fails with the same error, windows-msi packaging fails now on beta with:
swapn@Swapnils-MacBook-Pro tomatoroapp % hover build windows-msi --docker
hover: Downloading engine for platform windows-release at version 9a28c3bcf40ce64fee61e807ee3e1395fd6bd954...
hover: Failed to download engine: failed to get Content-Length header: strconv.Atoi: parsing "": invalid syntax
hover: Engine builds are a bit delayed after they are published in flutter.
hover: You can either try again later or switch the flutter channel to beta, because these engines are more likely to be already built.
hover: To dig into the already built engines look at https://github.com/flutter-rs/engine-builds/releases and https://github.com/flutter-rs/engine-builds/actions
Ah I know what the error is. Wait a minute
Yeah some engines builds are not available. The current master engine does work
I updated the PR. If you switch to master channel and try the PR it should work now
Tried with the updated pr after hover clean-cache
,
getting the following error, which seems similar to the windows-msi error I mentioned in the original issue,
swapn@Swapnils-MacBook-Pro tomatoroapp % hover build linux-deb --docker
hover: Using engine from cache
hover: Building using docker container
Running this docker command: /usr/local/bin/docker run --rm --mount type=bind,source=/Users/swapn/Documents/Projects/Tomatoro/tomatoroapp,target=/app --mount type=bind,source=/Users/swapn/Library/Caches/hover/engine,target=/root/.cache/hover/engine --mount type=bind,source=/Users/swapn/Library/Caches/hover/docker-go-cache,target=/go-cache --env GOCACHE=/go-cache --env HOVER_SAFE_CHOWN_UID=501 --env HOVER_SAFE_CHOWN_GID=20 --env GOPROXY=https://proxy.golang.org,direct
--env GOPRIVATE=
goflutter/hover:latest hover-safe.sh build linux-deb --skip-engine-download --version-number 1.0.20+24
docker container: docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /host_mnt/Users/swapn/Library/Caches/hover/engine.
docker container: See 'docker run --help'.
hover: Docker run failed: exit status 125
So somehow the cache directory isn't mounted.
Did hover download the engine? And can you see until which directory /Users/swapn/Library/Caches/hover/engine
exists?
(Btw to get better formatted code blocks use three `)
swapn@Swapnils-MacBook-Pro tomatoroapp % tree /Users/swapn/Library/Caches/hover/engine
/Users/swapn/Library/Caches/hover/engine
├── linux-release
│ ├── dart
│ ├── flutter_patched_sdk
│ │ ├── platform_strong.dill
│ │ ├── platform_strong.dill.d
│ │ └── vm_outline_strong.dill
│ ├── gen
│ │ └── frontend_server.dart.snapshot
│ ├── gen_snapshot
│ ├── icudtl.dat
│ ├── libflutter_engine.so
│ └── version
└── windows-release
4 directories, 9 files
Ok so it exists and looks fine. Somehow docker tries to mount /host_mnt/Users/swapn/Library/Caches/hover/engine
while it actually should mount /Users/swapn/Library/Caches/hover/engine
.
This looks like it is the same: https://github.com/docker/for-mac/issues/4859
that was the cause! Switching to osxfs as mentioned on that issue fixes that error, and the build goes quite a bit far but eventually fails with:
...
docker container: +file:///root/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0-nullsafety.3/lib/src/generated/glyph_set.dart
docker container: +file:///root/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0-nullsafety.3/lib/src/generated/top_level.dart
docker container: +file:///root/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0-nullsafety.3/lib/src/generated/ascii_glyph_set.dart
docker container: +file:///root/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0-nullsafety.3/lib/src/generated/unicode_glyph_set.dart
docker container: +file:///root/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.0-nullsafety.4/lib/src/colors.dart
docker container: 29827ebb-5c72-4a0b-b5f7-e0b0c4a86695 /app/go/build/outputs/linux-release/kernel_snapshot.dill 33775
docker container: hover: Generating kernel snapshot failed: exit status 254
hover: Docker run failed: exit status 1
Can you post the full log of that command?
hover-linux-deb.log its quite long, but here you go. @jld3103
The problem is The specified language version is too high. The highest supported language version is 2.9.
This happens because your local flutter version is higher than the one in the container and resolves packages that support non-nullability. If you switch to the beta channel, run flutter pub upgrade
and then the command again it should work. At least that fixed it for me. Officially go-flutter only supports the beta channel so master is not a good idea as you can see. Sorry for misleading you to that.
That fixed it, thanks for the help @jld3103 !
We can probably merge fix/linux-aot-cross-compilation
, looks like a good fix to me :)
Looks like with the recent updates to hover, its not possible to compile for a platform from different host platform even with the --docker option. Is that the case really ? I am trying to compile ubuntu and windows packages from macOS with the --docker option and I am getting the following output:
For linux-deb:
Also I changed the checks in code to allow running linux-deb packaging with docker option, and on trying to build it, got the following error:
For windows-msi:
Building for linux from docker with macOS shhould be possible since docker on macOS runs inside linux VM. Not sure why the error for windows-msi happens.
hover doctor output: