We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

gezzuzz
Posts: 1
Joined: Thu Sep 05, 2019 8:04 pm

Compile raylib example for raspberry PI

Thu Sep 05, 2019 8:46 pm

I looking for a way to do simple graphics on a raspberry PI. I have both a zero and 3B i been messing with.
I used buildroot to create a real fast boot time linux system for pi.
Im able to run qt5 graphical examples so i think i have opengl installed right with buildroot.
I came across raylib and it appears to be perfect for what i need to do.
I have compile raylib examples for on both windows and ubuntu (vmware)
What im having trouble understand how can i compile something for raspberry pi from either windows or ubuntu
I have a cross compiler on windows (arm-linux-gnueabihf-gcc) i have compiled simple hello world programs and ran them on the PI.
But when it comes to anything thing using libraries i dont know how it get something to work.
If i could compile one of the raylib example and run it on the pi i would be very happy.

if someone is able to push me into the right direction i would be very happy.

Thank you

jdonald
Posts: 449
Joined: Fri Nov 03, 2017 4:36 pm

Re: Compile raylib example for raspberry PI

Fri Sep 06, 2019 4:06 am

gezzuzz wrote:
Thu Sep 05, 2019 8:46 pm
Im able to run qt5 graphical examples so i think i have opengl installed right with buildroot.
Be careful there as custom buildroots frequently have trouble getting accelerated graphics working. Run glxinfo and check the output if you're getting Broadcom V3D and not softpipe (CPU rendering).
I have a cross compiler on windows (arm-linux-gnueabihf-gcc) i have compiled simple hello world programs and ran them on the PI.
...
If i could compile one of the raylib example and run it on the pi i would be very happy.
raylib is a CMake project. You can cross-compile it like so:

Code: Select all

git clone https://github.com/raysan5/raylib.git && cd raylib
mkdir build; cd build
cmake .. -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \
  -DCMAKE_INSTALL_PREFIX=path/to/destination/raylib
make && make install
But when it comes to anything thing using libraries i dont know how it get something to work.
You have to install those dependency libraries, e.g. for OpenGL:

Code: Select all

sudo dpkg --add-architecture armhf
sudo apt update
sudo apt install libgl1-mesa-dev:armhf

DFansler
Posts: 44
Joined: Sun Aug 31, 2014 12:14 pm

Re: Compile raylib example for raspberry PI

Mon Sep 16, 2019 2:07 pm

I guess I should have listed the steps I have done so far:
1. git clone https://github.com/raysan5/raylib.git && cd raylib - done
2. mkdir build; cd build - done - created build in the raylib dir
3. cmake .. -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \
-DCMAKE_INSTALL_PREFIX=path/to/destination/raylib - failed - bash-cmake command not found

I thought i had gotten further, but this is it for this try!
David

DFansler
Posts: 44
Joined: Sun Aug 31, 2014 12:14 pm

Re: Compile raylib example for raspberry PI

Mon Sep 16, 2019 5:04 pm

update - turns out I had not installed cmake. Once that was done, raylib successfully installed. I ran make on the examples, but when I try to run them in a terminal window, a terminal window appears for a blink of an eye and goes away. Clicking on just Execute does nothing I can see. I am trying to run all by using OpenGL ES 2.o without X11 support.

I have tried to add a path, in Geany's make file to point to raylib/src, but any function from ralib I try gives a compile error of "undefined reference" to what ever function I call.

Any ideas?
David

DFansler
Posts: 44
Joined: Sun Aug 31, 2014 12:14 pm

Re: Compile raylib example for raspberry PI

Tue Sep 17, 2019 12:11 am

Opps - my two posts were meant for another thread! Sorry.
David

ospfeigrp
Posts: 1
Joined: Sun Jan 05, 2020 6:27 pm

Re: Compile raylib example for raspberry PI

Sun Jan 05, 2020 6:32 pm

/path/to/destination/raylib - if you just copy and paste the above command then this or whatever else you put it to is your directory

Return to “Graphics programming”