to force the Wayland backend, we need to export EGL_PLATFORM=wayland SDL_VIDEODRIVER=wayland. Unfortunately Anbox doesn't work with it.
[ 2020-03-08 11:46:03] [Renderer.cpp:131@initialize] Failed to select EGL configurationStack trace (most recent call last) in thread 27758:#2 Object "/lib/ld-musl-x86_64.so.1", at 0x7fc49a1e227c, in#1 Object "/usr/bin/anbox", at 0x5637247e875e, in backward::SignalHandling::sig_handler(int, siginfo_t*, void*)#0 Object "/usr/bin/anbox", at 0x5637247e85af, in backward::SignalHandling::handleSignal(int, siginfo_t*, void*)zsh: segmentation fault anbox session-manager
I could reproduce this error with both Intel driver on x86_64 with Sway and Pinephone with Plasma Mobile.
This is apparently caused by the requirement of Anbox on pbuffers. Since every available EGL configuration doesn't support it, because wayland EGL doesn't implement EGL, there is no EGL configuration that can be selected. I've tried working around it a bit, but I always had segfaults either in the session-manager or inside Android's surfaceflinger.
I tried on my computer, but I didn't see the same result:
[ 2020-03-08 23:08:46] [Renderer.cpp:170@initialize] Using a surfaceless EGL context[ 2020-03-08 23:08:46] [Renderer.cpp:203@initialize] Failed: Initialize set of configs
And the session manager doesn't segfault. Instead, it SIGABRT inside the image: Abort message: 'no suitable EGLConfig found, giving up'
03-08 22:52:02.931 4088 4088 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***03-08 22:52:02.931 4088 4088 F DEBUG : Build fingerprint: 'Android/anbox_x86_64/x86_64:7.1.2/N2G47J/lambda02221206:userdebug/test-keys'03-08 22:52:02.931 4088 4088 F DEBUG : Revision: '0'03-08 22:52:02.931 4088 4088 F DEBUG : ABI: 'x86_64'03-08 22:52:02.932 4088 4088 F DEBUG : pid: 4077, tid: 4077, name: surfaceflinger >>> /system/bin/surfaceflinger <<<03-08 22:52:02.932 4088 4088 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------03-08 22:52:02.933 4088 4088 F DEBUG : Abort message: 'no suitable EGLConfig found, giving up'03-08 22:52:02.933 4088 4088 F DEBUG : rax 0000000000000000 rbx 00007f613abb6be8 rcx 00007f613a6a4987 rdx 000000000000000603-08 22:52:02.933 4088 4088 F DEBUG : rsi 0000000000000fed rdi 0000000000000fed03-08 22:52:02.933 4088 4088 F DEBUG : r8 00007ffce49b1080 r9 00007ffce498d758 r10 0000000000000008 r11 000000000000020603-08 22:52:02.933 4088 4088 F DEBUG : r12 0000000000000fed r13 0000000000000006 r14 00007f613a441a6a r15 00007ffce498ded003-08 22:52:02.933 4088 4088 F DEBUG : cs 0000000000000033 ss 000000000000002b03-08 22:52:02.933 4088 4088 F DEBUG : rip 00007f613a6a4987 rbp 0000000000000016 rsp 00007ffce498d798 eflags 000000000000020603-08 22:52:02.935 4088 4088 F DEBUG :03-08 22:52:02.935 4088 4088 F DEBUG : backtrace:03-08 22:52:02.935 4088 4088 F DEBUG : #00 pc 000000000008d987 /system/lib64/libc.so (tgkill+7)03-08 22:52:02.935 4088 4088 F DEBUG : #01 pc 000000000008a421 /system/lib64/libc.so (pthread_kill+65)03-08 22:52:02.935 4088 4088 F DEBUG : #02 pc 00000000000302c1 /system/lib64/libc.so (raise+17)03-08 22:52:02.935 4088 4088 F DEBUG : #03 pc 00000000000287dd /system/lib64/libc.so (abort+77)03-08 22:52:02.935 4088 4088 F DEBUG : #04 pc 000000000001064f /system/lib64/libcutils.so (__android_log_assert+287)03-08 22:52:02.935 4088 4088 F DEBUG : #05 pc 000000000003d92d /system/lib64/libsurfaceflinger.so03-08 22:52:02.935 4088 4088 F DEBUG : #06 pc 000000000003d345 /system/lib64/libsurfaceflinger.so03-08 22:52:02.936 4088 4088 F DEBUG : #07 pc 0000000000043278 /system/lib64/libsurfaceflinger.so (_ZN7android14SurfaceFlinger4initEv+936)03-08 22:52:02.936 4088 4088 F DEBUG : #08 pc 000000000000130d /system/bin/surfaceflinger03-08 22:52:02.936 4088 4088 F DEBUG : #09 pc 000000000001c934 /system/lib64/libc.so (__libc_init+84)03-08 22:52:02.936 4088 4088 F DEBUG : #10 pc 00000000000011c4 /system/bin/surfaceflinger03-08 22:52:02.936 4088 4088 F DEBUG : #11 pc 0000000000000000 <unknown>03-08 22:52:02.954 13 13 W : debuggerd: resuming target 407703-08 22:52:02.959 32 32 I ServiceManager: service 'media.audio_flinger' died03-08 22:52:02.959 32 32 I ServiceManager: service 'media.audio_policy' died03-08 22:52:02.959 32 32 I ServiceManager: service 'media.sound_trigger_hw' died03-08 22:52:02.959 32 32 I ServiceManager: service 'media.radio' died03-08 22:52:02.960 32 32 I ServiceManager: service 'media.player' died03-08 22:52:02.960 32 32 I ServiceManager: service 'media.resource_manager' died03-08 22:52:02.960 32 32 I ServiceManager: service 'netd' died03-08 22:52:02.970 40 40 E : eof03-08 22:52:02.970 40 40 E : failed to read size03-08 22:52:02.970 40 40 I : closing connection03-08 22:52:02.970 32 32 I ServiceManager: service 'batterystats' died03-08 22:52:02.970 32 32 I ServiceManager: service 'appops' died03-08 22:52:02.970 32 32 I ServiceManager: service 'power' died03-08 22:52:02.970 32 32 I ServiceManager: service 'display' died
> Maybe you can use surfaceless EGL with an FBO.>> When the KHR_surfaceless_gles2 extension is present you should be able> to do eglMakeCurrent with only an EGLContext and no EGLSurface.If you're using the wayland egl platform you can just create a dummywl_egl_window and then create an EGL window surface for that.
After reading that mozilla commit the solution looks to be to not try to select EGL config with pbuffers, and do not use pbuffers later at all (use wayland surfaces instead, that are created differently)
I managed to go past the EGL configuration selection several times, but then it segfaults inside the image. I hope that doesn't mean the Android image should be fixed. Between the sheer requirements in size, the compilation time and the glibc dependency, that wouldn't seem fun to debug.