Wayland logo

The instructions below assume some familiarity with git and building and running experimental software. Also, be prepared for the fact that this project is still very much a prototype. When the instructions suggest to clone a git repo, you can of course just add a remote and fetch instead, if you have a clone of that repo around already. By default the software is installed in $HOME/install but you can change it by altering $WLD (explained later). You can also install everything system-wide by setting WLD to /usr and passing --sysconfdir=/etc to autogen.sh.

Hardware / Drivers

X output requires DRI2. DRM output (without X) requires Kernel Mode Setting (KMS) and 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 (radeon/ati, not fglrx/catalyst). DRM output requires kernel version 2.6.38. Cards probably work back to Radeon 7200 (2000).

nVidia: Requires Nouveau (open source driver). DRM output requires kernel version 3.7-rc3. DRM output previously required kernel version 2.6.37 for nv40 or lower cards, 2.6.38 for nv50 cards. Some new cards require loading external firmware.

For building Weston for Raspberry Pi, see Raspberry Pi build guide.

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:

WLD=$HOME/install   # change this to another location if you prefer


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 this variable, and possibly build with --libdir=/usr/lib64 :

export WLD

Wayland libraries

This is required in order to be able to build Mesa with --with-egl-platforms=x11,wayland,drm.

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


Wayland uses the mesa EGL stack, and all extensions required to run EGL on KMS are now upstream. Wayland should work with any mesa release after 9.0, but in some cases extra functionality or optimization will only be available in more recent releases.

To compile mesa you'll need a development package for libdrm. Other dependencies are development packages of xcb-dri2 and xcb-xfixes.

    $ git clone git://anongit.freedesktop.org/git/mesa/drm
    $ cd drm
    $ ./autogen.sh --prefix=$WLD
    $ make && make install

    $ git clone git://anongit.freedesktop.org/mesa/mesa
    $ cd mesa
    $ ./autogen.sh --prefix=$WLD --enable-gles2 --disable-gallium-egl \
      --with-egl-platforms=x11,wayland,drm --enable-gbm --enable-shared-glapi \
    $ make && make install

We disable Gallium for Intel 915 and 965, which just means that libEGL won't try to load the Gallium drivers directly. The Gallium drivers will be built as DRI drivers, which the EGL loader will load just fine.

Example mesa configure output.

Note on Mesa build failures: If you're not building in your Mesa git repo for the first time, the first thing to try is always "git clean -xfd", and possibly deleting your $WLD directory, as Mesa requires this often.


Wayland needs libxkbcommon >= 0.3.0 for translating evdev keycodes to keysyms.

    $ git clone git://github.com/xkbcommon/libxkbcommon
    $ cd libxkbcommon/
    $ ./autogen.sh --prefix=$WLD --with-xkb-config-root=/usr/share/X11/xkb
    $ make && make install


The Wayland clients can render using cairo-gl, but fall back to software when cairo-gl is not available. For cairo-gl, cairo 1.11.3 or newer is needed. For this you'll need a development package for pixman.

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

    $ git clone git://anongit.freedesktop.org/cairo
    $ cd cairo
    $ ./autogen.sh --prefix=$WLD --enable-gl --enable-xcb
    $ make && make install


Weston requires libunwind v1.1 if you don't configure with --disable-libunwind .

    $ git clone git://git.sv.gnu.org/libunwind
    $ cd libunwind
    $ autoreconf -i
    $ ./configure --prefix=$WLD
    $ make && make install


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}"

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.

Aside from mesa and libxkbcommon, the Weston dependencies can be satisfied with released versions of: gdk-pixbuf-2.0, libudev 136, libdrm 2.4.23, pixman-1, cairo-gl 1.11.3, glib-2.0, and gobject-2.0. And optionally, for the pdf viewer: poppler-glib and gio-2.0.

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

If DISPLAY is set, the weston will run under X in a window and take input from X. Otherwise it will run on the KMS framebuffer and take input from evdev devices. Copy the weston.ini config file to ~/.config and edit it to set a background image that you like. Then run the compositor by typing:

    $ ./weston

For KMS/DRM output (outside of X) use weston-launch, which needs root permissions, which are set if "make install" is run as root, but some distributions disable it. It also requires that you 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 weston-launch
    $ sudo chmod +s weston-launch
    $ weston-launch

To run clients, switch to a different VT and run the client from there. Or run it under X and start up the clients from a terminal window. There are a few demo clients available, but they are all pretty simple and mostly for testing specific features in the wayland protocol:


Directions for building support for X clients (XWayland)


Environment variables which will get you more debugging output: