Skip to content

Android build breaks due to glutin/EGL #3513

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

Closed
schulzch opened this issue Feb 21, 2023 · 2 comments
Closed

Android build breaks due to glutin/EGL #3513

schulzch opened this issue Feb 21, 2023 · 2 comments

Comments

@schulzch
Copy link

Currently, I'm trying to build WGPU for Android targets using cargo apk build (wgpu ="0.15.1" with ndk-glue = "0.7.0"). However, the build fails with:

   Compiling glutin v0.27.0
error[E0423]: expected value, found struct `ffi::egl::Egl`
   --> CARGO_REGISTRY_PATH\registry\src\github.com-1ecc6299db9ec823\glutin-0.27.0\src\api\egl\mod.rs:102:20  
    |
102 |             Ok(Egl(ffi::egl::Egl))
    |                    ^^^^^^^^^^^^^
    |
   ::: PROJECT_PATH\target\aarch64-linux-android\debug\build\glutin_egl_sys-9d0e9abcc9394622\out/egl_bindings.rs:318:9
    |
318 |         pub struct Egl {
    |         -------------- `ffi::egl::Egl` defined here
    |
help: use struct literal syntax instead
    |
102 |             Ok(Egl(ffi::egl::Egl { BindAPI: val, BindTexImage: val, ChooseConfig: val, ClientWaitSync: val, CopyBuffers: val, CreateContext: val, CreateImage: val, CreatePbufferFromClientBuffer: val, CreatePbufferSurface: val, CreatePixmapSurface: val, CreatePlatformPixmapSurface: val, CreatePlatformPixmapSurfaceEXT: val, CreatePlatformWindowSurface: val, CreatePlatformWindowSurfaceEXT: val, CreateSync: val, CreateWindowSurface: val, DestroyContext: val, DestroyImage: val, DestroySurface: val, DestroySync: val, GetConfigAttrib: val, GetConfigs: val, GetCurrentContext: val, GetCurrentDisplay: val, GetCurrentSurface: val, GetDisplay: val, GetError: val, GetPlatformDisplay: val, GetPlatformDisplayEXT: val, GetProcAddress: val, GetSyncAttrib: val, Initialize: val, MakeCurrent: val, QueryAPI: val, QueryContext: val, QueryString: val, QuerySurface: val, ReleaseTexImage: val, ReleaseThread: val, SurfaceAttrib: val, SwapBuffers: val, SwapBuffersWithDamageKHR: val, SwapInterval: val, Terminate: val, WaitClient: val, WaitGL: val, WaitNative: val, WaitSync: val, _priv: val }))
    |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: consider importing this tuple struct instead
    |
95  |     use crate::api::egl::Egl;
    |
help: if you import `Egl`, refer to it directly
    |
102 -             Ok(Egl(ffi::egl::Egl))
102 +             Ok(Egl(Egl))
    |

error[E0277]: `*const c_void` cannot be shared between threads safely
   --> CARGO_REGISTRY_PATH\registry\src\github.com-1ecc6299db9ec823\glutin-0.27.0\src\api\egl\mod.rs:149:1
    |
149 | / lazy_static! {
150 | |     pub static ref EGL: Option<Egl> = Egl::new().ok();
151 | | }
    | |_^ `*const c_void` cannot be shared between threads safely
    |
    = help: within `Option<api::egl::egl::Egl>`, the trait `Sync` is not implemented for `*const c_void`
    = note: required because it appears within the type `FnPtr`
    = note: required because it appears within the type `glutin_egl_sys::egl::Egl`
note: required because it appears within the type `api::egl::egl::Egl`
   --> CARGO_REGISTRY_PATH\registry\src\github.com-1ecc6299db9ec823\glutin-0.27.0\src\api\egl\mod.rs:98:16
    |
98  |     pub struct Egl(pub ffi::egl::Egl);
    |                ^^^
    = note: required because it appears within the type `Option<api::egl::egl::Egl>`
note: required by a bound in `Lazy`
   --> CARGO_REGISTRY_PATH\registry\src\github.com-1ecc6299db9ec823\lazy_static-1.4.0\src\inline_lazy.rs:19:20
    |
19  | pub struct Lazy<T: Sync>(Cell<Option<T>>, Once);
    |                    ^^^^ required by this bound in `Lazy`
    = note: this error originates in the macro `__lazy_static_create` which comes from the expansion of the macro `lazy_static` (in Nightly builds, run with -Z macro-backtrace for more info)

Some errors have detailed explanations: E0277, E0423.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `glutin` due to 2 previous errors

I'm guessing that this could be compiler-related regression (rustc 1.67.1 (d5a82bbd2 2023-02-07)) since previous versions of wgpu worked on Android at some point.

Can I compile wgpu without EGL support? We plan to use Vulkan only anyway.

What would be the "correct way" to fix this issue?

@teoxoy
Copy link
Member

teoxoy commented Feb 21, 2023

This is an issue with glutin, see rust-windowing/glutin#1307 - you should update to v0.29.

Can I compile wgpu without EGL support? We plan to use Vulkan only anyway.

Not as of right now but see #3514.

@teoxoy teoxoy closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2023
@schulzch
Copy link
Author

Thanks, that was the pointer I needed. I could fix the problem using cargo tree | rg glutin -C 100, doing some very selective dependency updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants