Debugee Unable to Open Window Due to "No available video device"

When using the LLDB API to launch a process from within a program that
has opened a window, I am unable to open a window in the child
process. When the child is using SDL I get "SDL Error: No available
video device" and when the child is using GLX I get "Failed to open X

I was also getting "error: XDG_RUNTIME_DIR not set in the environment"
but I solved that by setting XDG_RUNTIME_DIR appropriately. However,
this did not fix the window problem.

I also wrote a small test case to demonstrate the problem I'm having
and I hosted it here:

Posting the source in the email thread didn't seem like the best
approach, but if you'd like the source via email, I'll be happy to
reply with it.

There are probably a few ways to get around this issue by launching
the process myself and attaching using the LLDB API, but it seems to
me like there would be a way to do this by using just the API. It
would also make the code more difficult to maintain across multiple

Is there some way I can use the LLDB API to launch a process without
preventing the child from opening a window?

Xcode (on OS X) uses the lldb API to launch processes of all sorts including ones that have widows, and has windows open, so this is not a general lldb problem.

lldb doesn’t do all that much magic to launch processes, it just calls posix_spawnp (on OS X) or fork & exec on Linux. I would be surprised it it is something special about lldb’s launching. OTOH since you are only passing XDG_RUNTIME_DIR, there’s some environment variable that specifies the window server connection that you’re missing. I haven’t done X11 programming for ages, but don’t you need to pass DISPLAY? Anyway, you might try to pass all the variables from your process to the process you are launching and see if that works.


Well, that solves the problem. Thank you for the help.