Graphics ~ Installing and Building raylib on a VM - uchicago-cs/chiventure GitHub Wiki
Introduction
This is a guide to installing and building raylib on a UChicago virtual machine (VM). If you have not set up a VM yet, this guide will refer you to the CS department's instructions for doing so. You're welcome to install raylib on your personal machine, but this guide is catered specifically to those working on chiventure using the VM, which is encouraged.
Following these steps will ensure that if/when raylib becomes a dependency of chiventure, your VM will have the library correctly installed so there are no issues with launching games or writing code. Basically, what needs to be done is that after installing raylib's source code we will build the library on the VM so that chiventure, as well as any code we write on the VM or in the chiventure repository, knows that raylib is there and can access all of the information it needs to.
Message me or someone else on the Graphics team via Slack if you have any questions or issues with getting set up!
Configuring the VM
Check out this Headless VM setup guide which should start you off with the VM, if you haven't already. It requires a pretty large download, but this step only needs to be done once.
Note: Everything from here on out should be done through the headless VM.
Initial setup: dependencies and cloning
The VM already has some of the required tools, like GCC, make, and git (which we already have), but there are a few more tools and libraries that need to be installed first.
To install the remaining libraries (one line):
sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev
ALSA is used for audio functionality, Mesa handles some of the graphics, and X11 is responsible for the windowing system.
Now, from the terminal, clone the raylib repository into a new raylib folder, and make that the new working directory:
git clone https://github.com/raysan5/raylib.git raylib
cd raylib/src/
Now we are ready for the build step.
Building
Note: for this step you must be in the src
folder of the raylib directory that we made earlier. Your terminal should be looking something like this: student@cs-vm:~/raylib/src/$ [your commands here]
To compile raylib as a dynamic shared library:
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED
To install the library to the standard directories:
sudo make install RAYLIB_LIBTYPE=SHARED
Note: sudo commands will require you to enter your password before the build starts.
Other commands
If you want to start over and recompile the library:
make clean
If you want to remove raylib from the standard directories:
sudo make uninstall RAYLIB_LIBTYPE=SHARED