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

internal/graphicsdriver/opengl/gl: crash on Galaxy A02s #3052

Closed
1 of 11 tasks
hajimehoshi opened this issue Jul 31, 2024 · 8 comments
Closed
1 of 11 tasks

internal/graphicsdriver/opengl/gl: crash on Galaxy A02s #3052

hajimehoshi opened this issue Jul 31, 2024 · 8 comments

Comments

@hajimehoshi
Copy link
Owner

Ebitengine Version

v2.8.0-alpha.2

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

Go Version (go version)

go version go1.22.4 darwin/arm64

What steps will reproduce the problem?

Run an Android application with Ebitengine on Galaxy A02s

What is the expected result?

No crash

What happens instead?

Crash on launching

java.lang.RuntimeException: "gl: failed to load libGL.so and libGLESv2.so"
     FATAL EXCEPTION: main
Process: com.rpgsnack.dreams, PID: 2892
java.lang.RuntimeException: "gl: failed to load libGL.so and libGLESv2.so"
	at com.rpgsnack.tsugunai.RuntimeView.handleError(RuntimeView.java:263)
	at com.rpgsnack.tsugunai.RuntimeView.onErrorOnGameUpdate(RuntimeView.java:253)
	at com.rpgsnack.runtime.mobile.EbitenSurfaceView.onErrorOnGameUpdate(EbitenSurfaceView.java:99)
	at com.rpgsnack.runtime.mobile.EbitenSurfaceView.access$000(EbitenSurfaceView.java:31)
	at com.rpgsnack.runtime.mobile.EbitenSurfaceView$EbitenRenderer$1.run(EbitenSurfaceView.java:53)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:226)
	at android.os.Looper.loop(Looper.java:313)
	at android.app.ActivityThread.main(ActivityThread.java:8751)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Anything else you feel useful to add?

I've confirmed this on Firebase Test Lab with our Ebitengine application.

@hajimehoshi hajimehoshi added this to the v2.7.9 milestone Jul 31, 2024
@hajimehoshi hajimehoshi changed the title internal/graphicsdriver/opengl/gl: crash on internal/graphicsdriver/opengl/gl: crash on Galaxy A02s Jul 31, 2024
@hajimehoshi
Copy link
Owner Author

With Ebitengine 856b339:

java.lang.RuntimeException: "gl: failed to load libGL.so and libGLESv2.so: libGLESv2.so: dlopen failed: invalid flags to dlopen: 101, libGLESv2.so.2: dlopen failed: invalid flags to dlopen: 101, libGLESv2.so.1: dlopen failed: invalid flags to dlopen: 101, libGLESv2.so.0: dlopen failed: invalid flags to dlopen: 101"
     FATAL EXCEPTION: main
Process: com.rpgsnack.dreams, PID: 1995
java.lang.RuntimeException: "gl: failed to load libGL.so and libGLESv2.so: libGLESv2.so: dlopen failed: invalid flags to dlopen: 101, libGLESv2.so.2: dlopen failed: invalid flags to dlopen: 101, libGLESv2.so.1: dlopen failed: invalid flags to dlopen: 101, libGLESv2.so.0: dlopen failed: invalid flags to dlopen: 101"
	at com.rpgsnack.tsugunai.RuntimeView.handleError(RuntimeView.java:263)
	at com.rpgsnack.tsugunai.RuntimeView.onErrorOnGameUpdate(RuntimeView.java:253)
	at com.rpgsnack.runtime.mobile.EbitenSurfaceView.onErrorOnGameUpdate(EbitenSurfaceView.java:99)
	at com.rpgsnack.runtime.mobile.EbitenSurfaceView.access$000(EbitenSurfaceView.java:31)
	at com.rpgsnack.runtime.mobile.EbitenSurfaceView$EbitenRenderer$1.run(EbitenSurfaceView.java:53)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:226)
	at android.os.Looper.loop(Looper.java:313)
	at android.app.ActivityThread.main(ActivityThread.java:8751)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

