-
Notifications
You must be signed in to change notification settings - Fork 41
Building on a low‐end system
Compiling and linking C++ code – also known as building – takes a lot of computer resources. These tricks can help you compile redsea on a low-end system like the Raspberry Pi 3 or 4.
By default, the compilation is parallel. This isn't suitable for systems with low RAM. When compiling, use the -j1 option to limit the number of compiler processes:
meson compile -j1This will also make your computer draw less current and help avoid undervoltage issues.
Swapping uses part of the RasPi SD card as extra RAM. By default, the swap size might be too small.
Edit the swap settings:
sudo nano /etc/dphys-swapfileChange the CONF_SWAPSIZE to 2048. Then stop and start the service:
sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile startIf possible, exiting the graphical desktop and compiling in the text-only "console" mode leaves a lot more memory for the compiler.
Another option is to cross-compile, i.e. use a faster computer to build the software and then just transfer the binary to the Raspberry Pi. It's more complicated and involves quite a bit of setting up. For instance, you'll need to find a cross-compilation toolchain for the target system of your choice. Meson supports cross-compilation.