Raylib: [build] Segmentation fault on RPI4

Created on 18 Dec 2019  ·  3Comments  ·  Source: raysan5/raylib

hello i had need change model raspberry pi from 3 b+ to pi4 my app it was built over raylib 2.4 .it dosent work on CLI mode .searching on internet i found this https://github.com/raspberrypi/firmware/issues/1171 ,this told about a change on driver EGL .this goes beyond my knowledge .

i read one solution is change Gl driver to dtoverlay=vc4-kms-v3d on config.txt but this mode dont work over hadware pi 4. (Black screen).

if i try build with make PLATFORM=PLATFORM_RPI i have errors ...segmentation fault ..freeze ..and more on my aplication
if i use make PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_21 works .installing sudo apt-get install libegl1-mesa-dev before .but my application it was build for CLI not GUI.
this happend with version 2.4 raylib
with raylib 2.6 the execution is very poor..to slow. with x11 .on CLI same problems

funding needed raspberrypi

Most helpful comment

funding needed: I don't have a Raspberry Pi 4 to work on this issue, if someone could provide one it would be great.

All 3 comments

funding needed: I don't have a Raspberry Pi 4 to work on this issue, if someone could provide one it would be great.

Finally someone lend me a RPI4 to test. I installed Raspbian Buster with Desktop and I updated all libraries to latest.

I tried compiling current raylib master branch (2.6-dev) for the two possible RPI configurations:

  • RPI Desktop (PLATFORM_DESKTOP - standard Linux compilation)
    REQUIRES: sudo raspi-config > Advance Options > GL Driver > G2 GL (Fake KMS)

To compile raylib and examples for this configuration it requires the following command:

make PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_21

For this configuration the following libraries are required:

libxcursor-dev
libxrandr-dev
libxinerama-dev
libxi-dev

The only problem I found was on example linkage, the linker was not able to find -lGL, the library (libGL.so.1) is available at /usr/lib/arm-linux-gnueabihf path. I did a symlink to a known path:

sudo ln -s /usr/lib/arm-linux-gnueabihf/libGL.so.1 /usr/lib/libGL.so

After that everything compiles and works fine. This is the output info about GPU/OpenGL:

INFO: OpenGL 2.1 profile supported
INFO: GPU: Vendor:   Broadcom
INFO: GPU: Renderer: V3D 4.2
INFO: GPU: Version:  2.1 Mesa 19.2.0-rc1
INFO: GPU: GLSL:     1.20
  • RPI Native (PLATFORM_RPI - no desktop required)
    REQUIRES: sudo raspi-config > Advance Options > GL Driver > G1 Legacy

Compilation works ok and program starts on CLI but despite output logs seem correct, program freezes before showing any frame. Info shown:

INFO: OpenGL 2.1 profile supported
INFO: GPU: Vendor:   Broadcom
INFO: GPU: Renderer: VideoCore IV HW
INFO: GPU: Version:  OpenGL ES 2.0
INFO: GPU: GLSL:     OpenGL ES GLSL ES 1.00

Just note that the same happens un pure CLI (no desktop) and CLI (inside desktop).

After testing and further investigation (several hours). I end up finding three relevant references:

Basically Dispmanx code does not work anymore on RPI4 and implementation must be redesigned. Those references contain all needed information. I'm not doing it for the moment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yashrk picture yashrk  ·  5Comments

DarkElvenAngel picture DarkElvenAngel  ·  8Comments

RobLoach picture RobLoach  ·  7Comments

SethArchambault picture SethArchambault  ·  7Comments

ianpan870102 picture ianpan870102  ·  6Comments