These steps install the official prebuilt raylib-6.0_linux_amd64.tar.gz release under /usr/local.
The prebuilt archive contains the raylib headers and libraries, but does not include a raylib.pc file for pkg-config, so we create one manually.
cd ~/Downloads
tar -xzf raylib-6.0_linux_amd64.tar.gz
cd raylib-6.0_linux_amd64Optional: inspect the archive:
lsYou should have at least:
include/
lib/
Copy the raylib headers to /usr/local/include:
sudo cp -r include/* /usr/local/include/Verify:
ls /usr/local/include/raylib.hCopy the prebuilt raylib libraries to /usr/local/lib:
sudo cp -a lib/libraylib* /usr/local/lib/Refresh the dynamic linker cache:
sudo ldconfigVerify that the files were installed:
ls /usr/local/lib/*raylib*Check that the dynamic linker can find raylib:
ldconfig -p | grep raylibYou should see entries pointing to /usr/local/lib, such as:
libraylib.so.600
libraylib.so
The raylib 6.0 prebuilt Linux archive does not include raylib.pc.
You can confirm with:
find . -name 'raylib.pc'Or inspect all relevant raylib files:
find . -name 'raylib.pc' -o -name 'libraylib*' -o -name 'raylib.h'The archive should contain something similar to:
./include/raylib.h
./lib/libraylib.a
./lib/libraylib.so.600
./lib/libraylib.so.6.0.0
./lib/libraylib.so
Create the system-local pkg-config directory:
sudo mkdir -p /usr/local/lib/pkgconfigCreate /usr/local/lib/pkgconfig/raylib.pc:
sudo tee /usr/local/lib/pkgconfig/raylib.pc >/dev/null <<'EOF'
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: raylib
Description: A simple and easy-to-use library to enjoy videogames programming
Version: 6.0
Libs: -L${libdir} -lraylib
Libs.private: -lm -lpthread -ldl -lrt -lX11
Cflags: -I${includedir}
EOFCheck that pkg-config can now find raylib:
pkg-config --modversion raylibExpected output:
6.0
Check the compiler and linker flags:
pkg-config --cflags --libs raylibExpected output should look similar to:
-I/usr/local/include -L/usr/local/lib -lraylib
The whole installation can also be reduced to:
#!/usr/bin/env bash
set -e
RAYLIB_VERSION="6.0"
ARCHIVE="raylib-${RAYLIB_VERSION}_linux_amd64.tar.gz"
DIR="raylib-${RAYLIB_VERSION}_linux_amd64"
cd ~/Downloads
tar -xzf "$ARCHIVE"
cd "$DIR"
sudo cp -r include/* /usr/local/include/
sudo cp -a lib/libraylib* /usr/local/lib/
sudo ldconfig
sudo mkdir -p /usr/local/lib/pkgconfig
sudo tee /usr/local/lib/pkgconfig/raylib.pc >/dev/null <<'EOF'
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: raylib
Description: A simple and easy-to-use library to enjoy videogames programming
Version: 6.0
Libs: -L${libdir} -lraylib
Libs.private: -lm -lpthread -ldl -lrt -lX11
Cflags: -I${includedir}
EOF
echo
echo "raylib installed successfully."
echo
echo "Installed version:"
pkg-config --modversion raylib
echo
echo "Compiler/linker flags:"
pkg-config --cflags --libs raylib
echo
echo "Dynamic linker entries:"
ldconfig -p | grep raylibSave that as, for example:
install-raylib-6.0.sh
Then make it executable and run it:
chmod +x install-raylib-6.0.sh
./install-raylib-6.0.sh