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

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

1 Like

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
2 Likes

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

This is working but not for the shader examples. I have buster lite, openframeworks 10.1 running on rpi3b. The Polygon Example is running perfect but if i compile the shader example 01 i get the following error at start.

[ error ] ofShader: sorry, it looks like you can’t run ‘ARB_shader_objects’
[ error ] ofShader: please check the capabilites of your graphics card: http://www.ozone3d.net/gpu_caps_viewer
[ error ] ofShader: setupShaderFromSource(): failed creating GL_VERTEX_SHADER shader
[ error ] ofShader: sorry, it looks like you can’t run ‘ARB_shader_objects’
[ error ] ofShader: please check the capabilites of your graphics card: http://www.ozone3d.net/gpu_caps_viewer
[ error ] ofShader: setupShaderFromSource(): failed creating GL_FRAGMENT_SHADER shader
[ error ] ofShader: linkProgram(): trying to link GLSL program, but no shaders created yet

Same thing here, same errors, but in Raspberry 4 with Raspberry OS Buster…

Here’s my RPi4 working setup: RPi4 + Buster Lite + oF 0.11.0 - #8 by mattc

Oh, I just tried those instructions about the RPi4+Buster Lite + of0.11.1 , and it runs the 3dExample and the Quaternion example too, but not the shader ones. I can’t use shaders on the raspberry pi 4.

This are the errors:

(==) Log file: "/var/log/Xorg.0.log", Time: Thu Jun 24 01:17:36 2021
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(II) modeset(0): Initializing kms color map for depth 24, 8 bpc.
[ error ] ofShader: sorry, it looks like you can't run 'ARB_shader_objects'
[ error ] ofShader: please check the capabilites of your graphics card: http://www.ozone3d.net/gpu_caps_viewer
[ error ] ofShader: setupShaderFromSource(): failed creating GL_VERTEX_SHADER shader
[ error ] ofShader: sorry, it looks like you can't run 'ARB_shader_objects'
[ error ] ofShader: please check the capabilites of your graphics card: http://www.ozone3d.net/gpu_caps_viewer
[ error ] ofShader: setupShaderFromSource(): failed creating GL_FRAGMENT_SHADER shader
[ error ] ofShader: linkProgram(): trying to link GLSL program, but no shaders created yet

I finally managed to run the shaders examples. The solution was here:

You have to change the main.cpp file code for the shaders to work. The one that comes by default says:

#include "ofMain.h"
#include "ofApp.h"

//========================================================================
int main( ){
    
#ifdef OF_TARGET_OPENGLES
	ofGLESWindowSettings settings;
	settings.glesVersion=2;
#else
	ofGLWindowSettings settings;
	settings.setGLVersion(3,2);
#endif
	ofCreateWindow(settings);
    
	// this kicks off the running of my app
	// can be OF_WINDOW or OF_FULLSCREEN
	// pass in width and height too:
	ofRunApp(new ofApp());
    
}

You have to change it to:

#include "ofMain.h"
#include "ofApp.h"

//========================================================================
int main( ){
        ofGLESWindowSettings settings;
        settings.glesVersion = 2;
	settings.setSize(1280, 720);
    ofCreateWindow(settings);

    ofRunApp(new ofApp());

}

I hope it helps.

I ran all the raspberry shader examples with this fix, except the last one: gaussian blur.

Thanks everybody!

1 Like