Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

glfwInit fails with error 65544 on Linux

ErrorGLFW error 65544

Short answer

65544 is GLFW_PLATFORM_ERROR, a catch-all code. The text GLFW passes to your error callback names the real reason. On Linux it is most often a missing or unreachable X display, or libX11 that cannot be loaded. Register the callback before glfwInit and read the message.

  • Applies to GLFW 3.3 and 3.4, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print GLFW's own message. Set the error callback before glfwInit, because the code alone (0x00010008) does not say what failed.

    glfwSetErrorCallback([](int code, const char* msg) {
        fprintf(stderr, "GLFW error 0x%08X: %s\n", code, msg);
    });
    if (!glfwInit()) return -1;
  2. 2Match what you see, then jump to its fix

    1. 1X11: The DISPLAY environment variable is missingNo DISPLAY in the environment (SSH, container or service)Fix
    2. 2X11: Failed to open display :0 (the value is whatever DISPLAY holds)DISPLAY is set but the X server refuses or does not existFix
    3. 3X11: Failed to load Xlib (code 65544)libX11 cannot be loadedFix
    4. 4glfwInit fails on a remote or virtual display, after X itself openedThe X server does not offer GLX 1.3Fix

What does the error look like?

  • GLFW error 65544
  • Failed to initialize GLFW
  • X11: The DISPLAY environment variable is missing
  • X11: Failed to open display

Cause 1 of 4

No DISPLAY in the environment (SSH, container or service)

1Check

GLFW calls XOpenDisplay with no argument, and if that fails and DISPLAY is unset it reports exactly this message. Plain SSH sessions, containers and systemd services usually have no DISPLAY. In GLFW 3.4 and later this case is reported as GLFW_PLATFORM_UNAVAILABLE (0x0001000E, 65550) rather than 65544.

echo "DISPLAY=[$DISPLAY]"
ls /tmp/.X11-unix/

2Fix

Run the program in a session that has a display, or set DISPLAY to a display you are allowed to use. For tests that need no real window, GLFW has a Null platform you request explicitly with the GLFW_PLATFORM init hint.

export DISPLAY=:0

// before glfwInit, for window-less tests only
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_NULL);

3Verify

glfwInit returns true and glfwGetPlatform reports the platform you expect.

./your-program

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 4

DISPLAY is set but the X server refuses or does not exist

1Check

DISPLAY points to a display GLFW cannot open: the number is wrong, the X server is not running, or the user has no access to it.

echo "$DISPLAY"
ls /tmp/.X11-unix/

2Fix

Use the display that actually exists in /tmp/.X11-unix (X0 means :0), run the program as the user who owns that session, or start the program inside the desktop session.

DISPLAY=:0 ./your-program

3Verify

glfwInit returns true.

DISPLAY=:0 ./your-program

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 3 of 4

libX11 cannot be loaded

1Check

GLFW opens libX11.so.6 at run time. On a minimal system or container it may be absent.

ldconfig -p | grep libX11.so.6

2Fix

Install the X11 client library package for your distribution, or build and run the program on a machine that has it.

# nothing printed above means libX11.so.6 is missing: install your distribution's libx11 runtime package

3Verify

ldconfig lists libX11.so.6 and glfwInit succeeds.

ldconfig -p | grep libX11.so.6

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 4 of 4

The X server does not offer GLX 1.3

1Check

GLFW's compatibility notes say GLX 1.3 is required on Linux and that glfwInit fails without it. Remote X displays and bare virtual servers often lack it.

glxinfo | grep -i 'glx version'

2Fix

Run on a display with working GLX (a local session with a GPU driver), not over a plain remote X connection.

# run the program from the local desktop session

3Verify

glxinfo reports GLX version 1.3 or higher.

glxinfo | grep -i 'glx version'

Confirmed by glfw.org

Did this fix it?

How do I stop it coming back?

  • Register glfwSetErrorCallback first in every program; GLFW reports the real reason there.
  • In CI, run window tests inside a session with a display, or use the Null platform for tests that need no window.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.