Now having Raspberry pi raylib installation problems

In preparing to use raylib for a raspberry pi class, I tried to install another version of raylib
on a second raspberry pi 3. This first of all was of course updated to the latest raspbian
and the packages updated using the usual pi commands
sudo apt-get update and sudo apt-get dist-upgrade.

I then copied the raylib folder onto this new machine and followed the raysan5/raylib "Compile for Raspberry Pi" instructions page.
I did the sudo apt-get install libopenal1 libopenal -dev with no problem
I tried to compile raylib using make PLATFORM=PLATFORM_RPI and this time it failed with the following:
make: C:/SysGCC/Raspberry/bin/arm-linux-gnueabihf-gcc: Command not found
Makefile:357: recipe for target 'core.o' failed

I do not know what I did correctly the first install to get raylib up without problems.
Compiling my own examples on the second machine also fails.

Perhaps my copy of raylib is not correct in some way, best to start again, perhaps you could recommend exactly
where to get the pi version from (perhaps it is no different from the windows version) or any other possibility you see.
Many thanks


  • edited November 3
    Hey chriswoollard!

    Sorry, it was a path bug introduced with new version, already corrected on GitHub, use develop branch! develop branch also includes some improvements for RPI.

    Please, let me know, I'll be online for a while.
  • Hi raysan5
    Now I can compile and execute the .c examples on my new machine but not the .cpp
    versions, which always worked perfectly on the old machine. For .cpp files I get

    core/core_basic_window2.cpp:22:20: fatal error: raylib.h: No such file or directory
    #include "raylib.h"
    compilation terminated.

    for some reason it cannot find raylib.h
    the c version of this program has no problem finding raylib.h and compiles perfectly

    I just copied core_basic_window.cpp to core_basic_window2.cpp to get a unique filename
    by the way
  • Did it work before? By default the provided Makefile is configured only for C compiling (using GCC). You can just edit the Makefile and change the line:
    # Define default C compiler: gcc
    CC = gcc
    # Define default C++ compiler: g++
    CC = g++
  • Hi raysan5
    Tried the above with no luck, raylib.h still a problem, my output below:

    pi@raspberrypi:~/raylib/examples $ make core/core_basic_window2 PLATFORM=PLATFORM_RPI -B RAYLIB_Path=..
    g++ -L. -L../release/libs/rpi -L../src -L/opt/vc/lib core/core_basic_window2.cpp -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal -o core/core_basic_window2
    core/core_basic_window2.cpp:22:20: fatal error: raylib.h: No such file or directory
    #include "raylib.h"
    compilation terminated.
    : recipe for target 'core/core_basic_window2' failed
    make: *** [core/core_basic_window2] Error 1

    Does build core_basic_window for C but not the slightly renamed

    For some reason on my other pi, everything works though I do not want to break that by reinstalling raylib. Very strange - must have done SOMETHING to that pi to get it happy

    any advise most welcome

  • Try RAYLIB_PATH=../..
  • sorry, that makes no difference, still raylib.h error no such file
  • There seems to be some problem with include paths... oh, I see! You need to add to compilation -I../release/include
  • Many thanks, unfortunately same problem failing to locate raylib.h - which IS there

    Possible hint, following the install instructions for the pi I there was a problem
    compiling raylib on the pi with the make PLATFORM=PLATFORM_RPI command
    producing the following error:

    pi@raspberrypi:~/raylib/src $
    pi@raspberrypi:~/raylib/src $ make PLATFORM=PLATFORM_RPI
    C:/SysGCC/Raspberry/bin/arm-linux-gnueabihf-gcc -c text.c -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -I. -Iexternal -Iexternal/include -IC:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot/opt/vc/include -IC:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot/opt/vc/include/interface/vmcs_host/linux -IC:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot/opt/vc/include/interface/vcos/pthreads -IC:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot/opt/vc/include/interface/vcos/pthreads -DPLATFORM_RPI -DGRAPHICS_API_OPENGL_ES2
    make: C:/SysGCC/Raspberry/bin/arm-linux-gnueabihf-gcc: Command not found
    Makefile:373: recipe for target 'text.o' failed
    make: *** [text.o] Error 127

    all of raylib is present as far as I can tell

  • Are you using latest raylib version from GitHub develop branch: ?

    That issue was corrected a while ago. Please try that branch.
  • I did indeed install from the ground up a completely new raspberry pi installation on a
    fresh micro sd card, did the normal raspberry pi updates, followed the Compile for Raspberry Pi instructions exactly just 2 hours ago. This installed on the pi the raylib-develop (not just raylib) directory containing all sub directories. Here is the url on the pi's webbrowser I used for the download, said it was last updated 22hrs ago:

    I think that's right, here is the pi error from trying to build core_basic_window.c

    (I tried two makes but only for the .c (not trying for c++ until that works):

    pi@raspberrypi:~/raylib-develop/examples $ make core/core_basic_window PLATFORM=PLATFORM_RPI RAYLIB_PATH=..
    gcc -o core/core_basic_window core/core_basic_window.c -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -std=gnu99 -I. -I../release/include -I../src -I../src/external -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -L. -L../release/libs/rpi -L../src -L/opt/vc/lib -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal -DPLATFORM_RPI
    /usr/bin/ld: cannot find -lGLESv2
    /usr/bin/ld: cannot find -lEGL
    collect2: error: ld returned 1 exit status
    Makefile:344: recipe for target 'core/core_basic_window' failed
    make: *** [core/core_basic_window] Error 1
    pi@raspberrypi:~/raylib-develop/examples $ make core/core_basic_window PLATFORM=PLATFORM_RPI RAYLIB_PATH=../..
    gcc -o core/core_basic_window core/core_basic_window.c -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -std=gnu99 -I. -I../../release/include -I../../src -I../../src/external -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -L. -L../../release/libs/rpi -L../../src -L/opt/vc/lib -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal -DPLATFORM_RPI
    core/core_basic_window.c:22:20: fatal error: raylib.h: No such file or directory
    #include "raylib.h"
    compilation terminated.
    Makefile:344: recipe for target 'core/core_basic_window' failed
    make: *** [core/core_basic_window] Error 1

    hope this helps
    many thanks
  • PS I think the recent pi operating system has moved the GLESv2 and EGL libraries somewhere not expected
  • edited November 4
    ok, I see... actually, it's not a big issue... just a paths-related problem...

    When compiling, -I<path> defines paths to #include files and -L<path> defines paths to libraries required by -l<libname>.

    Just tried it last week on my RPI B+, updated to latest OS version... I'll try a closer look on Monday...
  • well I guess adding -L to the make command would work but I do not know where these libraries are now on the pi. Probably in the past I did something to rectify this while experimenting as I do have one pi working with raylib. Perhaps someone does know. If you do find the answer to resolving this on the current pi perhaps you could edit the "Compile for Raspberry Pi" page with the info.
  • Yeah, sure, I'll try it on Monday... sorry for the inconvenience...
  • Many thanks, raylib is great, just need to get it working on the pi again
  • edited November 7
    Hi chriswoollard,

    Tested again latest raylib develop branch on my RPI 1 B+ with latest Raspbian Jessie and everything compiles and works ok with make PLATFORM=PLATFORM_RPI.

    Also tested raylib with latest Raspbian Stretch on my RPI Zero W and... effectively, it fails on finding EGL and GLESv2. After some investigation I found those libraries were renamed on new Raspbian Stretch to brcmEGL and brcmGLESv2.

    Corrected in latest commit in raylib develop branch. Please, let me know if it works now! :smile:
  • Many thanks, I can now compile the C example on my Pi3B
    here is an example:
    pi@raspberrypi:~/raylib/examples $ make core/core_basic_window PLATFORM=PLATFORM_RPI -B RAYLIB_Path=..
    g++ -o core/core_basic_window core/core_basic_window.c -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -std=gnu99 -I. -I../release/include -I../src -I../src/external -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -L. -L../release/libs/rpi -L../src -L/opt/vc/lib -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -lopenal -DPLATFORM_RPI
    cc1plus: warning: command line option ‘-std=c99’ is valid for C/ObjC but not for C++
    cc1plus: warning: command line option ‘-std=gnu99’ is valid for C/ObjC but not for C++
    cc1plus: warning: command line option ‘-fgnu89-inline’ is valid for C/ObjC but not for C++

    The executable is created and works:

    on trying a C++ compile I find:
    pi@raspberrypi:~/raylib/examples $ make chris/core_basic_window PLATFORM=PLATFORM_RPI -B RAYLIB_PATH=..
    g++ -L. -L../release/libs/rpi -L../src -L/opt/vc/lib chris/core_basic_window.cpp -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -lopenal -o chris/core_basic_window
    chris/core_basic_window.cpp:22:20: fatal error: raylib.h: No such file or directory
    #include "raylib.h"
    compilation terminated.
    : recipe for target 'chris/core_basic_window' failed
    make: *** [chris/core_basic_window] Error 1

    So C does work but not C++, I created a directory called chris and put the .CPP version of core_basic_window in there just to test things.

    Great we can now work in C. Possibly the problems are due to us using a raspberry pi 3b rather than your machines. Will order the required interface and clone my old micro sd card which compiles raylib C++ files no problem. Cannot remember now what I did to that one when experimenting with OpenGL and C++. Then I will experiment further.

    Your help is very much appreciated!
  • Hey chriswoollard! Glad to read it works!

    Actually the issue with you compilation lines is the RAYLIB_PATH, it's not required any more on compilation line. Just check:

    Now C/C++ should work ok...
  • Have installed the new library correctly thus:
    pi@raspberrypi:~ $ sudo apt-get install libglfw3
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Suggested packages:
    The following NEW packages will be installed:
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 43.7 kB of archives.
    After this operation, 126 kB of additional disk space will be used.
    Get:1 stretch/main armhf libglfw3 armhf 3.2.1-1 [43.7 kB]
    Fetched 43.7 kB in 25s (1,734 B/s)
    Selecting previously unselected package libglfw3:armhf.
    (Reading database ... 122790 files and directories currently installed.)
    Preparing to unpack .../libglfw3_3.2.1-1_armhf.deb ...
    Unpacking libglfw3:armhf (3.2.1-1) ...
    Setting up libglfw3:armhf (3.2.1-1) ...
    Processing triggers for libc-bin (2.24-11+deb9u1) ...
    pi@raspberrypi:~ $

    then tried a straight c compile of core/core_basic_window thus:

    pi@raspberrypi:~/raylib/examples $ make core/core_basic_window PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_21
    gcc -o core/core_basic_window core/core_basic_window.c -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -no-pie -D_DEFAULT_SOURCE -I. -I../release/include -I../src -I../src/external -L. -L../release/libs/linux -L../src -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -DPLATFORM_DESKTOP
    /usr/bin/ld: cannot find -lGL
    collect2: error: ld returned 1 exit status
    Makefile:344: recipe for target 'core/core_basic_window' failed
    make: *** [core/core_basic_window] Error 1
    pi@raspberrypi:~/raylib/examples $

    seems to have library problems
  • edited November 7
    Ok, seems not to be clear enough in the Wiki... you have two options now to use raylib on RPI, use it natively in console mode (probably the option you want) or use it in Linux desktop environment (in the graphic Window environment, creating raylib program with window). GLFW3 is just required for the second option.

    You should use to compile src code:


    You should use to compile examples:


    That's it.

    EDIT: Just updated Wiki to be clearer.
  • Fantastic ray, it is now indeed working for C on the pi3b.
    Cpp still has the raylib.h not found error (when make uses g++ instead of gcc, but will work on that when I can get my original micro sd card cloned and can experiment with a copy. Many thanks indeed.
Sign In or Register to comment.