Skip to content

Compile from source

Dimitris Panokostas edited this page Nov 19, 2026 · 58 revisions

Compile from Source

Compiling Amiberry from source

Tip

Want to test the latest features without building? You can download the latest automated Development Builds (created from the master branch) which are built automatically for macOS and Linux.

Dependencies

FFmpeg and libwebp are optional, but support for both is enabled by default.

  • FFmpeg (5.1 or newer) decodes compressed genlock video and its audio, and the ZZ9000's FLAC, Ogg Vorbis, MPEG-2, WebM and Matroska formats. CMake looks for libavformat >= 59.27, libavcodec >= 59.37, libavutil >= 57.28, libswscale >= 6.7, and libswresample >= 4.7. Without them the build continues: genlock video input is limited to uncompressed 24-bit AVI files without audio, and the ZZ9000 offers only its MP3, JPEG/PNG and MPEG-1 formats.
  • libwebp with libwebpdemux decodes WebP stills and animations for the ZZ9000 picture DataTypes, zz9k-view and ZZPlay. Without it, WebP is not offered to the guest.

Linux

You'll need the development version of the required packages. For example, on Debian-based distros:

  sudo apt install build-essential git cmake libsdl3-dev libsdl3-image-dev libflac-dev libmpg123-dev libpng-dev libmpeg2-4-dev libserialport-dev libportmidi-dev libenet-dev libpcap-dev libzstd-dev libcurl4-openssl-dev nlohmann-json3-dev libdbus-1-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libswresample-dev libwebp-dev

On Distros that use RPM instead (e.g. Fedora):

  sudo dnf install gcc gcc-c++ git cmake SDL3-devel SDL3_image-devel flac-devel libmpg123-devel libpng-devel libmpeg2-devel libserialport-devel portmidi-devel enet-devel libpcap-devel libzstd-devel libcurl-devel json-devel dbus-devel ffmpeg-free-devel libwebp-devel

Or if you're using an Arch-based distro (e.g. Manjaro):

  sudo pacman -S base-devel cmake sdl3 sdl3_image flac mpg123 libmpeg2 libserialport portmidi enet libpcap zstd curl nlohmann-json ffmpeg libwebp

FreeBSD

Install the packages used by the FreeBSD build:

    sudo pkg install cmake ninja pkgconf git sdl3 sdl3_image flac mpg123 ffmpeg webp png curl nlohmann-json libsysinfo libglvnd dbus libserialport enet portmidi libmpeg2 libpcap zstd

Haiku

Amiberry builds on Haiku R1/beta for 64-bit x86. The release package is built on R1/beta6. Install the packages used by that build:

    pkgman install cmake ninja git pkgconfig binutils coreutils gcc libsdl3_devel sdl3_image_devel flac_devel mpg123_devel libpng16_devel zlib_devel zstd_devel enet_devel portmidi_devel libmpeg2_devel nlohmann_json ffmpeg8_devel libwebp_devel curl_devel mesa_devel

HaikuPorts has no libserialport package and no libpcap port that works for uaenet.device, so turn both features off:

    cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/boot/system -DUSE_LIBSERIALPORT=OFF -DUSE_UAENET_PCAP=OFF
    cmake --build build

The nlohmann_json package installs its CMake config outside CMake's default search paths. If configuring fails to find it, point nlohmann_json_DIR at the directory that holds nlohmann_jsonConfig.cmake (search /boot/system for it). Native file dialogs are not built on Haiku; the built-in file browser is used.

On Haiku, CMake installs data files under data/, documentation under documentation/ and man pages under documentation/man of the install prefix, following Haiku's own layout. The release .hpkg is made by staging cmake --install into a DESTDIR and running .github/scripts/haiku-package.sh <build-dir> <stage-dir> <output.hpkg>.

macOS

Under macOS, you will need to install the required libraries. For example by using Homebrew:

    brew install cmake sdl3 mpg123 sdl3_image flac ffmpeg webp libmpeg2 libserialport portmidi enet libpcap zstd dylibbundler nlohmann-json

macOS code signing

The macOS CMake build creates an .app bundle and signs the local/intermediate bundle after dylibbundler has copied dependencies and install_name_tool has adjusted load commands. This is enabled by default with:

    -DMACOS_CODESIGN_BUNDLE=ON

For normal local builds, an empty MACOS_CODESIGN_IDENTITY uses ad-hoc signing (-). To sign with a real certificate, pass the identity explicitly:

    cmake -B build -DMACOS_CODESIGN_IDENTITY="Developer ID Application: Name (TEAMID)"

You can pass hardened-runtime options when needed:

    cmake -B build -DMACOS_CODESIGN_IDENTITY="Developer ID Application: Name (TEAMID)" -DMACOS_CODESIGN_OPTIONS=runtime,hard

If signing is not wanted for a local troubleshooting build, disable it:

    cmake -B build -DMACOS_CODESIGN_BUNDLE=OFF

Mac App Store builds (-DMACOS_APP_STORE=ON) require MACOS_CODESIGN_IDENTITY to be set explicitly. Use a real signing identity for distribution; - should only be used deliberately for local smoke tests.

The automated macOS CI still re-signs the final universal bundle after the x86_64 and arm64 bundles have been merged with lipo, before notarization.

Windows

Amiberry supports Windows x86_64 and ARM64, both built with llvm-mingw (clang + lld + libc++ targeting the mingw-w64 ABI). Dependencies are managed through vcpkg, including FFmpeg and libwebp. vcpkg's FFmpeg port does not build for arm64-mingw-dynamic, so ARM64 builds include libwebp but not FFmpeg.

The previous MinGW-w64 / GCC toolchain has been retired. CI and local builds now use llvm-mingw exclusively, matching the toolchain used for the Windows-on-Arm port.

Prerequisites

Setting up llvm-mingw

1. Download a release from the llvm-mingw releases page. Use the ucrt-x86_64 flavor for x64 builds, or ucrt-aarch64 for ARM64. Extract it somewhere stable, for example C:\llvm-mingw.

2. Set the LLVM_MINGW_ROOT environment variable to the extracted directory (e.g. C:\llvm-mingw). The CMake toolchain file uses this to find the prefixed clang wrappers (x86_64-w64-mingw32-clang, x86_64-w64-mingw32-clang++, etc.) regardless of PATH ordering. You can also add C:\llvm-mingw\bin to your PATH to invoke clang directly.

Setting up vcpkg

1. Clone and bootstrap vcpkg:

git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
cd C:\vcpkg
.\bootstrap-vcpkg.bat

2. Set the VCPKG_ROOT environment variable to C:\vcpkg (or wherever you cloned it). You can set this as a system or user environment variable.

Building from the command line

$env:LLVM_MINGW_ROOT = "C:\llvm-mingw"
$env:VCPKG_ROOT = "C:\vcpkg"

# x64
cmake --preset windows-release
cmake --build out/build/windows-release -j12

# ARM64
cmake --preset windows-arm64-release
cmake --build out/build/windows-arm64-release -j12

The windows-release preset chainloads cmake/Toolchain-x86_64-w64-mingw32.cmake; the windows-arm64-release preset chainloads cmake/Toolchain-aarch64-w64-mingw32.cmake. Both make vcpkg build dependencies with the same llvm-mingw clang as the Amiberry binaries.

Building with CLion

1. Open the Amiberry project in CLion.

2. Go to Settings โ†’ Build, Execution, Deployment โ†’ Toolchains and add a new toolchain pointing at C:\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe (and x86_64-w64-mingw32-clang++.exe for C++). Set Make to mingw32-make from llvm-mingw or any GNU make on PATH (Ninja is used for the actual build).

3. Go to Settings โ†’ Build, Execution, Deployment โ†’ CMake and select the new toolchain for your build profile.

4. In the CMake options field, add:

-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${sourceDir}/cmake/Toolchain-x86_64-w64-mingw32.cmake -DVCPKG_TARGET_TRIPLET=x64-mingw-dynamic

