RPi4 + Buster Lite + oF 0.11.0

Some time ago I’ve managed to run oF 0.11.0 examples on Buster Lite running on RPi3. Here’s some details: RPi3 + Buster Lite + oF 0.11.0 = can't run example

Now, I’m trying to do the same on RPi4 but with no luck.

  1. SD card with fresh 2020-02-13-raspbian-buster-lite.img
  2. sudo raspi-config > Advanced > Memory Split > 256
  3. sudo apt-get clean && sudo apt-get update && sudo apt-get dist-upgrade
  4. wget https://openframeworks.cc/versions/v0.11.0/of_v0.11.0_linuxarmv6l_release.tar.gz
  5. sudo mkdir openFrameworks && sudo tar vxfz of_v0.11.0_linuxarmv6l_release.tar.gz -C openFrameworks --strip-components 1
  6. sudo rm of_v0.11.0_linuxarmv6l_release.tar.gz
  7. cd openFrameworks/scripts/linux/debian && sudo ./install_dependencies.sh && sudo ./install_codecs.sh
  8. sudo nano openframeworks/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk
    #USE_PI_LEGACY = 0 //commenting this out
  9. cd && sudo make Release -C openFrameworks/libs/openFrameworksCompiled/project
  10. cd … && sudo nano config.make
    PROJECT_LDFLAGS += -latomic //add the flag
  11. sudo make

Compiled without issue, but when trying to run i get:

