fyne-io / fyne-cross

Cross compiler tool for Fyne apps
BSD 3-Clause "New" or "Revised" License
234 stars 48 forks source link

Can not build on mac (arm) using vanilla docker desktop #222

Open chran554 opened 6 months ago

chran554 commented 6 months ago

Describe the bug:

Using a vanilla installed docker desktop I can not cross-compile a simple application (hello world).

There seem to be some action performed that is not allowed and it seem to be related to virtioFS used by default on docker desktop.

There is a work around by changing filesystem used by docker from virtioFS to legacy osxfs. (I have not tried the option gRPC FUSE.)

To Reproduce:

Application:

package main

import (
    "fyne.io/fyne/v2"
    "fyne.io/fyne/v2/app"
    "fyne.io/fyne/v2/widget"
)

func main() {
    application := app.New()
    window := application.NewWindow("Hello World")
    window.Resize(fyne.NewSize(400, 200))
    window.SetContent(widget.NewLabel("Hello World"))
    window.ShowAndRun()
}

Command:

fyne-cross linux -arch=amd64,arm64 -app-build=1 -app-id=fynehelloworld.cha.se -app-version=1.0.0 ./cmd/fynehelloworld

Error message:

docker: Error response from daemon: error while creating mount source path '/host_mnt/private/tmp/com.apple.launchd.Or5PfFeCEW/Listeners': mkdir /host_mnt/private/tmp/com.apple.launchd.Or5PfFeCEW/Listeners: operation not supported.
[✗] could not clean the "bin" dir /app/fyne-cross/bin/linux-amd64: exit status 125

Full build log:

$ make cross-linux
fyne-cross linux -arch=amd64,arm64 -app-build=1 -app-id=fynehelloworld.cha.se -app-version=1.0.0 ./cmd/fynehelloworld
[i] Target: linux/amd64
[i] Cleaning target directories...
Unable to find image 'fyneio/fyne-cross-images:linux' locally
linux: Pulling from fyneio/fyne-cross-images
6e498137f0ed: Pull complete 
ce3709d57318: Pull complete 
308007c175c3: Pull complete 
741e74b3aa5f: Pull complete 
4f4fb700ef54: Pull complete 
3bdbe53cc4fe: Pull complete 
2b1b9ff95da4: Pull complete 
d96e1438f891: Pull complete 
9a3eb78d9760: Pull complete 
817f2d8aaafd: Pull complete 
baab12f4b3c6: Pull complete 
d944786b5f39: Pull complete 
Digest: sha256:5a5346bb1a22ee50ff833e5f63dee7e51aeb6b9f34466e892f45f59254805196
Status: Downloaded newer image for fyneio/fyne-cross-images:linux
docker: Error response from daemon: error while creating mount source path '/host_mnt/private/tmp/com.apple.launchd.Or5PfFeCEW/Listeners': mkdir /host_mnt/private/tmp/com.apple.launchd.Or5PfFeCEW/Listeners: operation not supported.
[✗] could not clean the "bin" dir /app/fyne-cross/bin/linux-amd64: exit status 125
make: *** [cross-linux] Error 1

Work around for macOS using vanilla docker desktop

Set your docker file system from virtioFS to osxfs in docker desktop general settings.

image

Device and debug info (please complete the following information):

Device info
Debug info

