Wayland logo

Building Weston

Most major Linux distributions now include releases of Wayland and Weston in their package management systems. There are also automatic build systems that package even more recent Wayland/Weston packages for particular distros, such as the Wayland Daily Builds PPA for Ubuntu.

If you want an even current build, you can use our wayland-build-tools scripts to check out and build all the git trees for your local system.

If those options don't suit your needs, you can also manually build the stack yourself. The directions below are provided as a guide, but will need adapted for the Linux system you're using. The instructions below assume some familiarity with git, pkg-config, autoconf, and building and running experimental software.

Some help for figuring out how to fix dependency problems: Configure fails with "No package 'foo' found" - and how to fix it.

System-specific Directions

This page has the generic instructions on building Wayland and Weston from git. There are also some guides specific to certain distribution or hardware:

Hardware / Drivers

X output requires DRI2. Output outside of X requires DRM and Kernel Mode Setting (KMS) with the page flip ioctl. These are supported by:

Intel: i915 (June 2004) or newer cards. DRM support has been in the kernel since around 2.6.29. Sandy Bridge chips require kernel 2.6.37.

AMD/ATI: Requires open source driver (amdgpu/radeon/ati, not fglrx/catalyst).

nVidia: Requires Nouveau (open source driver).

Broadcom (Raspberry Pi): Requires open source driver VC4 (Linux and Mesa), can be used with the DRM-backend.

Setting up the environment

Installing in a custom location

If you do not want to install system wide, you'll need to set the following environment variables to get various libraries to link appropriately:

export WLD=$HOME/install   # change this to another location if you prefer
export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/
export PATH=$WLD/bin:$PATH
export ACLOCAL_PATH=$WLD/share/aclocal
export ACLOCAL="aclocal -I $ACLOCAL_PATH"

mkdir -p $WLD/share/aclocal # needed by autotools

Do not set LD_LIBRARY_PATH as your default, it will break things.

You may put the above in a script and source it in the terminal you wish to build the packages.

Installing system wide

To install system wide, you'll need to set WLD differently, add some switches to every autogen.sh invocation, and use sudo to make install. Choose the libdir as appropriate for your distribution and architecture (it may be /usr/lib32 or /usr/lib64).

export WLD=/usr
./autogen.sh --prefix=$WLD --libdir=/usr/lib --sysconfdir=/etc
sudo make install

Wayland libraries

This is required in order to be able to build Mesa with the Wayland EGL platform.

$ git clone https://gitlab.freedesktop.org/wayland/wayland.git
$ cd wayland
$ ./autogen.sh --prefix=$WLD
$ make && make install
$ cd ..

Wayland protocols

This contains a set of protocols that add functionality not available in the Wayland core protocol.

$ git clone git://anongit.freedesktop.org/wayland/wayland-protocols
$ cd wayland-protocols
$ ./autogen.sh --prefix=$WLD
$ make install
$ cd ..


Mesa EGL and Mesa Vulkan stacks support Wayland. Weston's hardware acceleration (GL-renderer) depends on EGL GBM platform. Many Wayland applications, including some Weston demos, depend on EGL Wayland platform.

For building Mesa, refer to the upstream build instructions. When configuring Mesa to make the most out of Weston, make sure that OpenGL ES 2 and GBM are enabled, and that EGL platforms includes wayland and drm.

If you plan to compile XWayland you may want to install any dependencies it needs now. This is so Mesa uses the same header files as xwayland.


Libinput translates evdev events into Wayland events. It has been split from Weston as the code is reusable by any Wayland compositor on Linux. Head to libinput docs for instructions on how to build it.

Weston and demo applications

Weston is the reference implementation of a Wayland compositor. It's available in the weston repo and comes with a few demo applications.

Weston is built with Meson. The last Weston release with autotools build system is probably the February/March 2019 release. If necessary, the latest Meson can be installed as a user with:

$ pip3 install --user meson

pip3 installs meson in ~/.local/ so you might need to add ~/.local/bin to your PATH environment variable, if it is not already added.

Weston's Meson build does not do autodetection and it defaults to all features enabled, which means you likely hit missing dependencies on the first try. If a dependency is avoidable through a build option, the error message should tell you what option can be used to avoid it. You may need to disable several features if you want to avoid certain dependencies.

$ git clone https://gitlab.freedesktop.org/wayland/weston.git
$ cd weston
$ meson build/ --prefix=$WLD
$ ninja -C build/ install
$ cd ..

The meson command populates the build directory. This step can fail due to missing dependencies. Any build options you want can be added on that line, e.g. meson build/ --prefix=$WLD -Dsimple-dmabuf-drm=intel. All the build options can be found in the file meson_options.txt.

Once the build directory has been successfully populated, you can inspect the configuration with meson configure build/. If you need to change an option, you can do e.g. meson configure build/ -Dsimple-dmabuf-drm=intel.

Running Weston

Weston creates its unix socket file (for example, wayland-0) in the directory specified by the required environment variable $XDG_RUNTIME_DIR. Clients use the same variable to find that socket. This is provided using systemd by some distributions (Fedora, Arch since June 2012 or Exherbo). Ubuntu began providing it in Quantal. It is not provided by Gentoo.

If you are using a distro that does set $XDG_RUNTIME_DIR for you, you can skip this part. Otherwise, you must set it using your shell profile capability.

First, please read your shell manual to use the correct file. Some shells will read multiple files (Zshell), others will pick the first available one ignoring the others (Bash). ~/.profile is generally a good guess, for most Bourne-shell compatible shells, ~/.zprofile is the Zshell equivalent. You should use the profile file if there is any, otherwise the login file will do the trick.

We will use /tmp as the base to put our $XDG_RUNTIME_DIR in. Since /tmp can be a tmpfs, and thus wiped on restart, we should take care of creating it when we need it. Also, if you share your computer between several users, you must take care of using a unique $XDG_RUNTIME_DIR for each one. We will also check if the variable is already set. This way, if your system starts providing it, you will use it directly. It is also useful if you want to use your profile file on different systems.

Here is the code to put in your shell profile file (it is Bourne-shell compatible, feel free to adapt it to your shell’s internals):

if test -z "${XDG_RUNTIME_DIR}"; then
    export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir
    if ! test -d "${XDG_RUNTIME_DIR}"; then
        mkdir "${XDG_RUNTIME_DIR}"
        chmod 0700 "${XDG_RUNTIME_DIR}"

Copy the weston.ini file and edit it to set a background image that you like:

$ mkdir -p ~/.config
$ cp weston/weston.ini ~/.config
$ $EDITOR ~/.config/weston.ini

If $DISPLAY is set, the weston will run under X in a window and take input from X. Run the compositor by typing:

$ weston

Otherwise (outside of X) it will run on the KMS/DRM framebuffer and take input from evdev devices. Use weston-launch, which as a setuid-root program does privileged operations on Weston's behalf. It also requires that you either enable systemd session support for weston-launch (by using systemd and having the systemd-login devel headers at configure time), or add yourself to the "weston-launch" group:

$ sudo groupadd weston-launch
$ sudo usermod -a -G weston-launch $USER
$ # Log all the way out (of X, etc.)
$ sudo chown root $WLD/bin/weston-launch
$ sudo chmod +s $WLD/bin/weston-launch
$ weston-launch

To run clients, the second button in the top bar will run weston-terminal, from which you can run clients. It is also possible to run clients from a different VT when running on hardware, or from an xterm if running under X. There are a few demo clients available in the weston build directory, but they are all pretty simple and mostly for testing specific features in the wayland protocol:

Optional environment variables which will get you more debugging output:

export MESA_DEBUG=1
export EGL_LOG_LEVEL=debug
export LIBGL_DEBUG=verbose


Directions for building support for X clients (XWayland)