**pi@raspberrypi** : **~/openFrameworks/examples/3d/quaternionLatLongExample $** make run
using legacy build
[notice ] ofAppEGLWindow: setupRPiNativeWindow(): screenRect: 1920x1080
[notice ] ofAppEGLWindow: setupRPiNativeWindow(): windowRect: 1920x1080
[notice ] ofAppEGLWindow: createSurface(): setting up EGL Display
[notice ] ofAppEGLWindow: createSurface(): EGL Display correctly set 0x1
[notice ] ofAppEGLWindow: createSurface(): no current renderer selected
[notice ] ofAppEGLWindow: createSurface(): default renderer detected
[notice ] ofAppEGLWindow: createSurface(): surface created correctly
[notice ] ofAppEGLWindow: createSurface(): API bound correctly
[notice ] ofAppEGLWindow: createSurface(): -----EGL-----
[notice ] ofAppEGLWindow: createSurface(): EGL_VERSION_MAJOR = 1
[notice ] ofAppEGLWindow: createSurface(): EGL_VERSION_MINOR = 4
[notice ] ofAppEGLWindow: createSurface(): EGL_CLIENT_APIS = OpenGL_ES OpenVG
[notice ] ofAppEGLWindow: createSurface(): EGL_VENDOR = Broadcom
[notice ] ofAppEGLWindow: createSurface(): EGL_VERSION = 1.4
[notice ] ofAppEGLWindow: createSurface(): EGL_EXTENSIONS = EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_vg_parent_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_lock_surface
[notice ] ofAppEGLWindow: createSurface(): GL_RENDERER = VideoCore IV HW
[notice ] ofAppEGLWindow: createSurface(): GL_VERSION = OpenGL ES-CM 1.1
[notice ] ofAppEGLWindow: createSurface(): GL_VENDOR = Broadcom
[notice ] ofAppEGLWindow: createSurface(): -------------
[notice ] ofAppEGLWindow: setupPeripherals(): peripheral setup complete
[notice ] ofAppEGLWindow: setupNativeUDev(): created udev object
[notice ] ofAppEGLWindow: setupNativeInput()
[notice ] Got device
[notice ] - node:
[notice ] - sysname: input0
[notice ] - devpath: /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:1915:1001.0001/input/input0
[notice ] - devtype:
[notice ] - driver:
[notice ] - devnum: 0
[notice ] - ID_INPUT_KEYBOARD: 1
[notice ] - ID_INPUT_MOUSE:
[notice ] Got device
[notice ] - node: /dev/input/event0
[notice ] - sysname: event0
[notice ] - devpath: /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:1915:1001.0001/input/input0/event0
[notice ] - devtype:
[notice ] - driver:
[notice ] - devnum: 3392
[notice ] - ID_INPUT_KEYBOARD: 1
[notice ] - ID_INPUT_MOUSE:
[notice ] ofAppEGLWindow: addInput(): input device name = 123 COM Smart Control
[notice ] Got device
[notice ] - node:
[notice ] - sysname: input1
[notice ] - devpath: /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.1/0003:1915:1001.0002/input/input1
[notice ] - devtype:
[notice ] - driver:
[notice ] - devnum: 0
[notice ] - ID_INPUT_KEYBOARD:
[notice ] - ID_INPUT_MOUSE: 1
[notice ] Got device
[notice ] - node: /dev/input/event1
[notice ] - sysname: event1
[notice ] - devpath: /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.1/0003:1915:1001.0002/input/input1/event1
[notice ] - devtype:
[notice ] - driver:
[notice ] - devnum: 3393
[notice ] - ID_INPUT_KEYBOARD:
[notice ] - ID_INPUT_MOUSE: 1
[notice ] ofAppEGLWindow: addInput(): input device name = 123 COM Smart Control
[ error ] ofAppEGLWindow: ioctl GABS failed
[ error ] ofAppEGLWindow: ioctl GABS failed
[notice ] Got device
[notice ] - node: /dev/input/mouse0
[notice ] - sysname: mouse0
[notice ] - devpath: /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.1/0003:1915:1001.0002/input/input1/mouse0
[notice ] - devtype:
[notice ] - driver:
[notice ] - devnum: 3360
[notice ] - ID_INPUT_KEYBOARD:
[notice ] - ID_INPUT_MOUSE: 1
[notice ] Got device
[notice ] - node:
[notice ] - sysname: input2
[notice ] - devpath: /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.2/0003:1915:1001.0003/input/input2
[notice ] - devtype:
[notice ] - driver:
[notice ] - devnum: 0
[notice ] - ID_INPUT_KEYBOARD:
[notice ] - ID_INPUT_MOUSE:
[notice ] Got device
[notice ] - node: /dev/input/event2
[notice ] - sysname: event2
[notice ] - devpath: /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.2/0003:1915:1001.0003/input/input2/event2
[notice ] - devtype:
[notice ] - driver:
[notice ] - devnum: 3394
[notice ] - ID_INPUT_KEYBOARD:
[notice ] - ID_INPUT_MOUSE:
[notice ] Got device
[notice ] - node:
[notice ] - sysname: input3
[notice ] - devpath: /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.2/0003:1915:1001.0003/input/input3
[notice ] - devtype:
[notice ] - driver:
[notice ] - devnum: 0
[notice ] - ID_INPUT_KEYBOARD:
[notice ] - ID_INPUT_MOUSE:
[notice ] Got device
[notice ] - node: /dev/input/event3
[notice ] - sysname: event3
[notice ] - devpath: /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.2/0003:1915:1001.0003/input/input3/event3
[notice ] - devtype:
[notice ] - driver:
[notice ] - devnum: 3395
[notice ] - ID_INPUT_KEYBOARD:
[notice ] - ID_INPUT_MOUSE:
[notice ] Got device
[notice ] - node: /dev/input/mice
[notice ] - sysname: mice
[notice ] - devpath: /devices/virtual/input/mice
[notice ] - devtype:
[notice ] - driver:
[notice ] - devnum: 3391
[notice ] - ID_INPUT_KEYBOARD:
[notice ] - ID_INPUT_MOUSE:
[notice ] --- Input Device List ---:
[notice ] - /dev/input/event0
[notice ] - /dev/input/event1
[notice ] -------------------------:
[notice ] ofAppEGLWindow: setupPeripherals(): native event setup complete
make: *** [/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:184: run] Interrupt

…and I need to kill it since it just hangs there. Any help?

@mattc I think that is because the Rpi4 uses a different graphics driver than the Rpi3 so the legacy trick you did for the Rpi3 and 0.11.0 won’t work with Rpi4.

For Rpi4 and 0.11.0 you have to have USE_PI_LEGACY = 0 and then select the non legacy driver from raspi-conf

I think @jvcleave has been working on supporting EGL without the X window requirement that our current approach uses. If it works, I’m hoping to add that functionality into the current window approach.

Thank you for your post!
Here’s what I’ve done:

  1. USE_PI_LEGACY = 0 is back
  2. GL driver set to non-legacy
  3. sudo make clean and sudo make Release in the openFrameworks/libs/openFrameworksCompiled/project directory
  4. sudo make clean, sudo make, sudo make run in one of the examples.

Compiled, but not running. Throwing this:

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

Hi @mattc

Are you running this headless? Or from the terminal?
You will need to be in an X environment for the GLFW windowing to work.

If you need to run it headless you can use the 3rd party library xvfb to launch apps without a monitor attached.

xvfb-run ./examples/graphics/polygonExample/bin/polygonExample