```
$ make cross-linux
fyne-cross linux -debug -no-cache -arch=amd64,arm64 -app-build=1 -app-id=fynehelloworld.cha.se -app-version=1.0.0 ./cmd/fynehelloworld
[i] Target: linux/amd64
&command.localContainerImage{baseContainerImage:command.baseContainerImage{arch:"amd64", os:"linux", id:"linux-amd64", env:map[string]string{"CC":"zig cc -target x86_64-linux-gnu -isystem /usr/include -L/usr/lib/x86_64-linux-gnu", "CXX":"zig c++ -target x86_64-linux-gnu -isystem /usr/include -L/usr/lib/x86_64-linux-gnu", "GOARCH":"amd64", "GOOS":"linux"}, tags:[]string(nil), mount:[]command.containerMountPoint{command.containerMountPoint{name:"project", localHost:"/Users/christian/projects/code/go/fynehelloworld", inContainer:"/app"}}, DockerImage:"docker.io/fyneio/fyne-cross-images:linux"}, runner:(*command.localContainerEngine)(0x14000096000)}
[i] Cleaning target directories...
/usr/local/bin/docker run --rm -t -w /app -v /Users/christian/projects/code/go/fynehelloworld:/app --platform linux/arm64 -u 501:20 --entrypoint fixuid -v /private/tmp/com.apple.launchd.Or5PfFeCEW/Listeners:/tmp/ssh-agent -e SSH_AUTH_SOCK=/tmp/ssh-agent -e CGO_ENABLED=1 -e GOCACHE=/go/go-build -e GOARCH=amd64 -e CC=zig cc -target x86_64-linux-gnu -isystem /usr/include -L/usr/lib/x86_64-linux-gnu -e CXX=zig c++ -target x86_64-linux-gnu -isystem /usr/include -L/usr/lib/x86_64-linux-gnu -e GOOS=linux docker.io/fyneio/fyne-cross-images:linux rm -rf /app/fyne-cross/bin/linux-amd64
Unable to find image 'fyneio/fyne-cross-images:linux' locally
linux: Pulling from fyneio/fyne-cross-images
6e498137f0ed: Pull complete 
ce3709d57318: Pull complete 
308007c175c3: Pull complete 
741e74b3aa5f: Pull complete 
4f4fb700ef54: Pull complete 
3bdbe53cc4fe: Pull complete 
2b1b9ff95da4: Pull complete 
d96e1438f891: Pull complete 
9a3eb78d9760: Pull complete 
817f2d8aaafd: Pull complete 
baab12f4b3c6: Pull complete 
d944786b5f39: Pull complete 
Digest: sha256:5a5346bb1a22ee50ff833e5f63dee7e51aeb6b9f34466e892f45f59254805196
Status: Downloaded newer image for fyneio/fyne-cross-images:linux
docker: Error response from daemon: error while creating mount source path '/host_mnt/private/tmp/com.apple.launchd.Or5PfFeCEW/Listeners': mkdir /host_mnt/private/tmp/com.apple.launchd.Or5PfFeCEW/Listeners: operation not supported.
[✗] could not clean the "bin" dir /app/fyne-cross/bin/linux-amd64: exit status 125
make: *** [cross-linux] Error 1
```            
Bluebugs commented 6 months ago

Can you try the develop branch?

chran554 commented 6 months ago

I tried the develop branch. It seem to pass the previous virtioFS error and stumbles upon another problem later on. I guess that is another issue or that I am missing something new that is required by the command.

$ fyne-cross version
fyne-cross version v1.4.1-0.20240128213304-5448401b369d

$ make cross-linux  
fyne-cross linux -arch=amd64,arm64 -app-build=1 -app-id=fynehelloworld.cha.se -app-version=1.0.0 ./cmd/fynehelloworld
[i] Target: linux/amd64
[i] Cleaning target directories...
Unable to find image 'fyneio/fyne-cross-images:linux' locally
linux: Pulling from fyneio/fyne-cross-images
6e498137f0ed: Pull complete 
ce3709d57318: Pull complete 
308007c175c3: Pull complete 
741e74b3aa5f: Pull complete 
4f4fb700ef54: Pull complete 
3bdbe53cc4fe: Pull complete 
2b1b9ff95da4: Pull complete 
d96e1438f891: Pull complete 
9a3eb78d9760: Pull complete 
817f2d8aaafd: Pull complete 
baab12f4b3c6: Pull complete 
d944786b5f39: Pull complete 
Digest: sha256:5a5346bb1a22ee50ff833e5f63dee7e51aeb6b9f34466e892f45f59254805196
Status: Downloaded newer image for fyneio/fyne-cross-images:linux
[✓] "bin" dir cleaned: /app/fyne-cross/bin/linux-amd64
[✓] "dist" dir cleaned: /app/fyne-cross/dist/linux-amd64
[✓] "temp" dir cleaned: /app/fyne-cross/tmp/linux-amd64
[i] Checking for go.mod: /Users/christian/projects/code/go/fynehelloworld/go.mod
[✓] go.mod found
[!] Default icon not found at "Icon.png"
[✓] Created a placeholder icon using Fyne logo for testing purpose
[i] Packaging app...
2024/03/02 20:00:26 Fyne error:  Failed to inject metadata init file, omitting metadata
2024/03/02 20:00:26   Cause: invalid character 'g' looking for beginning of value
2024/03/02 20:00:26   At: /go/pkg/mod/fyne.io/fyne/v2@v2.3.5/cmd/fyne/internal/commands/build.go:215
[✓] Package: "/Users/christian/projects/code/go/fynehelloworld/fyne-cross/dist/linux-amd64/fynehelloworld.tar.xz"
[i] Target: linux/arm64
[i] Cleaning target directories...
[✓] "bin" dir cleaned: /app/fyne-cross/bin/linux-arm64
[✓] "dist" dir cleaned: /app/fyne-cross/dist/linux-arm64
[✓] "temp" dir cleaned: /app/fyne-cross/tmp/linux-arm64
[i] Checking for go.mod: /Users/christian/projects/code/go/fynehelloworld/go.mod
[✓] go.mod found
[i] Packaging app...
[✓] Package: "/Users/christian/projects/code/go/fynehelloworld/fyne-cross/dist/linux-arm64/fynehelloworld.tar.xz"
Bluebugs commented 6 months ago

