RPi3 + Buster Lite + oF 0.11.0 = can't run example

I’m having a hard time making the OF working with my HW & SW config. Both OF and example compiles without a problem, but I can not run the example.
Here’s my setup from the very beginning:

1. SD card with 2019-09-26-raspbian-buster-lite.img

2. Booting with RPi 3B

3. sudo raspi-config
	Advanced > Expand Filesystem
	Advanced > Memory Split > 256
	Advanced > GL Driver > GL Driver Fake KMS
	Interfacing > SSH > enable

4. reboot

5. sudo nano /boot/config.txt //I'm using small 7-inch HDMI screen
	hdmi_group=2
	hdmi_mode=87
	hdmi_cvt=800 480 60 6 0 0 0
	hdmi_drive=1

6. sudo nano /etc/dhcpcd.conf //settings static IP

7. reboot

8. sudo apt-get clean && sudo apt-get update && sudo apt-get dist-upgrade

9. wget https://openframeworks.cc/versions/v0.11.0/of_v0.11.0_linuxarmv6l_release.tar.gz

10. sudo mkdir openFrameworks && sudo tar vxfz of_v0.11.0_linuxarmv6l_release.tar.gz -C openFrameworks --strip-components 1

11. sudo rm of_v0.11.0_linuxarmv6l_release.tar.gz 

12. cd openFrameworks/scripts/linux/debian

13. sudo ./install_dependencies.sh && sudo ./install_codecs.sh && sudo apt-get clean

14. cd && sudo make Release -C openFrameworks/libs/openFrameworksCompiled/project

15. cd /openFrameworks/examples/3d/quaternionLatLongExample/src/

16. sudo nano main.cpp //making sure to use display resolution and full screen
	ofSetupOpenGL(800,480, OF_FULLSCREEN);

17. cd .. && sudo make && sudo make run

Here’s the output when trying to run example:

