Skip to content

Building on a low‐end system

Oona Räisänen edited this page Nov 7, 2025 · 13 revisions

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.

Limit the number of build threads

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 -j1

This will also make your computer draw less current and help avoid undervoltage issues.

Increase the swap size

Swapping uses part of the RasPi SD card as extra RAM. By default, the swap size might be too small.

If you have the dphys-swapfile service

Edit the swap settings:

sudo nano /etc/dphys-swapfile

Change the CONF_SWAPSIZE to 2048. Then stop and start the service:

sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start

Close the graphical desktop

If possible, exiting the graphical desktop and compiling in the text-only "console" mode leaves a lot more memory for the compiler.

Cross-compile

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.

Clone this wiki locally