Note

Use x64-mingw-dynamic for x64 or arm64-mingw-dynamic for ARM64. The matching static triplets also work with llvm-mingw because vcpkg picks them up from the chainloaded toolchain file.

5. Make sure VCPKG_ROOT and LLVM_MINGW_ROOT are set โ€” either as system environment variables, or added in CLion's run/debug configuration environment variables.

6. CLion should now be able to configure and build the project using its built-in CMake integration.

Android

The Android app lives in the android/ directory and is built with Gradle. Gradle builds the top-level CMake project through the Android NDK. CMake FetchContent downloads the native dependencies (SDL3, SDL3_image, FLAC, libpng, zstd, curl with mbedTLS, PortMidi, libserialport, ENet and others) and builds them from source at pinned versions, so you don't need any host development packages.

Note

The Android version is in Closed Testing on Google Play. See Android for availability. The automated development builds don't include Android packages.

Prerequisites

  • JDK 17 or newer
  • Android SDK Platform 36
  • Android NDK 29.0.14206865
  • CMake 3.22.1 from the Android SDK manager

Android Studio can install the SDK components for you. Open the android/ directory as the project. On the command line, the Gradle wrapper (android/gradlew) downloads Gradle itself.

Building a debug APK

cd android
./gradlew assembleDebug      # gradlew.bat assembleDebug on Windows

The APK is written to android/app/build/outputs/apk/debug/app-debug.apk. Install it with ./gradlew installDebug or adb install -r app/build/outputs/apk/debug/app-debug.apk.

Debug builds use the application ID com.blitterstudio.amiberry.debug, so they install next to the Google Play version without replacing it.

Release builds

cd android
./gradlew assembleRelease    # APK
./gradlew bundleRelease      # Android App Bundle (AAB) for Google Play
  • Signing: release signing reads android/keystore.properties, which is git-ignored and has the keys storeFile, storePassword, keyAlias and keyPassword. Without that file the release output is unsigned.
  • Crashlytics: Firebase Crashlytics is only enabled when android/app/google-services.json exists. Contributors can build without it.
  • Version numbers: versionName comes from the VERSION in the top-level CMakeLists.txt. versionCode is generated automatically; set it explicitly with -PANDROID_VERSION_CODE=<number> if needed.

Build notes

  • Only the arm64-v8a and x86_64 ABIs are built. The minimum supported version is Android 10 (API 29).
  • On Android, CMake turns off these options:
    • USE_VIDEOGRAB, USE_FFMPEG and USE_WEBP
    • USE_UAENET_PCAP and USE_UAENET_TAP
    • USE_IPC_SOCKET and USE_GPIOD
    • USE_LIBMPEG2 and USE_MPG123
    • USE_PPC and USE_QEMU_PPC
  • On Android, the app is built with AMIBERRY_NO_IMGUI: the launcher, in-game menu, dialogs and on-screen keyboard replace the built-in ImGui GUI.
  • Windows hosts: to stay under the Windows path-length limit, the FetchContent cache lives in a short path at the root of the same drive, such as D:/.amiberry-fc/<hash>/<abi>-<buildtype>. You can delete this folder at any time; the next configure fills it again. Other hosts keep the cache inside the source tree (.fc/).

Clone with submodules

Amiberry uses git submodules for some dependencies (e.g. native file dialogs). Clone with --recursive to get everything:

  git clone --recursive https://github.com/BlitterStudio/amiberry.git

If you already cloned without --recursive, initialize the submodules separately:

  git submodule update --init --recursive

Note

Building without submodules still works โ€” optional features like native OS file dialogs will be disabled and the built-in file browser is used instead.

Supported architectures

Amiberry builds on the following architectures:

  • ARM64 (AArch64) โ€” Full JIT support for maximum performance
  • x86-64 (AMD64) โ€” Full JIT support
  • RISC-V 64-bit โ€” Interpreter only (no JIT)
  • LoongArch64 โ€” Interpreter only (no JIT)

