Wayland Display Server (part 2, mesa)

Continuing where the last post left off, this is my log of working through the Mesa section of the Building Wayland page. The first thing to compile is drm (Direct Rendering Manager).

Compiling drm

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

As before the first thing to do is just run the autogen.sh script over and over again and fix errors. The first error is that it's missing libpthread-stubs, I'm not sure if you need the development headers for these but I'm grabbing them anyway.

$ sudo apt-get install libpthread-stubs0-dev

Next, missing pciaccess.

$ sudo apt-get install libpciaccess-dev

That's it for drm, just finish up with

$ make
$ sudo make install

Compiling mesa

$ 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 --with-gallium-drivers=r300,r600,swrast,nouveau

This one has more complicated autogen.sh arguments, but it's still the same strategy. Just keep trying it until all the errors are gone. I'm guessing these could be stripped down a little to be more specific to a single system, but I'm not bothering thinking about it right now.

This time, it'll throw a weird error about the c++ preprocessor failing a sanity check. It's not immediately obvious what that means, but a quick search online looks like it's just missing the C++ compilers. Installing them fixed it.

$ sudo apt-get install g++

The next error is that it lacks bison. Installing it worked nicely.

$ sudo apt-get install bison

Continuing on the simple problems, it's missing flex.

$ sudo apt-get install flex

The next error was a little tricky. It said it was missing glproto, which isn't clearly any packages. Fortunately, apt-cache search and apt-file find both pointed to the package x11proto-gl-dev, which turned out to be the correct one.

$ sudo apt-get install x11proto-gl-dev

The next thing it's missing is dri2proto. Following the pattern of the last one, it's another x11proto-* package. Again, apt-cache found it for me.

$ sudo apt-get install x11proto-dri2-dev

This time, it's more complicated. It's missing a whole set of packages (x11, xext, xdamage, xfixes, x11-xcb, xcb-glx, and xcb-dri2). I guessed that these were all libraries, so prepended lib to each and added -dev to the end, testing each name with tab completion in apt-get. Occasionally there are version numbers thrown in, which is why tab completion and apt-cache are so useful here.

$ sudo apt-get install libx11-dev libxext-dev libxdamage-dev libxfixes-dev libx11-xcb-dev libxcb-glx0-dev libxcb-dri2-0-dev

Another easy one, it's missing udev.

$ sudo apt-get install libudev-dev

It complains about another set of package,s but the reason it gives is that it's missing xcb-xfixes. Just installing that fixes it.

$ sudo apt-get install libxcb-xfixes0-dev

The next error is a different format from most of the previous ones, it complains that it needs LLVM to compile Gallium for R300 on my x86 and x86_64 (the common 32 and 64 bit architectures). LLVM is a Low Level Virtual Machine, which I'm betting stuff gets compiled to (so I doubt headers are needed).

$ sudo apt-get install llvm

That's it for configuring, finish up with

$ make
$ sudo make install

This one takes much longer to make than the others, so it's a good time to git clone the next few repositories if you haven't already, take a break, grab a snack, whatever.