fyne-io/fyne · critical
eglGetDisplay failed\n
Error message
eglGetDisplay failed\n
What it means
After opening the X display, x11.c calls eglGetDisplay(x_dpy) to obtain the EGL display for it. Returning EGL_NO_DISPLAY means the installed EGL could not adopt this X display: missing X11 EGL platform libraries, or an EGL stack that only supports other platforms (surfaceless, wayland, device). The process prints 'eglGetDisplay failed' and exits(1).
Source
Thrown at internal/driver/mobile/app/x11.c:106
return win;
}
Display *x_dpy;
EGLDisplay e_dpy;
EGLContext e_ctx;
EGLSurface e_surf;
Window win;
void
createWindow(void) {
x_dpy = XOpenDisplay(NULL);
if (!x_dpy) {
fprintf(stderr, "XOpenDisplay failed\n");
exit(1);
}
e_dpy = eglGetDisplay(x_dpy);
if (!e_dpy) {
fprintf(stderr, "eglGetDisplay failed\n");
exit(1);
}
EGLint e_major, e_minor;
if (!eglInitialize(e_dpy, &e_major, &e_minor)) {
fprintf(stderr, "eglInitialize failed\n");
exit(1);
}
eglBindAPI(EGL_OPENGL_ES_API);
win = new_window(x_dpy, e_dpy, 500, 1000, &e_ctx, &e_surf);
wm_delete_window = XInternAtom(x_dpy, "WM_DELETE_WINDOW", True);
if (wm_delete_window != None) {
XSetWMProtocols(x_dpy, win, &wm_delete_window, 1);
}
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(e_dpy, e_surf, e_surf, e_ctx)) {
fprintf(stderr, "eglMakeCurrent failed\n");View on GitHub (pinned to 8860ee95c3)
Solutions
- Install the Mesa X11 EGL platform pieces: apt install libegl1 libegl-mesa0 libglvnd0 libgl1-mesa-dri
- Force platform selection: EGL_PLATFORM=x11 ./yourapp
- Update Mesa/glvnd to repair ICD discovery (check /usr/share/glvnd/egl_vendor.d)
- On Xwayland sessions, prefer running the Wayland-native path or full Mesa software rendering
Example fix
# before: EGL cannot adopt the X display ./yourapp # eglGetDisplay failed # after: install X11 EGL platform modules and pin the platform sudo apt install libegl1 libegl-mesa0 libglvnd0 EGL_PLATFORM=x11 ./yourapp
Defensive patterns
Strategy: validation
Validate before calling
func eglDisplayPreflight() error {
if err := displayPreflight(); err != nil {
return err
}
if _, err := os.Stat("/usr/lib/x86_64-linux-gnu/libEGL_mesa.so.0"); err != nil {
return fmt.Errorf("Mesa X11 EGL platform missing; install libegl-mesa0 libglvnd0")
}
return nil
} Prevention
- Install libegl-mesa0 and glvnd components together with libEGL
- Set EGL_PLATFORM=x11 explicitly in launch scripts
- On Wayland-only hosts, install Xwayland plus the x11 EGL platform modules
When it happens
Trigger: eglGetDisplay on a valid X display failing because the X11 platform glue (libEGL_x11 / Mesa platform modules) is absent, EGL vendor libraries are misconfigured (glvnd ICDs), or EGL only supports Wayland/surfaceless on this install.
Common situations: Containers with libEGL but without libegl-mesa0/platform modules; Wayland-only stacks where X apps go through Xwayland but EGL vendor libs lack the x11 platform; broken glvnd configurations after partial driver installs.
Related errors
- eglGetConfigAttrib failed\n
- eglChooseConfig failed\n
- eglCreateContext failed\n
- eglCreateWindowSurface failed\n
- eglInitialize failed\n
AI-assisted analysis of fyne-io/fyne@8860ee95c3 (2026-08-15).
Data as JSON: /api/errors/a13af9401cb5d975.
Report an issue: GitHub.