It seems the other issue might be related to your fyne.toml file. Do you mind sharing it?

chran554 commented 6 months ago

Well, thats easy as I do not use/have any toml-file. :) I use command parameters instead. Maybe they have changed? Is toml-file a requirement as of next release?

It seems like it was only a problem for the linux/amd64 build and not for the linus/arm64 build...

Command with parameters:

fyne-cross linux -arch=amd64,arm64 -app-build=1 -app-id=fynehelloworld.cha.se -app-version=1.0.0 ./cmd/fynehelloworld
0x414a commented 6 months ago

Compilation is no problem before, this time I also encountered this error

0x414a commented 6 months ago

fyne-cross linux -arch arm64 .
[i] Target: linux/arm64 [i] Cleaning target directories... docker: Error response from daemon: error while creating mount source path '/host_mnt/private/tmp/com.apple.launchd.uFB91mWBaB/Listeners': mkdir /host_mnt/private/tmp/com.apple.launchd.uFB91mWBaB/Listeners: operation not supported. [✗] could not clean the "bin" dir /app/fyne-cross/bin/linux-arm64: exit status 125

Klaus-Tockloth commented 6 months ago

Same problem:

[i] Cleaning target directories...
docker: Error response from daemon: error while creating mount source path '/host_mnt/private/tmp/com.apple.launchd.2pek1t4ePk/Listeners': mkdir /host_mnt/private/tmp/com.apple.launchd.2pek1t4ePk/Listeners: operation not supported.
[✗] could not clean the "dist" dir /app/fyne-cross/dist/linux-amd64: exit status 125

But already mentioned workaround works:

Bildschirmfoto 2024-03-05 um 11 09 09
andydotxyz commented 6 months ago

Is toml-file a requirement as of next release?

No, the toml file remains optional

pinpox commented 3 months ago

I'm still running into this. Was a solution ever found?

Digest: sha256:f4194bdf6a5bd72b077a4d853d1c74400c485c79dee83e490056787c17d54b47
Status: Downloaded newer image for fyneio/fyne-cross-images:windows
[✓] "temp" dir cleaned: /app/fyne-cross/tmp/windows-amd64
[✓] "bin" dir cleaned: /app/fyne-cross/bin/windows-amd64
[✓] "dist" dir cleaned: /app/fyne-cross/dist/windows-amd64
[i] Checking for go.mod: /home/runner/work/tmx-uploader/tmx-uploader/go.mod
[✓] go.mod found
[i] Packaging app...
2024/05/15 08:20:51 Fyne error:  Failed to inject metadata init file, omitting metadata
2024/05/15 08:20:51   Cause: invalid character 'g' looking for beginning of value
2024/05/15 08:20:51   At: /go/pkg/mod/fyne.io/fyne/v2@v2.3.5/cmd/fyne/internal/commands/build.go:215
  adding: tmx-uploader.exe (deflated 46%)
andydotxyz commented 3 months ago

That looks like a very different issue - basically a corrupt metadata file. If you think the problem is with Fyne-cross then please open a new issue.