Update packages and install required tools:
sudo apt update
sudo apt install build-essential git cmake pkg-config
sudo apt install libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev
sudo apt install libgl1-mesa-dev libglu1-mesa-devClone the official repository:
git clone https://github.com/raysan5/raylib.git
cd raylibmkdir build && cd build
cmake .. -DBUILD_SHARED_LIBS=ON
make -j$(nproc)
sudo make installThis installs raylib into /usr/local/lib.
If you get an error like:
error while loading shared libraries: libraylib.so.XXX: cannot open shared object file
Run the following:
echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/raylib.conf
sudo ldconfigCreate main.c:
#include "raylib.h"
int main(void) {
InitWindow(800, 450, "Hello Raylib!");
SetTargetFPS(60);
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Raylib is working!", 190, 200, 20, LIGHTGRAY);
EndDrawing();
}
CloseWindow();
return 0;
}Build and run:
make
make run