The architecture is auto-detected by CMake. No special flags are needed. 32-bit hosts are not supported: CMake stops with an error when the target ABI does not have 8-byte pointers.

Build Amiberry

Amiberry uses CMake to build. The following commands will create a build directory, configure the build, and then compile the source code:

  cmake -B build && cmake --build build

You can also use Ninja, if you prefer:

  cmake -B build -G Ninja && cmake --build build

CMake's default installation prefix is /usr/local/. To change this, specify a different prefix when invoking CMake. For example, to install under /opt, use:

  cmake -B build -G Ninja -DCMAKE_INSTALL_PREFIX=/opt && cmake --build build

Build time options

Amiberry has a few different options that can be found in the main CMakeLists.txt file. Some are disabled by default, as they are optional, others are enabled by default but can be turned off in order to build a minimal version with fewer external dependencies if the user wants.

The following options are enabled by default:

  • USE_LIBSERIALPORT - Uses the libserialportfor serial port emulation
  • USE_LIBENET - Use library enet for network emulation
  • USE_PORTMIDI Use PortMidi for MIDI emulation
  • USE_LIBMPEG2 - Use libmpeg2 for MPEG2 decoding (CD32 FMV)
  • USE_UAENET_PCAP - Use libpcap for uaenet.device emulation
  • USE_VIDEOGRAB - Use SDL3 for genlock video files and camera input. This is disabled on Android and iOS.
  • USE_FFMPEG - Use FFmpeg 5.1 or newer for compressed genlock video and audio and for the ZZ9000's FLAC, Vorbis, MPEG-2, WebM and Matroska support. It no longer depends on USE_VIDEOGRAB. Missing FFmpeg development libraries leave those formats out. Disabled on Android and iOS.
  • USE_WEBP - Use libwebp and libwebpdemux for ZZ9000 WebP stills and animations. Missing libraries leave WebP out. Disabled on Android and iOS.
  • USE_PPC - Enables PowerPC accelerator board support
  • USE_QEMU_PPC - Enables runtime loading of the optional QEMU-UAE PPC plugin
  • USE_86BOX - Use 86Box for the x86 bridgeboards and the RTG graphics chips. It replaced PCem; the USE_PCEM option is gone, and setting it only prints a warning. Disabled on iOS.
  • USE_86BOX_DYNAREC - Build 86Box's x86 recompiler for the bridgeboard PCs. Needs USE_86BOX. It has one backend per binary, so CMake turns it off for macOS universal builds and for architectures without a backend (RISC-V, LoongArch). The bridgeboards then use the interpreter.
  • USE_MPG123 - Use mpg123 for MP3 decoding. Disabled on Android.
  • USE_UAENET_TAP - Use a TAP device for uaenet.device emulation (Linux only). Disabled on Android and iOS.
  • USE_ZSTD - Use Zstandard for CHD compressed disk images. Disabled on iOS.
  • USE_IPC_SOCKET - Use a local socket to control the emulator from another program (a Unix socket, or a named pipe on Windows). See IPC socket support. Disabled on Android and iOS.
  • USE_OPENGL - Use the OpenGL back-end with shader support. Mutually exclusive with USE_VULKAN.
  • WITH_STRIP - Strip symbols from the Release binary.

The following CMake options are disabled by default. You can choose to enable them, if you want to use them (note that some require extra libraries):

  • USE_GPIOD - Use libgpiod to control GPIO LEDs (Power, HDD, Floppy). Only makes sense on boards that have GPIO pins (e.g. Raspberry Pi). You will obviously need the library installed as well, to make use of this.
  • USE_GLES - Use OpenGL ES instead of desktop OpenGL, for embedded Linux without GLX. Only available together with USE_OPENGL.
  • USE_VULKAN - Use the Vulkan back-end for rendering (experimental). Mutually exclusive with USE_OPENGL. If both are set, CMake turns USE_OPENGL off.
  • BUNDLE_SDL - Bundle SDL3 shared libraries into Linux packages, useful for distributions that do not provide a new enough SDL3 package.
  • WITH_OPTIMIZE - Generates the most optimal march and/or mcpu flags for your cpu.
  • WITH_LTO - Uses Link Time Optimizations. Will take a lot of time. EXPERIMENTAL!
  • WITH_PGO_GENERATE and WITH_PGO_USE - Generate, then use, profile data for Profile-Guided Optimization. PGO_PROFILE_DIR names the directory that holds the profile data.
  • AMIBERRY_NATIVE_APPLE_UI - Build the native Apple UI layer (Swift) into the app, in place of the built-in ImGui GUI. macOS and iOS only, and it cannot be combined with USE_VULKAN.
  • AMIBERRY_NO_IMGUI - Build without the built-in ImGui GUI, so the platform's own UI takes its place. Only the Android app uses it; CMake stops with an error on other platforms.