@hajimehoshi
Copy link
Owner Author

https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/dlfcn.h

My guess is that __LP64__ is not defined on this device, but I am not 100% sure.

/CC @TotallyGamerJet

@hajimehoshi
Copy link
Owner Author

Even with C's RTLD definitions, another crash happened.

Build fingerprint: 'samsung/a02qnnxx/a02q:12/SP1A.210812.016/A025FXXU6CWE2:user/release-keys'
Revision: '0'
ABI: 'arm'
Processor: '-1'
Timestamp: 2024-07-31 11:44:27.440401246-0700
Process uptime: 167s
Cmdline: com.rpgsnack.dreams
pid: 15685, tid: 20768, name: GLThread 566  >>> com.rpgsnack.dreams <<<
uid: 10241
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x18
Cause: null pointer dereference
    r0  88761020  r1  00000018  r2  00000018  r3  00000000
    r4  00000018  r5  00000001  r6  78ba92e0  r7  00000018
    r8  bb8e2f9c  r9  bb8e18c0  r10 00000004  r11 00001405
    ip  e41ce9d0  sp  85692af8  lr  c9a0d649  pc  e4172534
backtrace:
      #00 pc 00062534  /apex/com.android.runtime/lib/bionic/libc.so (__memcpy_a53+152) (BuildId: 775d2b96242725b513297af37a26150c)
      #01 pc 000b3645  /vendor/lib/egl/libGLESv2_adreno.so (!!!0000!77df12deb6a622478efa8fb9929034!5441528417!+456) (BuildId: 638d93a8f2e34d08525f24261b1b7723)
      #02 pc 000edd2b  /vendor/lib/egl/libGLESv2_adreno.so (!!!0000!fd7498413de80da11b66fb6ac2c9ef!5441528417!+146) (BuildId: 638d93a8f2e34d08525f24261b1b7723)
      #03 pc 0004a22f  /vendor/lib/egl/libGLESv2_adreno.so (glDrawElements+42) (BuildId: 638d93a8f2e34d08525f24261b1b7723)
      #04 pc 00c415d4  /data/app/~~qZoibUQJ8Abn2b1Yny8m4A==/com.rpgsnack.dreams-hSUawpgAcFjmhm2oLjoGgQ==/split_config.armeabi_v7a.apk (syscall15+156)

I'll try to replace all the dlopen part with C version later.

@hajimehoshi hajimehoshi modified the milestones: v2.7.9, v2.8.0 Jul 31, 2024
@hajimehoshi
Copy link
Owner Author

@TotallyGamerJet
Copy link
Contributor

A quick solution is to just revert the change in procaddr_linbsd. I wonder if this is a sign that arguments are not being passed correctly in arm64. Perhaps trying purego.SyscallN instead of RegisterFunc. It’s unclear from the last error if this is a call to an OpenGL function or to Dlopen

@hajimehoshi
Copy link
Owner Author

I've confirmed that the fix worked on Test Lab.

@hajimehoshi
Copy link
Owner Author

hajimehoshi commented Aug 1, 2024

I've almost reverted the Android part, but not non-Android Linux part. So, there might still be an issue on Linux, but I don't know what machines an issue. On Linux, the constants RTLD_* always seem the same, so this might be different from Android.

@hajimehoshi
Copy link
Owner Author

https://community.infiniteflight.com/t/i-cannot-download-if-because-its-not-compatible/710435/4

This is due to your device’s OS. Despite your processor being a 64-bit model, which is now a requirement for Infinite Flight to be installed, your phone has a 32-bit version of Android. Why Samsung has done it for this device is beyond me, however, it means that you will not be able to install IF on your Samsung Galaxy A02s, as your phone is recognized as a 32-bit one.

hajimehoshi added a commit that referenced this issue Aug 5, 2024
This is basically a revert for 297efea.
This updates PureGo for the Android issue.

Updates #3052
Updates ebitengine/purego#262
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants