[Mesa-dev] Mesa build instructions

Matt Turner mattst88 at gmail.com
Fri Apr 11 10:37:42 PDT 2014


Someone asked about my Mesa build set up. Rather than sending it
privately I figured I'd post it for posterity on mesa-dev.

I build with

CFLAGS="-O2 -march=native -pipe" CXXFLAGS="$CFLAGS" ./autogen.sh
--with-dri-drivers=i965 --with-gallium-drivers=
--with-egl-platforms=x11,drm --enable-glx-tls --enable-gles1
--enable-gles2

--enable-debug enables assertions and builds with -g, but also
silently adds -O0 to your CFLAGS.

My build set up consists of

~/projects/mesa - contains  mesa git checkout
~/projects/mesa-release - release build directory
~/projects/mesa-debug - debug build directory

I do out-of-tree builds into the debug and release directories by
running ../mesa/autogen.sh ... from each of them, with the only
difference being the --enable-debug flag.

Environment variables allow you to use your built mesa without
installing it: LIBGL_DRIVERS_PATH, LD_LIBRARY_PATH. Mesa's build
system links built files into $(builddir)/$(libdir), e.g.,
~/projects/mesa-release/lib/. I use some wrapper scripts to allow me
to easily run programs against my Mesa builds:

~/bin/mesa-release:
#!/bin/sh
LIBGL_DRIVERS_PATH=~/projects/mesa-release/lib
LD_LIBRARY_PATH=~/projects/mesa-release/lib:${LD_LIBRARY_PATH} $@

~/bin/mesa-debug:
#!/bin/sh
LIBGL_DRIVERS_PATH=~/projects/mesa-debug/lib
LD_LIBRARY_PATH=~/projects/mesa-debug/lib:${LD_LIBRARY_PATH} $@

I also have a mesa-gdb script, since running a program against my Mesa
debug build in gdb is a common operation:

~/bin/mesa-gdb:
#!/bin/sh
mesa-debug gdb --args $@

So with ~/bin in your $PATH, you can now do things like

$ mesa-release glxinfo
$ mesa-gdb ./crashing-program

I work from ~/projects/mesa and rebuild both release and debug with

make -j8 -l8 -C ~/projects/mesa-release && make -j8 -l8 -C ~/projects/mesa-debug

and use CTRL+R to quickly find that command.


More information about the mesa-dev mailing list