fyne-io / fyne-cross

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

Can't build Android app on ARM macOS: image platform (linux/amd64) does not match the expected platform (linux/arm64) #219

Open fortuna opened 7 months ago

fortuna commented 7 months ago

Describe the bug:

I can't build an Android app on a macOS with ARM architecture using fyne-cross. I get a image platform (linux/amd64) does not match the expected platform (linux/arm64).

Perhaps fyne-cross is not passing the right --arch flag to podman, but there doesn't seem to be a way to inject that.

To Reproduce:

After setting up podman:

$ go run github.com/fyne-io/fyne-cross@v1.4.0 android -app-id com.example.myapp
[i] Target: android/multiple
[i] Cleaning target directories...
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)
Error: statfs /private/var/folders/xt/gf42hf7x0wv8vstytl5989580000gn/T/ssh-hCLXh1SiTJ5Y/agent.39888: operation not supported
[✗] could not clean the "bin" dir /app/fyne-cross/bin/android: exit status 125
exit status 1

This is my system info:

$ uname -a
Darwin [REDACTED] 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64
$ go version
go version go1.20.4 darwin/arm64
Bluebugs commented 7 months ago

We currently do not support building for Android from an ARM host. I don't know if it is still the case, but when we looked at it a year ago or so, there was no way to run Android NDK on an ARM host.

I think to address your bug report, we should:

andydotxyz commented 7 months ago

I'm sure this was working for me this week. Can you try the latest fyne-cross changes?

I think building from Linux arm is still not supported.

Bluebugs commented 7 months ago

It would be interesting if you can investigate your setup and see how docker can run any AMD64 image on ARM64 as that what we currently provide for Android.

That being said, Google is now releasing an Android NDK compatible with ARM64. I have created an issue for this here: https://github.com/fyne-io/fyne-cross-images/issues/42 .

andydotxyz commented 7 months ago

Oh I'm sorry I missed that this was a fyne-cross bug.

Using the builtin Fyne tools with Android SDK is what works, fyne-cross does not, sorry for the confusion.