glutin: `eglCreateWindowSurface` fails after updating to android 10

I originally opened an issue on this in PistonDevelopers/glutin_window#178, but I feel like it would also be appropriate to post here, given that the error occurs while using a glutin_window api which calls a glutin api.

The code that crashes is as follows:

let window: GlutinWindow = WindowSettings::new(
        "rust app", (200.0, 200.0)
    )
    .fullscreen(true)
    .graphics_api(OpenGL::V2_1)
    .build()
    .unwrap();

It reports the following important lines:

BufferQueueProducer: [com.optimistic_peach.trees/android.app.NativeActivity#0] connect: already connected (cur=1 req=1)
libEGL  : eglCreateWindowSurface: native_window_api_connect (win=0x762d44c010) failed (0xffffffea) (already connected to another API?)
libEGL  : eglCreateWindowSurfaceTmpl:729 error 3003 (EGL_BAD_ALLOC)
RustAndroidGlueStdouterr: thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: OsError("eglCreateWindowSurface failed")', src/libcore/result.rs:1084:5

Surrounding logcat information can be seen in PistonDevelopers/glutin_window#178, but it’s mostly a crash dump of the process because of the SIGABRT sent by the os.

Some things to note:

  • My opengles_version_major and opengles_version_minor keys in my Cargo.toml match the OpenGL version I ask for when creating the window.
  • Changing the android or sdk version doesn’t change the result (At least not noticeably)
  • I’ve patched android_glue in every crate I depend on to use the one currently hosted on github, given the one on crates.io is ABI incompatible with what the cargo-apk on github expects. (cargo-apk on github doesn’t work on windows due to command length limitations while calling the linker).
  • To quote the second comment on the other issue:

    According to this page, and this entry, android has changed its egl specification to 1.5

I’d be happy to post some more debug information if necessary if the issue can’t be diagnosed without it.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Screenshot_20191010-213822 It works now. I’ve made some changes to opengl_graphics to get it to work now, but the glutin/glutin-window side is done with the changes to the debug flag.