glfwInit fails with error 65544 on Linux
GLFW error 65544Short 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.
Fix it fast
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;2Match what you see, then jump to its fix
- 1
X11: The DISPLAY environment variable is missingNo DISPLAY in the environment (SSH, container or service)Fix - 2
X11: Failed to open display :0 (the value is whatever DISPLAY holds)DISPLAY is set but the X server refuses or does not existFix - 3
X11: Failed to load Xlib (code 65544)libX11 cannot be loadedFix - 4
glfwInit fails on a remote or virtual display, after X itself openedThe X server does not offer GLX 1.3Fix
- 1
What does the error look like?
GLFW error 65544Failed to initialize GLFWX11: The DISPLAY environment variable is missingX11: 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-programConfirmed by raw.githubusercontent.com
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-program3Verify
glfwInit returns true.
DISPLAY=:0 ./your-programConfirmed by raw.githubusercontent.com
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.62Fix
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 package3Verify
ldconfig lists libX11.so.6 and glfwInit succeeds.
ldconfig -p | grep libX11.so.6Confirmed by raw.githubusercontent.com
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 session3Verify
glxinfo reports GLX version 1.3 or higher.
glxinfo | grep -i 'glx version'Confirmed by glfw.org
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 fixServers
Ansible hangs, then times out waiting for the sudo prompt
a playbook using become seems to hang
Ansible ran sudo on the target and never saw the answer it expected.
3 causes, each with a fixServers
Apache on Ubuntu returns 404 Not Found for my site
The requested URL was not found on this server.
On Ubuntu a 404 from Apache usually means the request maps to a path that has no file.
3 causes, each with a fixServers
Apache returns 504 Gateway Timeout when PHP takes too long
Quick requests work, slow ones end in a 504 after a fixed wait
A 504 from Apache means the backend did not answer within the proxy timeout.
2 causes, each with a fixServers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fixServers
Apache warns that a ${VAR} config variable is not defined
${VAR} left unchanged in the configuration, with a warning in the error log
Apache expands ${VAR} from Define or from the shell environment that exists when the server starts.
3 causes, each with a fix