Maximum input devices

MAX_INPUT_DEVICES is a preprocessor define, not a CMake option. It sets how many input devices of each type (joysticks, mice, keyboards) the configuration holds, and defaults to 20. A lower value makes the in-memory configuration smaller. Valid values are 4 to 32; the build fails outside that range. For example:

  cmake -B build -DCMAKE_C_FLAGS=-DMAX_INPUT_DEVICES=8 -DCMAKE_CXX_FLAGS=-DMAX_INPUT_DEVICES=8

QEMU-UAE PPC plugin

Source builds do not download or build QEMU automatically. If you want to bundle a prebuilt QEMU-UAE PPC plugin into your install/package layout, pass it with QEMU_UAE_PLUGIN:

cmake -B build -DUSE_PPC=ON -DUSE_QEMU_PPC=ON -DQEMU_UAE_PLUGIN=/path/to/qemu-uae.so
cmake --build build

QEMU_UAE_PLUGIN must point to an existing plugin artifact and requires both USE_PPC=ON and USE_QEMU_PPC=ON. See QEMU-UAE PPC Plugin for runtime placement and smoke tests.

Debug build

By default, the build type is Release, which creates optimized binaries without debug symbols. If you want to change that to Debug (useful if you want to use a debugger and troubleshoot something), add this when invoking the first CMake command:

-DCMAKE_BUILD_TYPE=Debug

Local installation

After the build is finished, you can use the following command to install Amiberry locally in the default PREFIX directory (/usr/local/):

sudo cmake --install build

After installation, you may want to update the relevant desktop, mime, and man databases accordingly. This is not handled by CMake so you must do that yourself. For example (replace @CMAKE_INSTALL_PREFIX@ with what you gave CMAKE_INSTALL_PREFIX):

update-desktop-database
update-mime-database "@CMAKE_INSTALL_PREFIX@/share/mime"
gtk-update-icon-cache -f -t "@CMAKE_INSTALL_PREFIX@/share/icons/hicolor"

Packaging

There are currently several packaging options configured with CPack:

  • TGZ (tar.gz) archive
  • DragNDrop DMG image (macOS only)
  • DEB package (Linux only)
  • RPM package (Linux only)

By default, all the available packaging options for the platform will be built, unless you request a specific one. If you only want a specific one, use the -G <package> parameter. For example, the following will only build the DEB package on Linux:

cpack --config build/CPackConfig.cmake -G DEB

More documentation regarding packaging with CPack can be found here.

AppImage

Release AppImages are built with packaging/appimage/build-appimage.sh, which builds Amiberry with BUNDLE_SDL=ON, runs the behavioral tests, stages the install tree into an AppDir, verifies it, and writes the AppImage plus its .zsync file:

bash packaging/appimage/build-appimage.sh --version 8.6.0 --channel stable --output-dir dist

The script must run on a native x86_64 or aarch64 host and downloads its pinned tools (linuxdeploy, appimagetool, the type-2 runtime, zsync and the QEMU-UAE plugin) with checksum verification. Official images are built on Ubuntu 22.04, which sets their glibc 2.35 compatibility floor; an image built on a newer distribution will not run on older ones. Run bash packaging/appimage/build-appimage.sh --help for all options.

Clone this wiki locally