VER ID IS 10
using newer build and GLFW window
[ 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
Segmentation fault
make: *** [/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:184: run] Error 139

Since I’m using Lite system and the log shows error related to X11, I also tired adding this

sudo apt-get install xutils

…but with no effect.

Any help would be appreciated!

Buster + oF 0.11.0 needs the X environment (desktop) to run. As Lite without comes without the desktop environment, that’s probably the issue. IIRC @theo had something in the makefiles to make it run with EGL at least on the RPi3 - he can elaborate further.

Thanks for that Do you think it would make a difference if I set up full Buster OS and boot into the CLI instead of desktop?
My project requires as light (and fast booting) setup as possible, so it would be great if there was a way to make the oF running without desktop.

You would definitely need a desktop environment but maybe the full Buster Raspbian environment may not be needed. A lightweight desktop environment can be set up on the Pi afaik (but have never done it). @arturo might know, going by the ofBook chapter on Linux setups (https://openframeworks.cc/ofBook/chapters/installation_up_4evr_linux.html)

There’s this I could find but it’s a few years old:
https://www.raspberrypi.org/forums/viewtopic.php?t=133691

(If you go down this route please keep us updated, I would be very interested in this setup if not anyone else!)

Done this:

1. sudo apt-get install --no-install-recommends xserver-xorg
2. sudo apt-get install raspberrypi-ui-mods
3. reboot

Machine boots into desktop. Tested scenarios:
A. If I run the example from the GUI (by double-clicking on the compiled binary) it starts correctly.
B. If I run the example from the terminal window (sudo make run) it also starts correctly.
C. If I run the example from remote connection (ssh into the machine, then sudo make run) I get the same errors as before.

Before installing desktop environment I have not tested scenario B. I was only trying to run the example with scenario C, since this is the way it always worked for me in all previous system and oF releases.
At this point I’m not sure if the example would run if tried to run it from the device itself instead of remote connection.

EDIT:
Used sudo raspi-config to change boot option to CLI. Example does not start if the desktop environment is not running.

when you run an application remotely you need to set the DISPLAY environment variable in order to run it in that xserver display. in the raspberry in a terminal from within a desktop session type:

echo $DISPLAY

you will get something like :0 or 0:0 or something similar, then in your ssh session type:

export DISPLAY=:0

or whatever you got before. that will make it run the applications in the same display as you have the desktop in the pi

@mattc The headless situation has changed actually since Buster / 0.11.0. I should add a note to the setup docs. But due to the way the emulated GL in raspbian changed in Buster and OF needing the real GL driver you need to use another tool to run apps headless.

There is some discussion about it in the comments here: https://github.com/openframeworks/openFrameworks/pull/6438

But the solution is to install xvfb ( x virtual frame buffer ):
sudo apt-get install xvfb
xvfb-run ./examples/graphics/polygonExample/bin/polygonExample

You might still need to set your boot option to Desktop + CLI and need Arturo’s suggesting above. xvfb did work for me though for running apps ( you might get a GLFW error about gamma ramps but the app still runs ).

Thanks @arturo for your input!
Here’s how it goes in my device:
echo $DISPLAY from the desktop returns

:0.0

Then over the ssh connection I type

export DISPLAY=:0.0
sudo make run

…and get

VER ID IS 10
using newer build and GLFW window
No protocol specified
[ error ] ofAppGLFWWindow: 65544: X11: Failed to open display :0.0
[ error ] ofAppGLFWWindow: couldn't init GLFW
[ error ] ofAppGLFWWindow: 65537: The GLFW library is not initialized
Segmentation fault
make: *** [/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:184: run] Error 139

Thanks @theo! Checked your way and this is what I got. After typing:

sudo apt-get install xvfb
reboot

cd openFrameworks/
xvfb-run ./examples/3d/quaternionLatLongExample/bin/quaternionLatLongExample

…i got…

[ error ] ofAppGLFWWindow: 65544: X11: RandR gamma ramp support seems broken
^CXIO:  fatal IO error 4 (Interrupted system call) on X server ":99"

To clarify: I don’t want to run my RPi headless. I’m trying to run lite system, with HDMI display, without desktop, with oF app. It’s just the way I work that makes me to trigger the app with a ssh remote connection.

Also, please @arturo & @theo correct me if I’m wrong here: Currently there is no way of running oF 0.11.0 apps on lite distros without desktop environment.
If I want to do so I would have to use oF 0.10.1 or older.

does this work for you on 0.10.1?

@mattc

I think with that second error you might want to do those display steps:
echo $DISPLAY
export DISPLAY=:whatever number it is
first too before calling
xvfb-run ./examples/3d/quaternionLatLongExample/bin/quaternionLatLongExample

The reason everything changed with 0.11.0 is that 0.10.1/0.10.0 was effectively broken with Buster ( and maybe Stretch too ) due to the way OF was setting up windows and a legacy component ( not the legacy driver ) being removed.

One other thing you can try is using ofAppEGLWindow instead of the GLFW one.
Both are supported in 0.11.0. Comment this line to use ofAppEGL instead of GLFW.

I think it should be possible to run Rpi without a desktop environment with 0.11.0.
I can give it a try here.

Hmm…
I gave it a whirl on CLI with no desktop and I can get it to run examples via ssh but it isn’t outputting to the display because the desktop / Xorg isn’t booted.

I am imagining you want to actually see the app example on the screen and not just run it headless.
I am note sure if that is possible without running Desktop / X.

Did this used to work for you with older OF releases?

@arturo, @theo
Yes, it worked exactly as expected on Buster Lite with OF 0.10.1. Compiled OF after replacing some dependencies, then compiled example after adding -latomic flag to config.make file.
All examples were running on the lite, non-desktop OS.

Oh awesome.
Well you should get the same behavior with 0.11.0 by commenting out this line:
EDIT:

That “should” set it to use the same approach in 0.10.1 and disable GLFW as the default windowing system.

We haven’t had much chance to test this so there might be errors, but I hope it should use the legacy approach which sounds like it works in your case.

1 Like

Ok, I will definitely try it out after weekend and report back to you. Hope it works. And thank you both @theo and @arturo for your support!

@theo, @arturo,
it works! Made a fresh install to check what is necessary to make it work as expected. Attaching steb-by-step guide below for your reference. And again, thank you for your support!
Most importing parts are:

  • keep the GL driver at legacy settings (other won’t work),
  • comment out the USE_PI_LEGACY = 0,
  • add the PROJECT_LDFLAGS += -latomic flag to the project.
1. SD card with 2019-09-26-raspbian-buster-lite.img

2. Booting with RPi 3B

3. sudo raspi-config
	Advanced > Expand Filesystem
	Advanced > Memory Split > 256
	Interfacing > SSH > enable //I need this to work remotely

4. reboot

5. sudo nano /boot/config.txt
	hdmi_group=2
	hdmi_mode=87
	hdmi_cvt=800 480 60 6 0 0 0 //that's my 7-inch screen setup
	hdmi_drive=1

6. sudo nano /etc/dhcpcd.conf
	// set static IP - I need this to work remotely

7. reboot

8. sudo apt-get clean && sudo apt-get update && sudo apt-get dist-upgrade

9. wget https://openframeworks.cc/versions/v0.11.0/of_v0.11.0_linuxarmv6l_release.tar.gz

10. sudo mkdir openFrameworks && sudo tar vxfz of_v0.11.0_linuxarmv6l_release.tar.gz -C openFrameworks --strip-components 1

11. sudo rm of_v0.11.0_linuxarmv6l_release.tar.gz 

12. cd openFrameworks/scripts/linux/debian

13. sudo ./install_dependencies.sh && sudo ./install_codecs.sh && sudo apt-get clean

14. cd openframeworks/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk
	# USE_PI_LEGACY = 0

15. cd && sudo make Release -C openFrameworks/libs/openFrameworksCompiled/project

16. cd /openFrameworks/examples/3d/quaternionLatLongExample/src/

17. sudo nano main.cpp
	ofSetupOpenGL(800,480, OF_FULLSCREEN); //change project resolution 

18. cd .. && sudo nano config.make
	PROJECT_LDFLAGS += -latomic //add the flag

18. sudo make && sudo make run

thanks! that’s really useful

Just to follow up.
I tried this on RPi 4 and it didn’t work for me. Same issues with EGL not able to create a surface.

It does seem like it should be possible, with the right configuration ( see this guide: https://github.com/matusnovak/rpi-opengl-without-x ).

But the guide and other documentation makes clear Rpi 4 is a different situation from Rpi 1/2/3.
So we’ll need to find the right combo to use the old EGL approach without X windows.

Exciting that this works for you though on 0.11.0.
I can add the proper latomic detection to 0.11.1

If there was a way to make it also work on RPi4 it would be fantastic! At some point I will be forced to switch to RPi4. Hope that you will figure it out soon!
Please let me know if I can be any help to you. I’ll be more than happy to do so.

Hi all,

I was also unable to run oF 0.11.0 on a RPi3 running Buster Lite, always receiving “[ error ] ofAppGLFWWindow” no matter what combination of USE_PI_LEGACY and USE_GLFW_WINDOW was present in config.linuxarmv6l.default.mk.

However, with some tinkering, running oF v0.10.1 seems to work well. Therefore, with inspiration from @mattc and other posts in this thread, below are instructions for installing openFrameworks v0.10.1 on Raspbian Buster Lite. The main difference is that some of the dependencies need to be replaced and the latomic flag is added into config.linuxarmv6l.default.mk instead of every app’s config.make file.

1. SD card with 2020-02-13-raspbian-buster-lite.img
	https://downloads.raspberrypi.org/raspbian_lite/images/

2. Booting with RPi 3B

3. sudo raspi-config
	Advanced > Expand Filesystem
	Advanced > Memory Split > 256
	Interfacing > SSH > enable

4. Reboot

5. Updates:
	sudo apt-get clean
	sudo apt-get update
	sudo apt-get upgrade
	sudo apt-get dist-upgrade

6. Increase swap file:
	sudo pico /etc/dphys-swapfile
	#CONF_SWAPSIZE=100
	CONF_SWAPSIZE=1024
	sudo /etc/init.d/dphys-swapfile stop
	sudo /etc/init.d/dphys-swapfile start

7. wget https://openframeworks.cc/versions/v0.10.1/of_v0.10.1_linuxarmv6l_release.tar.gz

8. mkdir openFrameworks && tar vxfz of_v0.10.1_linuxarmv6l_release.tar.gz -C openFrameworks --strip-components 1

9. cd openFrameworks/scripts/linux/debian

10. Replace some dependencies:
	pico install_dependencies.sh
	Replaces:
	libsndfile-dev > libsndfile1-dev
	libgles1-mesa-dev > libglvnd-dev

11. sudo ./install_dependencies.sh && sudo ./install_codecs.sh

12. Add the "latomic" flag for all apps:
	pico ~/openFrameworks/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk
	Add this line after PLATFORM_LDFLAGS += -pthread:
	PLATFORM_LDFLAGS += -latomic

13. make Release -C ~/openFrameworks/libs/openFrameworksCompiled/project

14. Compile a test app:
	cd ~/openFrameworks/examples/graphics/polygonExample
	make -j4
	make run

15. Decrease swap file:
	sudo pico /etc/dphys-swapfile
	CONF_SWAPSIZE=100
	sudo /etc/init.d/dphys-swapfile stop
	sudo /etc/init.d/dphys-swapfile start
2 Likes