Skip to content

Building & Installing

LekKit edited this page Oct 8, 2024 · 11 revisions

Get binaries from CI

Staging branch is continuously built in GitHub CI for Linux x86_64, Windows x86_64 and MacOS x86_64. Stable releases also include a binary build.

Artifacts Release

Installing packages for your distribution

Officially maintained AUR packages exist (Staging rvvm-git and stable rvvm).

AUR

Building RVVM using GNU Make (Recommended)

Basic usage (Building a standalone VM binary):

git clone https://github.com/LekKit/RVVM
cd RVVM
make
cd release.linux.x86_64
./rvvm_x86_64 -h

Build process requires make, git and either gcc or clang.

Additionally, libx11-dev or libsdl2-dev will be needed for the respective GUI backends to be built.

Building on Windows

The same steps may be replicated using a MinGW build environment, such as w64devkit.

There is no need to install SDL libraries as RVVM has a self-contained Win32 GUI backend.

Cross-compilation

To cross-compile RVVM for a different host architecture / operating system, simply pass the C compiler executable as CC variable.

Sometimes passing the OS varible may be needed if cross-compiling to an OS the build system doesn't recognize yet.

Examples:

make CC=x86_64-w64-mingw32-gcc
make CC="zig cc -target aarch64-macos"
make CC=riscv64-linux-gnu-gcc
make CC=x86_64-unknown-redox OS=Redox

Explaining useflags

The build system supports disabling/enabling features via useflags (For debugging, binary size reduction). Invoke make help target to show available useflags and targets.

image

List of useflags with their default values:

# Debugging
USE_DEBUG=0          # Build optimized release with debug symbols
USE_DEBUG_FULL=0     # Build unoptimized -Og full debug build, not for production use!
USE_SPINLOCK_DEBUG=1 # Enable deadlock debugging (Minimal runtime overhead, recommended for production)

# CPU features
USE_RV32=1 # Enable riscv32 CPU support
USE_RV64=1 # Enable riscv64 CPU support
USE_FPU=1  # Enable floating-point (F/D) CPU extensions

# Infrastructure
USE_LIB=1 # Enable installing a shared librvvm library
USE_JNI=1 # Include native JNI bindings in shared librvvm (~1kb size overhead)
USE_LIB_STATIC=0 # Enable installing a static librvvm library
USE_ISOLATION=1  # Enable seccomp/pledge process isolation

# Acceleration/accessibility
USE_JIT=1 # Enable RVJIT accelerator (Ignored on unsupported host arches) 
USE_GUI=1 # Enable GUI VM window (Graphical display & input)
USE_NET=1 # Enable unprivileged userland networking stack

USE_SDL=2 # Enable SDL1/SDL2 GUI backend based on the 1/2 value - enabled by default on MacOS, Serenity
USE_X11=1 # Enable X11 GUI backend - enabled by default on Linux, *BSD, Solaris
USE_WIN32_GUI=1 # Enable Win32 GUI backend - enabled by default on Windows
USE_HAIKU_GUI=1 # Enable Haiku GUI backend - enabled by default on Haiku

# Devices
USE_FDT=1  # Enable automatic FDT generation, dtb file has to be manually passed otherwise
USE_PCI=1  # Enable PCI support in ATA, etc devices
USE_VFIO=1 # Enable VFIO PCI passthrough feature on Linux host

Example:

make USE_NET=0 USE_SDL=2 USE_VFIO=0 USE_LIB_STATIC=1 all lib

Building RVVM using CMake

For some developers and environments it might be more convenient to use CMake:

git clone https://github.com/LekKit/RVVM
cd RVVM
cmake -S. -Bbuild
cmake --build build --target all
cd build
./rvvm -h

CMake build system supports same useflags as Make.

It is also possible to build on Windows using CMake + MSVC, but compiling with MSVC should be avoided if possible due to worse compiler opimizations.