When I run go build, it generates an executable file called main. When I run main, however, I get an error.
No protocol specified
2020/10/23 19:27:01 PlatformError: X11: Failed to open display :10.0
panic: NotInitialized: The GLFW library is not initialized
goroutine 1 [running]:
github.com/go-gl/glfw/v3.3/glfw.acceptError(0x0, 0x0, 0x0, 0x0, 0x10006)
/home/pi/go/src/github.com/go-gl/glfw/v3.3/glfw/error.go:174 +0x1a4
github.com/go-gl/glfw/v3.3/glfw.panicError(...)
/home/pi/go/src/github.com/go-gl/glfw/v3.3/glfw/error.go:185
github.com/go-gl/glfw/v3.3/glfw.WindowHint(0x20004, 0x0)
/home/pi/go/src/github.com/go-gl/glfw/v3.3/glfw/window.go:275 +0x40
github.com/hajimehoshi/ebiten/internal/glfw.WindowHint(...)
/home/pi/go/src/github.com/hajimehoshi/ebiten/internal/glfw/glfw_notwindows.go:329
github.com/hajimehoshi/ebiten/internal/uidriver/glfw.initialize(0x87e500, 0x5582c)
/home/pi/go/src/github.com/hajimehoshi/ebiten/internal/uidriver/glfw/ui.go:133 +0x3c
github.com/hajimehoshi/ebiten/internal/uidriver/glfw.init.1()
/home/pi/go/src/github.com/hajimehoshi/ebiten/internal/uidriver/glfw/ui.go:120 +0x14
Perhaps it fails to initialize because of (a) Failed to open display :10.0 or (b) No protocol specified?
BTW, I'm using a raspberry pi, so please consider this issue unique from other operating systems.
Hi, I think you have solved the issue (https://github.com/hajimehoshi/ebiten/issues/1401#issuecomment-714800216), but now you run into the same issue?
2020/10/23 19:27:01 PlatformError: X11: Failed to open display :10.0
I guess this is an issue in X. I'm not so familiar with it, but is the DISPLAY environment set correctly?
I decided to open this in a new issue.... It broke again for some reason. Also, here is the results of env | grep DISPLAY:
DISPLAY=:10.0
I can't tell this is the correct value or not. Do the other X applications work?
What is an "X application"? If you mean applications that spawn windows on the raspberry pi's graphical desktop, then yes. There is an RDP server running on the raspberry pi, so from my laptop I can view the graphical desktop. From the RDP client (remmina), I can start up a terminal window fine, but whenever I run my golang desktop application, it dies!
Maybe I could compile to WASM and then run it in a browser.... Lemme try that now.
Ebiten should work on Raspberry Pi, but unfortunately I'm not an expert about X.
If you mean applications that spawn windows on the raspberry pi's graphical desktop
Yes, I meant that.
@gravestench do you have any insights in this issue? Thanks.
@hajimehoshi i'm no expert, the most I do with DISPLAY is prefix commands with DISPLAY=:0.
@goisgreat what happens if you do DISPLAY=:0 ./main, whre main is your output exe ?
EDIT: I am going to take a guess that @goisgreat is connecting to his rpi via ssh. if this is the case, he would need to edit his sshd config (on the rpi) to allow x11 forwarding. After that is done, when he ssh's into the rpi he needs to add the -X arg to forward the x session stuff. This would run the app on the rpi, but forward the window to wherever he's connecting from. The performance is gonna be terribad, though. I would advise against this.
The better option is to connect the rpi to an hdmi monitor and prefix his commands that launch gui applications with DISPLAY=:0. This way, he can still drive it via ssh, and it should launch the app with the local hdmi output for the rpi.
@gravestench I'm using a RDP (remote desktop protocol) client to connect to my raspberry pi because I need to access the graphical desktop. I switched to WASM, but I got this output.
As WebGL (or probably any libraries using GPU) doesn't work, I guess it is impossible to use Ebiten via RDP, unfortunately.
Oof. Can I maybe use a cpu instead? Is there a way to let GPU-leveraging code just use the CPU?
@hajimehoshi i'm no expert, the most I do with
DISPLAYis prefix commands withDISPLAY=:0.@goisgreat what happens if you do
DISPLAY=:0 ./main, whremainis your output exe ?EDIT: I am going to take a guess that @goisgreat is connecting to his rpi via ssh. if this is the case, he would need to edit his sshd config (on the rpi) to allow x11 forwarding. After that is done, when he ssh's into the rpi he needs to add the
-Xarg to forward the x session stuff. This would run the app on the rpi, but forward the window to wherever he's connecting from. The performance is gonna be terribad, though. I would advise against this.The better option is to connect the rpi to an hdmi monitor and prefix his commands that launch gui applications with
DISPLAY=:0. This way, he can still drive it via ssh, and it should launch the app with the local hdmi output for the rpi.
By the way, this is the output for DISPLAY=:0 ./main:
No protocol specified
2020/10/28 13:44:45 PlatformError: X11: Failed to open display :0
panic: NotInitialized: The GLFW library is not initialized
goroutine 1 [running]:
github.com/go-gl/glfw/v3.3/glfw.acceptError(0x0, 0x0, 0x0, 0x0, 0x10006)
/home/pi/go/src/github.com/go-gl/glfw/v3.3/glfw/error.go:174 +0x1a4
github.com/go-gl/glfw/v3.3/glfw.panicError(...)
/home/pi/go/src/github.com/go-gl/glfw/v3.3/glfw/error.go:185
github.com/go-gl/glfw/v3.3/glfw.WindowHint(0x20004, 0x0)
/home/pi/go/src/github.com/go-gl/glfw/v3.3/glfw/window.go:275 +0x40
github.com/hajimehoshi/ebiten/internal/glfw.WindowHint(...)
/home/pi/go/src/github.com/hajimehoshi/ebiten/internal/glfw/glfw_notwindows.go:329
github.com/hajimehoshi/ebiten/internal/uidriver/glfw.initialize(0x1476500, 0x5583c)
/home/pi/go/src/github.com/hajimehoshi/ebiten/internal/uidriver/glfw/ui.go:133 +0x3c
github.com/hajimehoshi/ebiten/internal/uidriver/glfw.init.1()
/home/pi/go/src/github.com/hajimehoshi/ebiten/internal/uidriver/glfw/ui.go:120 +0x14
It's not easy to have software rendering as a fallback, but this sounds nice to have. Let me keep this issue open.
Okay, thanks! I'm going to use my local machine....
Oh, please keep this open.
Most helpful comment
@hajimehoshi i'm no expert, the most I do with
DISPLAYis prefix commands withDISPLAY=:0.@goisgreat what happens if you do
DISPLAY=:0 ./main, whremainis your output exe ?EDIT: I am going to take a guess that @goisgreat is connecting to his rpi via ssh. if this is the case, he would need to edit his sshd config (on the rpi) to allow x11 forwarding. After that is done, when he ssh's into the rpi he needs to add the
-Xarg to forward the x session stuff. This would run the app on the rpi, but forward the window to wherever he's connecting from. The performance is gonna be terribad, though. I would advise against this.The better option is to connect the rpi to an hdmi monitor and prefix his commands that launch gui applications with
DISPLAY=:0. This way, he can still drive it via ssh, and it should launch the app with the local hdmi output for the rpi.