Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chran554 opened this issue Mar 2, 2024 · 10 comments
Open

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

chran554 opened this issue Mar 2, 2024 · 10 comments

Comments

@chran554
Copy link

chran554 commented Mar 2, 2024

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
  • OS: macOS Sonoma v14.2.1 (23C71)
  • OS architecture: arm
  • Go version: go version go1.21.3 darwin/arm64
  • fyne-cross version: fyne-cross version v1.4.0
  • Fyne version: fyne cli version: v2.4.4
  • Docker desktop version: 4.28.0 (139021)
    • Engine: 25.0.3, Compose: v2.24.6-desktop.1, Credential Helper: v0.8.1, Kubernetes: v1.29.1
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
Copy link
Contributor

Bluebugs commented Mar 2, 2024

Can you try the develop branch?

@chran554
Copy link
Author

chran554 commented Mar 2, 2024

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
Copy link
Contributor

Bluebugs commented Mar 2, 2024

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

@chran554
Copy link
Author

chran554 commented Mar 2, 2024

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
Copy link

0x414a commented Mar 4, 2024

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

@0x414a
Copy link

0x414a commented Mar 4, 2024

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
Copy link

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
Copy link
Member

Is toml-file a requirement as of next release?

No, the toml file remains optional

@pinpox
Copy link

pinpox commented May 15, 2024

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants