Skip to main content

Build prerequisites

Qt6 development packages, nasm, additional build tools, and a C++23 capable compiler are required. A Rust toolchain is also required for building the JavaScript engine. You can install it via rustup or your system’s package manager.
We currently use gcc-14 and clang-21 in our CI pipeline. If these versions are not available on your system, see Meta/find_compiler.py for the minimum compatible version.
CMake 3.30 or newer must be available in $PATH.

Platform-specific dependencies

1

Install base dependencies

sudo apt install autoconf autoconf-archive automake build-essential ccache cmake curl fonts-liberation2 git libdrm-dev libgl1-mesa-dev libtool nasm ninja-build pkg-config python3-venv qt6-base-dev qt6-tools-dev-tools qt6-wayland tar unzip zip
2

Install CMake 3.30 or newer

This repository is Ubuntu-only
# Add Kitware GPG signing key
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null

# Use the key to authorize an entry for apt.kitware.com in apt sources list
echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/kitware.list

# Update apt package list and install cmake
sudo apt update -y && sudo apt install cmake -y
3

Install a C++23-capable compiler

4

Install audio support (optional)

sudo apt install libpulse-dev

Build steps

Using ladybird.py

The simplest way to build and run ladybird is via the ladybird.py script:
# From /path/to/ladybird
./Meta/ladybird.py run
./Meta/ladybird.py run
If you want to run other applications, such as the JS REPL or the WebAssembly REPL, specify an executable with ./Meta/ladybird.py run <executable_name>.

The user interfaces

Ladybird will be built with one of the following browser frontends, depending on the platform:
  • AppKit - The native UI on macOS
  • Qt - The UI used on all other platforms
  • Android UI - The native UI on Android
The Qt UI is available on platforms where it is not the default as well (except on Android). To build the Qt UI, install the Qt dependencies for your platform, and enable the Qt UI via CMake:
# From /path/to/ladybird
cmake --preset default -DENABLE_QT=ON
To re-disable the Qt UI, run the above command with -DENABLE_QT=OFF.

Custom CMake build directory

The script Meta/ladybird.py and the default preset in CMakePresets.json both define a build directory of Build/release. For distribution purposes, or when building multiple configurations, it may be useful to create a custom CMake build directory.
cmake --preset default -B MyBuildDir
# optionally, add -DCMAKE_CXX_COMPILER=<suitable compiler> -DCMAKE_C_COMPILER=<matching c compiler>
cmake --build --preset default MyBuildDir
ninja -C MyBuildDir run-ladybird
The install rules in UI/cmake/InstallRules.cmake define which binaries and libraries will be installed into the configured CMAKE_PREFIX_PATH or path passed to cmake --install.

Building with limited system memory

The default build mode will run as many build steps in parallel as possible, which includes link steps; this may be an issue for users with limited system memory. If you wish to reduce the number of parallel link jobs, you may use the LAGOM_LINK_POOL_SIZE cmake option:
cmake --preset default -B MyBuildDir -DLAGOM_LINK_POOL_SIZE=2

Running manually

The Meta/ladybird.py script will execute the run-ladybird and debug-ladybird custom targets. If you don’t want to use the script, you can run the following commands:
ninja -C Build/release debug-ladybird

Resource files

Ladybird requires resource files from the ladybird/Base/res directory in order to properly load icons, fonts, and other theming information. These files are copied into the build directory by special CMake rules.
The expected location of resource files can be tweaked by packagers using the standard CMAKE_INSTALL_DATADIR variable. CMAKE_INSTALL_DATADIR is expected to be a path relative to CMAKE_INSTALL_PREFIX. If it is not, things will break.

Debugging

Debugging with CLion

Ladybird should be built with debug symbols first. This can be done by adding -DCMAKE_BUILD_TYPE=Debug to the cmake command line, or selecting the Build Type Debug in the CLion CMake profile. After running Ladybird with ./Meta/ladybird.py run ladybird, you can use Run → Attach to Process in CLion to connect. If debugging layout or rendering issues, filter the listing for WebContent and attach to that. Now breakpoints, stepping and variable inspection will work.

Debugging with Xcode or Instruments on macOS

If all you want to do is use Instruments, then an Xcode project is not required. Simply run the ladybird.py script as normal, and then make sure to codesign the Ladybird binary with the proper entitlements to allow Instruments to attach to it:
./Meta/ladybird.py build
ninja -C Build/release apply-debug-entitlements
# or
codesign -s - -v -f --entitlements Meta/debug.plist Build/release/bin/Ladybird.app
Now you can open the Instruments app and point it to the Ladybird app bundle.
Building the project with Xcode is not supported. The Xcode project generated by CMake does not properly execute custom targets, and does not handle all target names in the project.

Common build errors

Unable to find a build program corresponding to “Ninja”

This error message is a red herring. We use vcpkg to manage our third-party dependencies, and this error is logged when something went wrong building those dependencies. The output in your terminal will vary depending on what exactly went wrong, but it should look something like:
error: building skia:x64-linux failed with: BUILD_FAILED
Elapsed time to handle skia:x64-linux: 1.6 s

-- Running vcpkg install - failed
CMake Error at Toolchain/Tarballs/vcpkg/scripts/buildsystems/vcpkg.cmake:899 (message):
  vcpkg install failed.  See logs for more information:
  Build/release/vcpkg-manifest-install.log
If the error is not immediately clear from the terminal output, be sure to check the specified vcpkg-manifest-install.log for more information.

Experimental GN build

There is an experimental GN build for Ladybird. It is not officially supported, but it is kept up to date on a best-effort basis by interested contributors. See the GN build instructions in Meta/gn/README.md for more information. In general, the GN build organizes ninja rules in a more compact way than the CMake build, and it may be faster on some systems. GN also allows building host and cross-targets in the same build directory, which is useful for managing dependencies on host tools when cross-compiling to other platforms.

Build docs developers (and LLMs) love