ebiten: Ebiten doesn't work with remote desktop protocol

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?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

@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.

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

@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.