You might get one glfw error message but it does run the apps okay.
more about that here: https://github.com/openframeworks/openFrameworks/pull/6438#issuecomment-552217431

Not a headless setup. Just a lite system without X environment.

OF doesn’t seem to run without an X environment on RPI4+Buster out of the box.

If you do get it running in the Desktop environment, the performance with OF is not great
and in some cases worse than using an RPI3.

Hi, just got a Pi 4 and followed the setup guide on a freshly installed real-time raspbian lite distrib on which I was successful running pure data with a very low latency on a Pi 3 in the past, so I was hoping to use ofxPd on the Pi 4 with low latency for a new project invoving a multi touch DSI screen.

As you can imagine I encountered the same error and came across this thread while trying to figure out what was going on. From what I read, I have two options : either installing X11 on the real-time distrib, or patching a raspbian desktop distrib with a real-time kernel. I’m not a linux expert at all and have no idea of each solution’s complexity and relevance, so I would appreciate any advice or pointers.

Thanks !

EDIT : just came across this discussion, will give it a try and post back if I get some success

Hi! This issue was not letting me sleep at night.
I believe that finally I found solution. First example runs without desktop environment. No mods, no legacy drivers. Still need to check other examples to make sure that this is the right way to run it.

@theo, check out steps 5 and 17 and the list below.

RPi4B+, 8GB RAM, 16GB microSD with fresh RaspberryOS Lite.

  1. sudo raspi-config > enable SSH //not required. I prefer working remotely
  2. sudo raspi-config > memory split > 512
  3. sudo raspi-config > GL driver > Fake KMS
  4. sudo apt-get clean && sudo apt-get update && sudo apt-get dist-upgrade
  5. sudo apt-get install xorg
  6. wget https://openframeworks.cc/versions/v0.11.0/of_v0.11.0_linuxarmv6l_release.tar.gz
  7. mkdir openFrameworks
  8. tar vxfz of_v0.11.0_linuxarmv6l_release.tar.gz -C openFrameworks --strip-components 1
  9. sudo rm of_v0.11.0_linuxarmv6l_release.tar.gz
  10. cd /home/pi/openFrameworks/scripts/linux/debian
  11. sudo ./install_dependencies.sh && sudo ./install_codecs.sh
  12. sudo reboot
  13. sudo make Release -C /home/pi/openFrameworks/libs/openFrameworksCompiled/project
  14. cd /openFrameworks/examples/3d/quaternionLatLongExample/
  15. sudo make
  16. cd /bin
  17. sudo startx ./quaternionLatLongExample

Tested with 3d/ofBoxExample at resolution 1920x1080. Working but getting just 17fps.
Then I remembered that if CPU is not used it will be clocked down to save power and will clock down GPU as well. So edited /boot/config.txt, added line ‘force_turbo=1’, and after reboot I’m getting 25fps.
By default this example is generating 100 boxes. Reduced to 50 but still getting 25fps. Then reduced to 5 and still not improvement. Surprised that it’s not getting higher with less elements.

Tested 3d/3DPrimitivesExample. Getting 57fps at default resolution (1024x768) and 26fps when set to 1920x1080 full screen.
Interesting that framerate is always 24-26fps when toggling different options from this example. Including higher primitives resolution. …

1 Like

Thanks for sharing this!
This all makes sense as running the OF app with X windows is supported by this version of OF. I didn’t realize though that you could do this without the desktop environment running. That might be really useful for a lot of users.

In terms of the framerate since 0.11 we realized that we were enabling 4x Anti Aliasing by default on PI whereas the older windowing approach was using 0x samples. It is fixed in the path release 0.11.1 but you can just change these lines to have the default be 0. This should result in a fair FPS increase.


Tested, recompiled OF, recompiled ofBoxExample.
Now getting solid 60fps at FullHD even with 200 boxes.

Thank you for your help!

Glad to hear!

I really would love to get @jvcleave addon ( or a similar implementation ) being the default for RPI4 but your trick is a nice way to go for people who don’t mind having X running just for the OF app.

I can add a note about this approach to the setup guide.


1 Like

Great idea with the setup guide!

More info: To prevent screen blanking use
sudo startx ./quaternionLatLongExample -- -s off

Am I reading this correctly that this numSamples change is NOT in the current of_v0.11.0_linuxarmv6l_release , but should be in the next release (0.11.1)

That is correct. The fix is in 0.11.1 which hasn’t been released yet.

If you copy the changes here it should default to no MSAA and get a better FPS performance:

1 Like