fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
24.77k stars 1.37k forks source link

[Bug]: Fyne doesn't compile on termux. #5173

Open DuilioPerez opened 3 days ago

DuilioPerez commented 3 days ago

Checklist

Describe the bug

I've followed the instructions from your getting start page to install fyne in Termux, but I've found some issues: 1 - It can't compile programs directly for Termux: 2 - Android API level used is too low:

How to reproduce

1: Run go build in the firs example app 2: Install an app

Screenshots

1: Screenshot_2024-09-29_14-30-59

2: Screenshot_20240929-143749_WhatsApp

Example code

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

func main() {
  a := app.New()
  w := a.NewWindow("Hello World")
  w.SetContent(widget.NewLabel("Hello World!"))
  w.ShowAndRun()
}

Fyne version

fyne cli version: (devel)

Go compiler version

go version go1.23.1 android/arm64

Operating system and version

Android 11

Additional Information

No response

andydotxyz commented 2 days ago

Fyne version

fyne cli version: (devel)

Please list the library version not the cli.

More info:

Please share what is at line 136 of /usr/include/EGL/egl.h - the specification states that it is implementation specific but obviously for many platforms it is working, so we need to see what yours is expecting.

andydotxyz commented 2 days ago

Correcting title as this is compile specific. If you compiled the android app elsewhere and copied it on then it would execute as far as I can see.

andydotxyz commented 2 days ago

Oh, hold on - isn't termux a linux emulator for Android? In that case you should probably try "fyne package -os linux" because it's trying to build an android app from a linux terminal.

DuilioPerez commented 2 days ago

Oh, hold on - isn't termux a linux emulator for Android? In that case you should probably try "fyne package -os linux" because it's trying to build an android app from a linux terminal.

That command have the same error. Termux is an Android Linux emulator, but it uses bionic instead of glibc. It's default compiles for linux-android.

The content of line 136 is: EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);

DuilioPerez commented 2 days ago

And the other issue is about Android API Level too low

DuilioPerez commented 2 days ago

Fyne version is 2.5.1

andydotxyz commented 2 days ago

The content of line 136 is: EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);

Thanks, and what is the definition of EGLNativeWindowType on that platform (also, where is it defined?)

And the other issue is about Android API Level too low

Google Play Protect hates our backwards compatibility - it is not a problem, just a nuisance.

DuilioPerez commented 2 days ago

There is a related issue, maybe that information can help: https://github.com/hajimehoshi/ebiten/issues/3057

DuilioPerez commented 2 days ago

And with the issue related to API Level, it could be usefull to have a way to use a API Level which allow external distributions. Maybe an option on the CLI tool.

andydotxyz commented 1 day ago

it could be usefull to have a way to use a API Level which allow external distributions.

It is not clear what distribution is blocked by our backwards compatibility.

DuilioPerez commented 1 day ago

Well, it seems google play blocks apps according to the used target sdk. So isn't the minimun API Level what needs to be updated but the target sdk, acording to the Android SDK documentation, which is updated every year, so that's the only which need to be updated.

andydotxyz commented 1 day ago

It is not blocked - it is a warning that you can accept.

Our target SDK is above the minimum required. If it wasn't then Google would have removed the listing from the store.

"Google Play Protect" is a level above what is required by the store if I understand it correctly. Apps using the latest fyne should always be compliant with the published policies.

andydotxyz commented 1 day ago

That command have the same error. Termux is an Android Linux emulator, but it uses bionic instead of glibc. It's default compiles for linux-android.

Then please try setting GOOS=linux. I can tell it is compiling for Android because it is linking to the mobile driver...