Skip to content

02 building and installing compile polo

KeremSoke edited this page Nov 11, 2026 · 2 revisions

Compile Polo

Polo is built with Meson and Ninja. Polo also fetch and compile a patched libweston 16.0.1 rather than the system's libweston. You can compile and run Polo from the build tree without installing it.

Before you begin

Install development packages for your distribution. See Build prerequisites for the full Fedora and Debian/Ubuntu package commands.

The project requires at least:

Component Minimum version
Meson 1.4.0
Vala (valac) 0.56
GLib 2.80
wayland-protocols 1.46

The build also uses a C11-capable compiler, Ninja, Git, pkg-config, and wayland-scanner.

Standard development build

Configure the build directory:

meson setup build

Compile:

meson compile -C build

Ninja normally recompiles only targets affected by the changes.

Build configurations

Use separate build directories when you need different compiler or feature settings. They can coexist in the same source checkout.

Release build

meson setup build-release --buildtype=release
meson compile -C build-release

To prepare a release build for system-wide installation under /usr:

meson setup build-install --prefix=/usr --buildtype=release \
  -Dtests=false \
  -Dtest-protocol=false \
  -Ddebug-protocol=false \
  -Ddebug-kill=false \
  -Dfuzz=false
meson compile -C build-install

The test and development-only protocol options must remain disabled for release builds. See Install Polo for meson install, paths, and the display-manager session entry.

Strict build

meson setup build-strict -Dstrict=true
meson compile -C build-strict
meson test -C build-strict --print-errorlogs

-Dstrict=true enables C -Werror and Vala --fatal-warnings. Polo also checks several generated-C/VAPI type mismatches as fatal compilation errors even when strict mode is off.

AddressSanitizer and UndefinedBehaviorSanitizer

meson setup build-asan \
  -Db_sanitize=address,undefined \
  -Db_lundef=false
meson compile -C build-asan
meson test -C build-asan --print-errorlogs

Keep it in a separate directory from your normal build.

Full headless protocol/integration test build

Many of Polo's protocol integration tests are registered only when the test-protocol option is enabled:

meson setup build-test -Dtest-protocol=true
meson compile -C build-test
meson test -C build-test --print-errorlogs

Do not use this configuration for a release installation. The polo_test_v1 protocol is intended for tests, not normal user sessions.

Polo-specific Meson options

The options below are defined in meson_options.txt:

Option Default Purpose
-Dxwayland=true true Build Polo's vendored XWayland window-manager integration (libpolo-xwm).
-Dshell-ui=true true Build polo-shell-ui, the GTK helper for switcher, menus, dialogs, and on-screen displays.
-Dtests=true true Build and register test suites.
-Dsystemd=true true Enable systemd user integration.
-Dstrict=true false Make C and Vala warnings fatal.
-Dtest-protocol=true false Build the development-only polo_test_v1 protocol and its integration tests.
-Ddebug-protocol=true false Expose the Weston debug protocol to trusted clients; not for releases.
-Ddebug-kill=true false Build support for the development --debug-kill shortcut.
-Dfuzz=true false Build libFuzzer protocol fuzzers; requires Clang and is not for releases.
-Dxdg-desktop-portal-wlr=PATH Empty Set the screen-sharing portal executable explicitly; otherwise Polo searches known locations.

To inspect the options configured in an existing build:

meson configure build

To change an option without creating another build directory:

meson configure build -Dstrict=true
meson compile -C build

You can also reconfigure a build with meson setup build --reconfigure when needed.

How the libweston subproject works

Polo's subprojects/weston.wrap points to Weston 16.0.1 and lists Polo-specific patches in subprojects/packagefiles/weston/.

During setup, Meson prepares this subproject and builds a reduced libweston configuration with:

  • DRM, Wayland, and headless backends;
  • the OpenGL renderer;
  • a private library/module directory;
  • Polo's own XWayland window manager, rather than Weston's standalone XWayland integration.

Polo does not need the distribution's development package for libweston. The repository still requires the underlying system development libraries specified in Build prerequisites.

The installed private libweston libraries live under the configured libdir in a polo subdirectory. They are intentionally kept separate from the distribution's Weston installation.

Run Polo directly from the build tree

Polo's meson.build declares a Meson development environment that sets WESTON_MODULE_MAP and paths to the build-tree executables, data, shell helper, and renderer/backend modules. Use meson devenv when invoking an uninstalled build.

Inside an existing Wayland session

meson devenv -C build polo \
  --exec gtk3-demo \
  --exec gtk3-widget-factory

This starts a nested compositor in a window within the existing Wayland session.

Headless testing

meson devenv -C build polo \
  --backend=headless \
  --renderer=pixman

This is useful for automated tests and investigations that do not need a physical display.

Inside an X11 session

The parent Weston requires its own X11 backend; this is separate from the DRM/Wayland/headless backends built into Polo's private libweston.

weston --backend=x11 --shell=kiosk \
  --width=1280 --height=800 --socket=polo-parent &
WAYLAND_DISPLAY=polo-parent \
  meson devenv -C build polo --fullscreen --exec gtk3-demo

Full MATE development session from a TTY

Log in on an active Linux virtual console and run:

./start-polo.sh

The launcher uses the repository's build directory by default, compiles it if necessary, and starts Polo in DRM session mode. To select another build directory:

POLO_BUILD=build-strict ./start-polo.sh

Or to use an already compiled build without rebuilding:

POLO_NO_BUILD=1 ./start-polo.sh

start-polo.sh uses meson devenv if its chosen build directory exists, even when Polo has also been installed system-wide. It writes logs to ~/polo-logs/.

See Start a session for TTY, logind, DRM, and display-manager instructions.

Running targeted tests

Polo registers its automated tests through Meson. Some tests are available in any build with -Dtests=true; additional protocol tests require -Dtest-protocol=true.

# Full registered suite
meson test -C build-test --print-errorlogs

# VAPI coverage and C/Vala boundary checks
meson test -C build-test --suite vapi --print-errorlogs

# Session management and watchdog checks
meson test -C build-test --suite session --print-errorlogs

# Protocol integration tests
meson test -C build-test --suite protocol --print-errorlogs

# Formatting and Vala linting, when the tools are installed
meson test -C build-test --suite lint --print-errorlogs

For a specific named test, such as the watchdog:

meson test -C build-test watchdog --print-errorlogs

The lint suite only registers clang-format and vala-lint tests when the corresponding executables were available at configuration time. Test results can be inspected through Meson's testlog.txt in the build directory's meson-logs/ subdirectory.

Performance integration tests are also registered by the protocol test definitions when their build conditions are met. See the Testing Polo wiki section for test scope and performance budgets.

Troubleshooting compilation

Meson reports a missing dependency

Check the package lists under Build prerequisites. The Meson setup summary lists optional runtime helpers separately; a warning about a missing screenshot or portal helper does not necessarily prevent compilation.

valac or wayland-protocols is too old

Verify the tool and library versions:

valac --version
meson --version
pkg-config --modversion glib-2.0
pkg-config --modversion wayland-protocols

Polo requires the minimum versions listed at the beginning of this page.

Weston clone or patch application fails

Inspect subprojects/weston.wrap, the Weston directory under subprojects/, and the error emitted during meson setup. The build depends on the specified Weston revision and Polo's patch queue. Do not replace it with an unpatched system libweston.

A setting changed but the build is using old configuration

Inspect the current settings and explicitly reconfigure:

meson configure build
meson setup build --reconfigure
meson compile -C build

The compositor cannot find a backend when run uninstalled

Use the Meson development environment instead of invoking the binary directly:

meson devenv -C build polo --backend=headless --renderer=pixman

This supplies build-tree module paths, including WESTON_MODULE_MAP.

Strict compilation reports warnings as errors

This is intentional in -Dstrict=true builds. Review the compiler output for the first error. The C/Vala boundary checks are designed to catch incompatible declarations early.

Next steps

Clone this wiki locally