The DISPLAY environment variable is missing on RPI4
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:
it is normal if you are invoking via ssh try
DISPLAY=:0 make RunRelease
or try to run via keyboard / mouse on rpi itself
the photo is me trying directly via keyboard on the rpi.
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.
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.
so I also tried rebooting and just calling startx which gives the same errors:
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.
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.
I have been using the desktop 32bit version through out all my tests.
.
.
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
I had to use sudo startx ./polygonExample -- -s off
my steps
- 64bit os version with desktop via raspberry pi imager.app
on PI
- set user name pi and password xxxxx
- do not update anything during setup process
- enable SSH via system window
- download OF (maybe needs to be [latest nightly build](https://github.com/openframeworks/openFrameworks/releases/tag/nightly))
in mac terminal:
- clear SSH key
ssh-keygen -R 192.168.93.156 - log in to pi via ssh
ssh [[email protected]](mailto:[email protected]) -
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