Skip to content

The DISPLAY environment variable is missing on RPI4 #7725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stephanschulz opened this issue Oct 18, 2023 · 10 comments
Closed

The DISPLAY environment variable is missing on RPI4 #7725

stephanschulz opened this issue Oct 18, 2023 · 10 comments

Comments

@stephanschulz
Copy link

stephanschulz commented Oct 18, 2023

I am on a Raspberry Pi 4 model B with the 32bit version of the OS installed via the Raspberry PI Imager app on macOS 12.

I am trying to compile the videoPlayer example using OF 0.12 and also the latest nightly build of_v20231018_linuxarmv6l_release

In order for it to compile I had to comment out PLATFORM_LIBRARIES += openmaxil as suggested here and here

But I get this error when trying to use make run while SSH in tot he RPI.

[ error ] ofAppGLFWWindow: 65544: X11: The DISPLAY environment variable is missing
[ error ] ofAppGLFWWindow: couldn't init GLFW
[ error ] ofAppGLFWWindow: 65537: The GLFW library is not initialized

When I try make run on the PRI4 directly I get this error:

IMG_6468

@dimitre
Copy link
Member

dimitre commented Oct 18, 2023

it is normal if you are invoking via ssh
try

DISPLAY=:0 make RunRelease

@dimitre
Copy link
Member

dimitre commented Oct 18, 2023

or try to run via keyboard / mouse on rpi itself

@stephanschulz
Copy link
Author

the photo is me trying directly via keyboard on the rpi.

@ofTheo
Copy link
Member

ofTheo commented Oct 19, 2023

There are some tips at the end of the setup guide. RPI 4 requires an X environment to run due to changes in their video driver. We're working on a new approach for this but for now X is required.

End of:
https://openframeworks.cc/setup/raspberrypi/raspberry-pi-getting-started/

Will paste it here:

Tips for 0.12.0 / Raspberry Pi 4

If you don't want to run PI apps from the X desktop enviornment but want to use the GLFW window system ( or have a Raspberry Pi 4 which requires X ) you can run an OF app without the desktop. First make sure you have X installed with: sudo apt-get install xorg then launch your app with: startx ./polygonExample -- -s off. Your app will run with an X window but without the overhead of the desktop enivornment.

If you want to run an app headless you can use XVFB ( X Virtual Framebuffer ). First install XVFB with: sudo apt-get install xvfb Then run your app with: xvfb-run ./polygonExample &. You won't see a window, but GL operations will be executed.
Finally for users who are looking for the old EGL style window support but with Raspberry Pi 4. This work in progress addon is very close to providing similar functionality.

@stephanschulz
Copy link
Author

Thank you for taking the time to explain this to me. I did not realize that I thought only if you run the pi without a desktop this would be needed.

Nonetheless. I installed x with sudo apt-get install xorg
I cd to the polygonExample and called make and then call startx ./polygonExample -- -s but get errors. see photos below.
IMG_6475
IMG_6476

so I also tried rebooting and just calling startx which gives the same errors:
IMG_6477

@stephanschulz
Copy link
Author

since this error message mentioned the /dev/tty0 serial port I disabled anything serial in the config and rebooted.

while this part of the. error message is gone the rest remains.

@ofTheo
Copy link
Member

ofTheo commented Oct 19, 2023

Ahh. I think we've only tested the setup for Pi 4 by installing the Desktop version of Raspbian.
You'll definitely need to have startx working for the OF non-desktop hacks to work.

ps: We're hoping to get a better approach soon that uses native display drivers so we don't have to rely on X.

@stephanschulz
Copy link
Author

stephanschulz commented Oct 19, 2023

I have been using the desktop 32bit version through out all my tests.

Screen Shot 2023-10-19 at 1 35 34 PM
.
.
Screen Shot 2023-10-19 at 1 46 23 PM

Maybe I should try the 64bit version

Thank you for all you do. I am looking forward to the newer OF version which removes the need for X

@stephanschulz
Copy link
Author

stephanschulz commented Oct 19, 2023

I had to use sudo startx ./polygonExample -- -s off

my steps

  • 64bit os version with desktop via raspberry pi imager.app

on PI

in mac terminal:

  • clear SSH key ssh-keygen -R 192.168.93.156
  • log in to pi via ssh ssh [pi@192.168.93.156](mailto:pi@192.168.93.156)
  • sudo raspi-config → 6 advanced options → A1 expand …
  • follow [OF install steps](https://openframeworks.cc/setup/raspberrypi/raspberry-pi-getting-started/)
  • i did not run sudo apt-get upgrade
  • cd /home/pi/openFrameworks/scripts/linux/debian
  • sudo ./install_dependencies.sh
  • make Release -C /home/pi/openFrameworks/libs/openFrameworksCompiled/project
  • cd to /home/pi/of_v20231019_linuxaarch64_release/examples/graphics/polygonExample/bin
  • call make
  • sudo startx ./polygonExample -- -s off

@ofTheo
Copy link
Member

ofTheo commented Nov 15, 2024

Going to close this as running OF on RPi headless is documented in the setup guide and headless running with native windowing is already an open issue here: #6713

@ofTheo ofTheo closed this as completed Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants