GLFW.Window() Segmentation fault on libX11 while dllist() does find libX11.so
I first opened this issue in the discourse. However it's been almost a week and people have looked but not responded so I suspect that this won't (probably?) be picked up and I would really like to resolve the issue so am cross-posting here (apologies).
TLDR;
- Segmentation fault with message "lib for symbol XOpenDisplay is missing"
- julia> dllist finds libX11.so (which is symlinked to libX11.so.6.4.0)
- I can compile & run C code using glfw3.h without issue, including opening windows
- Display is set, and OpenGL renderer string: AMD Radeon Graphics
- I am running on Ubuntu itself, no containers, no linux under windows
- I -did- update my firmware at some point (unsure why this would impact julia when opening windows with GLFW/glfw3.h is unaffected)
- I -did- update julia, but downgrading doesn't help and upgrading to beta also does not help.
- Julia is installed using juliaup, but I manually built it as well just to check and the error persists
The error (irrespective of terminal [tried fish, bash, vscode], version, or method of building julia [juliaup and manual]):
julia> GLFW.Window()
lib for symbol XOpenDisplay is missing
[92651] signal 11 (1): Segmentation fault
in expression starting at REPL[4]:1
unknown function (ip: (nil)) at (unknown file)
Allocations: 18166896 (Pool: 18163672; Big: 3224); GC: 18
Segmentation fault (core dumped)
The following is output from glxinfo -B:
name of display: :0
display: :0 screen: 0
direct rendering: Yes
Memory info (GL_ATI_meminfo):
VBO free memory - total: 1023 MB, largest block: 1023 MB
VBO free aux. memory - total: 15419 MB, largest block: 15419 MB
Texture free memory - total: 1023 MB, largest block: 1023 MB
Texture free aux. memory - total: 15419 MB, largest block: 15419 MB
Renderbuffer free memory - total: 1023 MB, largest block: 1023 MB
Renderbuffer free aux. memory - total: 15419 MB, largest block: 15419 MB
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: AMD Radeon Graphics
OpenGL core profile version string: 4.6.0 Core Profile Context 25.10.250708
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.6.0 Compatibility Profile Context 25.10.250708
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.2.0 25.10.250708
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
I am unsure how to address this issue. I am using X11 and on Ubuntu 24.04.3 LTS
There is some additional info (such as the glfw c code that does run) in the discourse post.
Thanks in advance for any advice!
Since the issue isn't resolved I tried some things, but none give any error:
julia> GLFW.GetPrimaryMonitor()
eDP Monitor (1920x1200@60Hz)
julia> GLFW.GetMonitors()
2-element Vector{GLFW.Monitor}:
eDP Monitor (1920x1200@60Hz)
HDMI-A-0 Monitor (1920x1080@60Hz)
julia> GLFW.GetMonitorPhysicalSize(GLFW.GetMonitors()[1])
(width = 344, height = 215)
julia> GLFW.GetMonitorPhysicalSize(GLFW.GetMonitors()[2])
(width = 598, height = 336)
julia> GLFW.standard_window_hints()
8-element Vector{Tuple{UInt32, Int64}}:
(0x0002100d, 0)
(0x00021005, 0)
(0x00021004, 8)
(0x00021001, 8)
(0x00021002, 8)
(0x00021003, 8)
(0x00021006, 0)
(0x0002100b, 0)
julia> GLFW.standard_context_hints
standard_context_hints (generic function with 1 method)
julia> GLFW.standard_context_hints(3,3)
4-element Vector{Tuple{UInt32, Integer}}:
(0x00022002, 3)
(0x00022003, 3)
(0x00022006, 1)
(0x00022008, 0x00032001)
Even in a newly built latest git cloned dev version: Version 1.13.0-DEV.1359 (2025-10-21) & GLFW v3.4.5
julia> GLFW.Window( ;name = "GLWindow",
resolution = GLFW.standard_screen_resolution(),
debugging = true,
major = 3,
minor = 3,# this is what GLVisualize needs to offer all features
windowhints = GLFW.standard_window_hints(),
contexthints = GLFW.standard_context_hints(3, 3),
visible = true,
focus = false,
fullscreen = false,
monitor = GLFW.GetMonitors()[1],
share = GLFW.Window(C_NULL)
)
lib for symbol XOpenDisplay is missing
[91403] signal 11 (1): Segmentation fault
in expression starting at REPL[2]:1
I guess this is a BinaryBuilder.jl issue... Maybe open an issue there, or at Yggdrasil: https://github.com/JuliaPackaging/Yggdrasil... That's where the GLFW library artifact (GLFW_jll) gets build.
I guess this is a BinaryBuilder.jl issue.
Is it? At the moment there's no evidence (no effort was done to investigate this issue at all) it's a problem with how the library was compiled, which would be the only actionable part for Yggdrasil
Ok, I thought lib for symbol XOpenDisplay is missing might be a hint.
no effort was done to investigate this issue at all
Well, I cant reproduce it, and GLFW works nicely on all major platforms for years, so the only thing I can go with is that there seems to be missing symbols, and that the C version with the systems GLFW is working, which points towards something wrong with GLFW_jll on that specific platform 🤷
Note: I meant "BinaryBuilder.jl issue" as a placeholder for anything going wrong in creating GLFW_jll for that specific platform.
@willcoxe You mentioned that the latest libx11 for your system is 1.8.7, but it looks like Julia is using 1.8.12: https://github.com/JuliaPackaging/Yggdrasil/blob/master/X/Xorg_libX11/build_tarballs.jl.
Would you be able to build and install libx11-1.8.12 from https://www.x.org/archive/individual/lib/libX11-1.8.12.tar.gz and test with that?
I guess that wouldn't explain why you can still use GLFW directly with C but might be worth a try.
I have several deadlines currently so I don't have the time to deal with this -and- any potential for anything else not working at this time. I would have 16 days ago when I opened the discourse ;) . It's crunch time now though so I will probably have to wait to test upgrading to 1.8.12 until November when I am not quite as reliant on this machine for my work.
What is interesting is that the 1.8.12 version has apparently been used since April, when GLFW.Window() must have still been working because I was able to compile GLMakie until about a month ago. But perhaps the version was held back by another package.
Mind you, wouldn't downgrading to say julia 1.11.5 and all associated packages, say down to GLFW 3.4.0 would then build properly against the previous version of libx11-1.8.12. Because that still doesn't work.
Finally, in my most recent (re)installs of julia, dllist() now no longer shows a libX11.so (which it did do before, see the o.g. discourse), so something seems to have changed somewhere.
I'll have to shelve this temporarily I think until I have a bit more time.
@willcoxe do you have LD_LIBRARY_PATH set? Can you please post the full output of versioninfo() inside the Julia REPL where you can replicate your problems?
I have not set it consciously. echo $LD_LIBRARY_PATH comes up empty. My expectation (per the very first discourse note) is that I do think it's some sort of environment issue, and probably has an easy fix. Mostly because otherwise downgrading would simply fix it. I'd have suspected a driver issue before anything else except I can open windows in C so the drivers are fine. I just may have stared at it too long so I can't see it..
julia> @show ENV["PATH"]
ENV["PATH"] = "/home/USER/.local/bin:/home/USER/.cabal/bin/:/usr/local/bin:/home/USER/.cargo/bin:/home/USER/.juliaup/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/USER/.local/bin:/usr/local/texlive/2025/bin/x86_64-linux"
"/home/USER/.local/bin:/home/USER/.cabal/bin/:/usr/local/bin:/home/USER/.cargo/bin:/home/USER/.juliaup/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/USER/.local/bin:/usr/local/texlive/2025/bin/x86_64-linux"
where (%s/actual uname/USER/)
I can dlopen() manually and then it loads the libraries
julia> dlopen("/lib/x86_64-linux-gnu/libX11.so")
Ptr{Nothing}(0x0000000000b0db30)
julia> for (i,n) in enumerate(dllist())
println(i, " ", n)
end
[..]
33 /lib/x86_64-linux-gnu/libX11.so
34 /lib/x86_64-linux-gnu/libxcb.so.1
35 /lib/x86_64-linux-gnu/libXau.so.6
36 /lib/x86_64-linux-gnu/libXdmcp.so.6
37 /lib/x86_64-linux-gnu/libbsd.so.0
38 /lib/x86_64-linux-gnu/libmd.so.0
This system/shell has the following paths:
~> ld --verbose | grep SEARCH_DIR | tr -s ' ;' \\012
SEARCH_DIR("=/usr/local/lib/x86_64-linux-gnu")
SEARCH_DIR("=/lib/x86_64-linux-gnu")
SEARCH_DIR("=/usr/lib/x86_64-linux-gnu")
SEARCH_DIR("=/usr/lib/x86_64-linux-gnu64")
SEARCH_DIR("=/usr/local/lib64")
SEARCH_DIR("=/lib64")
SEARCH_DIR("=/usr/lib64")
SEARCH_DIR("=/usr/local/lib")
SEARCH_DIR("=/lib")
SEARCH_DIR("=/usr/lib")
SEARCH_DIR("=/usr/x86_64-linux-gnu/lib64")
SEARCH_DIR("=/usr/x86_64-linux-gnu/lib")
Versions I have tested so far (and can't get to work, error remains the same):
~> julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.11.6 (2025-07-09)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> versioninfo()
Julia Version 1.11.6
Commit 9615af0f269 (2025-07-09 12:58 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 16 × AMD Ryzen 7 Pro 7735U with Radeon Graphics
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
~> julia +beta
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.12.1 (2025-10-17)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org release
|__/ |
julia> versioninfo()
Julia Version 1.12.1
Commit ba1e628ee49 (2025-10-17 13:02 UTC)
Build Info:
Official https://julialang.org release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 16 × AMD Ryzen 7 Pro 7735U with Radeon Graphics
WORD_SIZE: 64
LLVM: libLLVM-18.1.7 (ORCJIT, znver3)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 16 virtual cores)
~> julia +1.11.5
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.11.5 (2025-04-14)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> versioninfo()
Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 16 × AMD Ryzen 7 Pro 7735U with Radeon Graphics
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
julia (master)> ./julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.13.0-DEV.1371 (2025-10-23)
_/ |\__'_|_|_|\__'_| | Commit 7dfa7d1b0d (0 days old master)
|__/ |
julia> versioninfo()
Julia Version 1.13.0-DEV.1371
Commit 7dfa7d1b0d (2025-10-23 17:06 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 16 × AMD Ryzen 7 Pro 7735U with Radeon Graphics
WORD_SIZE: 64
LLVM: libLLVM-20.1.8 (ORCJIT, znver3)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 16 virtual cores)
I have been looking into this further and if it is the libx11 version, that would mean that the error would be replicated by anyone running ubuntu LTS since this is the version of libx11-dev currently pinned for noble. I suspect if that was the case this would be a more commonly communicated issue.
I have not updated libx11 at this time since this is a work machine (and so limited in how badly I can mess up without it impacting my ability to work).
Another update.
This example also opens a window. Except when I build it without -lX11. If I build it without, I get the same error as is given by GLFW.Window(). Can someone better acquainted tell me where I can modify the gcc command and rebuild this package with -lX11? Julia itself has already been manually built with this flag and this makes no difference. I have also tried to remove all of my .julia directory and this also made no difference.
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char ** argv){
int screen_num, width, height;
unsigned long background, border;
Window win;
XEvent ev;
Display *dpy;
/* First connect to the display server, as specified in the DISPLAY
environment variable. */
dpy = XOpenDisplay(NULL);
if (!dpy) {fprintf(stderr, "unable to connect to display");return 7;}
/* these are macros that pull useful data out of the display object */
/* we use these bits of info enough to want them in their own variables */
screen_num = DefaultScreen(dpy);
background = BlackPixel(dpy, screen_num);
border = WhitePixel(dpy, screen_num);
width = 40; /* start with a small window */
height = 40;
win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), /* display, parent */
0,0, /* x, y: the window manager will place the window elsewhere */
width, height, /* width, height */
2, border, /* border width & colour, unless you have a window manager */
background); /* background colour */
/* tell the display server what kind of events we would like to see */
XSelectInput(dpy, win, ButtonPressMask|StructureNotifyMask );
/* okay, put the window on the screen, please */
XMapWindow(dpy, win);
/* as each event that we asked about occurs, we respond. In this
* case we note if the window's shape changed, and exit if a button
* is pressed inside the window */
while(1){
XNextEvent(dpy, &ev);
switch(ev.type){
case ConfigureNotify:
if (width != ev.xconfigure.width
|| height != ev.xconfigure.height) {
width = ev.xconfigure.width;
height = ev.xconfigure.height;
printf("Size changed to: %d by %d", width, height);
}
break;
case ButtonPress:
XCloseDisplay(dpy);
return 0;
}
}
}
Result without -lX11
~> gcc -o test_libx11 test_libx11.c
/usr/bin/ld: /tmp/cc0QkCI4.o: in function `main':
test_libx11.c:(.text+0x31): undefined reference to `XOpenDisplay'
/usr/bin/ld: test_libx11.c:(.text+0x14d): undefined reference to `XCreateSimpleWindow'
/usr/bin/ld: test_libx11.c:(.text+0x176): undefined reference to `XSelectInput'
/usr/bin/ld: test_libx11.c:(.text+0x18f): undefined reference to `XMapWindow'
/usr/bin/ld: test_libx11.c:(.text+0x1a8): undefined reference to `XNextEvent'
/usr/bin/ld: test_libx11.c:(.text+0x21f): undefined reference to `XCloseDisplay'
collect2: error: ld returned 1 exit status
But with -lX11 no error
~> gcc -o test_libx11 test_libx11.c -lX11
~> ./test_libx11
Size changed to: 1912 by 1037⏎
~>
I'd appreciate a hint regarding the -lX11 flag still, if at all possible?
@willcoxe I believe your entire problem is that you're relying on external libraries. You shouldn't in the first place.