3 <TITLE>Compiling and Installing
</TITLE>
5 <link rel=
"stylesheet" type=
"text/css" href=
"mesa.css"></head>
10 <H1>Compiling and Installing
</H1>
13 <li><a href=
"#prereq-general">Prerequisites for building
</a>
15 <li><a href=
"#prereq-general">General prerequisites
</a>
16 <li><a href=
"#prereq-dri">For DRI and hardware acceleration
</a>
18 <li><a href=
"#autoconf">Building with autoconf (Linux/Unix/X11)
</a>
19 <li><a href=
"#scons">Building with SCons (Windows)
</a>
20 <li><a href=
"#legacy">Building with legacy Makefiles (deprecated)
</a>
21 <li><a href=
"#other">Building for other systems
</a>
22 <li><a href=
"#libs">Library Information
</a>
23 <li><a href=
"#pkg-config">Building OpenGL programs with pkg-config
27 <a name=
"prereq-general">
28 <h1>1. Prerequisites for building
</h1>
32 <li>lex / yacc - for building the GLSL compiler.
33 On Linux systems, flex and bison are used.
34 Versions
2.5.35 and
2.4.1, respectively, (or later) should work.
37 On Windows with MinGW, install flex and bison with:
38 <pre>mingw-get install msys-flex msys-bison
</pre>
40 <li>python - Python is needed for building the Gallium components.
41 Version
2.6.4 or later should work.
44 To build OpenGL ES
1.1 and
2.0 you'll also need
45 <a href=
"http://xmlsoft.org/sources/win32/python/libxml2-python-2.7.7.win32-py2.7.exe">libxml2-python
</a>.
51 <h3>1.2 For DRI and hardware acceleration
</h3>
54 The following are required for DRI-based hardware acceleration with Mesa:
58 <li><a href=
"http://xorg.freedesktop.org/releases/individual/proto/"
59 target=
"_parent">dri2proto
</a> version
2.6 or later
60 <li><a href=
"http://dri.freedesktop.org/libdrm/" target=
"_parent">libDRM
</a>
61 version
2.4.33 or later
62 <li>Xorg server version
1.5 or later
63 <li>Linux
2.6.28 or later
67 If you're using a fedora distro the following command should install all
68 the needed dependencies:
70 sudo yum install flex bison imake libtool xorg-x11-proto-devel libdrm-devel \
71 gcc-c++ xorg-x11-server-devel libXi-devel libXmu-devel libXdamage-devel git \
72 expat-devel llvm-devel
78 <H1>2. Building with autoconf (Linux/Unix/X11)
</H1>
81 The primary method to build Mesa on Unix systems is with autoconf.
85 The general approach is the standard:
91 But please read the
<a href=
"autoconf.html">detailed autoconf instructions
</a>
98 <H1>3. Building with SCons (Windows)
</H1>
101 To build Mesa with SCons on Linux or Windows do
107 The build output will be placed in
108 build/
<i>platform
</i>-
<i>machine
</i>-
<i>debug
</i>/..., where
<i>platform
</i> is for
109 example linux or windows,
<i>machine
</i> is x86 or x86_64, optionally followed
110 by -debug for debug builds.
114 To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do
117 scons platform=windows toolchain=crossmingw machine=x86 mesagdi libgl-gdi
123 <li>build/windows-x86-debug/mesa/drivers/windows/gdi/opengl32.dll
— Mesa + swrast, binary compatible with Windows's opengl32.dll
124 <li>build/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll
— Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
127 Put them all in the same directory to test them.
133 <h1>4. Building with legacy Makefiles (deprecated)
</h1>
136 The legacy Mesa build system is based on a collection of pre-defined
137 system configurations.
138 Some of these might work for older systems not supported by autoconf.
141 To see the list of configurations, just type
<code>make
</code>.
142 Then choose a configuration from the list and type
<code>make
</code>
147 Mesa may be built in several different ways using the predefined configurations:
150 <li><b><em>Stand-alone/Xlib mode
</em></b> - Mesa will be compiled as
151 a software renderer using Xlib to do all rendering.
152 The libGL.so library will be a self-contained rendering library that will
153 allow you to run OpenGL/GLX applications on any X server (regardless of
154 whether it supports the GLX X server extension).
155 You will
<em>not
</em> be able to use hardware
3D acceleration.
157 To compile stand-alone Mesa type
<code>make
</code> in the top-level directory.
158 You'll see a list of supported system configurations.
159 Choose one from the list (such as linux-x86), and type:
164 <p>This will produce libGL.so and several other libraries
</p>
167 <li><b><em>DRI/accelerated
</em></b> - The DRI hardware drivers for
168 accelerated OpenGL rendering (for ATI, Intel, Matrox, etc) will be built.
169 The libGL.so library will support the GLX extension and will load/use
170 the DRI hardware drivers.
174 Build Mesa and the DRI hardware drivers by running
180 There are also
<code>linux-dri-x86
</code>,
<code>linux-dri-x86-
64</code>,
181 and
<code>linux-ppc
</code> configurations which are optimized for those
185 Make sure you have the prerequisite versions of DRM and Xserver mentioned
193 Later, if you want to rebuild for a different configuration run
194 <code>make realclean
</code> before rebuilding.
200 <H2>Installing the header and library files
</H2>
203 The standard location for the OpenGL header files on Unix-type systems is
204 in
<code>/usr/include/GL/
</code>.
205 The standard location for the libraries is
<code>/usr/lib/
</code>.
206 For more information see, the
207 <a href=
"http://oss.sgi.com/projects/ogl-sample/ABI/" target=
"_parent">
208 Linux/OpenGL ABI specification
</a>.
212 If you'd like Mesa to co-exist with another implementation of OpenGL that's
213 already installed, you'll have to choose different directories, like
214 <code>/usr/local/include/GL/
</code> and
<code>/usr/local/lib/
</code>.
218 To install Mesa's headers and libraries, run
<code>make install
</code>.
219 But first, check the Mesa/configs/default file and examine the values
220 of the
<b>INSTALL_DIR
</b> and
<b>DRI_DRIVER_INSTALL_DIR
</b> variables.
221 Change them if needed, then run
<code>make install
</code>.
226 <b>DESTDIR
</b> may also be used to install the contents to a temporary
228 This can be useful for package management.
229 For example:
<code>make install DESTDIR=/somepath/
</code>
233 Note: at runtime you can use the LD_LIBRARY_PATH environment variable
234 (on Linux at least) to switch
235 between the Mesa libraries and other vendor's libraries whenever you want.
236 This is a handy way to compare multiple OpenGL implementations.
243 <H1>5. Building for other systems
</H1>
246 Documentation for other environments (some may be very out of date):
250 <li><A HREF=
"README.VMS">README.VMS
</A> - VMS
251 <LI><A HREF=
"README.CYGWIN">README.CYGWIN
</A> - Cygwin
252 <LI><A HREF=
"README.WIN32">README.WIN32
</A> - Win32
258 <H1>6. Library Information
</H1>
261 When compilation has finished, look in the top-level
<code>lib/
</code>
262 (or
<code>lib64/
</code>) directory.
263 You'll see a set of library files similar to this:
266 lrwxrwxrwx
1 brian users
10 Mar
26 07:
53 libGL.so -
> libGL.so
.1*
267 lrwxrwxrwx
1 brian users
19 Mar
26 07:
53 libGL.so
.1 -
> libGL.so
.1.5.060100*
268 -rwxr-xr-x
1 brian users
3375861 Mar
26 07:
53 libGL.so
.1.5.060100*
269 lrwxrwxrwx
1 brian users
11 Mar
26 07:
53 libGLU.so -
> libGLU.so
.1*
270 lrwxrwxrwx
1 brian users
20 Mar
26 07:
53 libGLU.so
.1 -
> libGLU.so
.1.3.060100*
271 -rwxr-xr-x
1 brian users
549269 Mar
26 07:
53 libGLU.so
.1.3.060100*
272 lrwxrwxrwx
1 brian users
14 Mar
26 07:
53 libOSMesa.so -
> libOSMesa.so
.6*
273 lrwxrwxrwx
1 brian users
23 Mar
26 07:
53 libOSMesa.so
.6 -
> libOSMesa.so
.6.1.060100*
274 -rwxr-xr-x
1 brian users
23871 Mar
26 07:
53 libOSMesa.so
.6.1.060100*
278 <b>libGL
</b> is the main OpenGL library (i.e. Mesa).
280 <b>libGLU
</b> is the OpenGL Utility library.
282 <b>libOSMesa
</b> is the OSMesa (Off-Screen) interface library.
286 If you built the DRI hardware drivers, you'll also see the DRI drivers:
289 -rwxr-xr-x
1 brian users
16895413 Jul
21 12:
11 i915_dri.so
290 -rwxr-xr-x
1 brian users
16895413 Jul
21 12:
11 i965_dri.so
291 -rwxr-xr-x
1 brian users
11849858 Jul
21 12:
12 r200_dri.so
292 -rwxr-xr-x
1 brian users
16050488 Jul
21 12:
11 r300_dri.so
293 -rwxr-xr-x
1 brian users
11757388 Jul
21 12:
12 radeon_dri.so
297 If you built with Gallium support, look in lib/gallium/ for Gallium-based
298 versions of libGL and device drivers.
302 <a name=
"pkg-config">
303 <H1>7. Building OpenGL programs with pkg-config
</H1>
306 Running
<code>make install
</code> will install package configuration files
307 for the pkg-config utility.
311 When compiling your OpenGL application you can use pkg-config to determine
312 the proper compiler and linker flags.
316 For example, compiling and linking a GLUT application can be done with:
319 gcc `pkg-config --cflags --libs glut` mydemo.c -o mydemo