blob: c756c2fcd619033d0cd00be8dde0a7e975cb3979 [file] [log] [blame]
Andreas Bollecd5c7c2012-06-12 09:05:03 +02001<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html lang="en">
3<head>
4 <meta http-equiv="content-type" content="text/html; charset=utf-8">
5 <title>Compiling and Installing</title>
6 <link rel="stylesheet" type="text/css" href="mesa.css">
7</head>
8<body>
Brian Paul0b27ace2003-03-08 17:38:57 +00009
Andreas Bollecd5c7c2012-06-12 09:05:03 +020010<h1>Compiling and Installing</h1>
Brian Paul5f37abf2003-09-05 14:47:07 +000011
12<ol>
Brian Paul7103a182012-04-19 09:56:36 -060013<li><a href="#prereq-general">Prerequisites for building</a>
Brian Paul49a3fab2008-12-30 07:57:16 -070014 <ul>
Brian Paul7103a182012-04-19 09:56:36 -060015 <li><a href="#prereq-general">General prerequisites</a>
16 <li><a href="#prereq-dri">For DRI and hardware acceleration</a>
Brian Paul49a3fab2008-12-30 07:57:16 -070017 </ul>
Brian Paul7103a182012-04-19 09:56:36 -060018<li><a href="#autoconf">Building with autoconf (Linux/Unix/X11)</a>
Brian Pauladc58e92012-06-01 09:19:36 -060019<li><a href="#scons">Building with SCons (Windows/Linux)</a>
Brian Paul7103a182012-04-19 09:56:36 -060020<li><a href="#other">Building for other systems</a>
21<li><a href="#libs">Library Information</a>
Andreas Bolldf2be222012-06-12 09:05:22 +020022<li><a href="#pkg-config">Building OpenGL programs with pkg-config</a>
Brian Paul5f37abf2003-09-05 14:47:07 +000023</ol>
Brian Paul0b27ace2003-03-08 17:38:57 +000024
Brian Paul8bd70a72008-05-27 13:27:57 -060025
Andreas Bollcc418882012-06-12 09:05:33 +020026<h1 id="prereq-general">1. Prerequisites for building</h1>
Brian Paul32a11e52011-04-04 11:30:46 -060027
Brian Paul7103a182012-04-19 09:56:36 -060028<h2>1.1 General</h2>
Brian Paul32a11e52011-04-04 11:30:46 -060029<ul>
30<li>lex / yacc - for building the GLSL compiler.
31On Linux systems, flex and bison are used.
32Versions 2.5.35 and 2.4.1, respectively, (or later) should work.
Brian Paul4f869e92012-03-05 13:02:59 -070033<br>
34<br>
35On Windows with MinGW, install flex and bison with:
36<pre>mingw-get install msys-flex msys-bison</pre>
Brian Paul32a11e52011-04-04 11:30:46 -060037</li>
38<li>python - Python is needed for building the Gallium components.
39Version 2.6.4 or later should work.
Brian Paul4f869e92012-03-05 13:02:59 -070040<br>
41<br>
42To build OpenGL ES 1.1 and 2.0 you'll also need
43<a href="http://xmlsoft.org/sources/win32/python/libxml2-python-2.7.7.win32-py2.7.exe">libxml2-python</a>.
Brian Paul32a11e52011-04-04 11:30:46 -060044</li>
45</ul>
46
47
Andreas Bollcc418882012-06-12 09:05:33 +020048<h3 id="prereq-dri">1.2 For DRI and hardware acceleration</h3>
Brian Paul5f37abf2003-09-05 14:47:07 +000049
50<p>
Brian Paul90692482009-10-08 20:49:32 -060051The following are required for DRI-based hardware acceleration with Mesa:
Brian Paul8bd70a72008-05-27 13:27:57 -060052</p>
53
Brian Paul49a3fab2008-12-30 07:57:16 -070054<ul>
Brian Paul7103a182012-04-19 09:56:36 -060055<li><a href="http://xorg.freedesktop.org/releases/individual/proto/"
56target="_parent">dri2proto</a> version 2.6 or later
Brian Paul2c56dd72009-01-10 11:52:55 -070057<li><a href="http://dri.freedesktop.org/libdrm/" target="_parent">libDRM</a>
Brian Paul7103a182012-04-19 09:56:36 -060058version 2.4.33 or later
Brian Paul2c56dd72009-01-10 11:52:55 -070059<li>Xorg server version 1.5 or later
Brian Paul7103a182012-04-19 09:56:36 -060060<li>Linux 2.6.28 or later
Brian Paul49a3fab2008-12-30 07:57:16 -070061</ul>
Alex Hultmanc3fe44c2012-03-16 09:46:42 -060062<p>
63If you're using a fedora distro the following command should install all
64the needed dependencies:
Andreas Bolldf2be222012-06-12 09:05:22 +020065</p>
Alex Hultmanc3fe44c2012-03-16 09:46:42 -060066<pre>
67 sudo yum install flex bison imake libtool xorg-x11-proto-devel libdrm-devel \
68 gcc-c++ xorg-x11-server-devel libXi-devel libXmu-devel libXdamage-devel git \
69 expat-devel llvm-devel
70</pre>
Brian Paul8bd70a72008-05-27 13:27:57 -060071
72
Brian Paul7103a182012-04-19 09:56:36 -060073
Andreas Boll210a27d2012-06-12 09:05:36 +020074<h1 id="autoconf">2. Building with autoconf (Linux/Unix/X11)</h1>
Brian Paul8bd70a72008-05-27 13:27:57 -060075
76<p>
Brian Paul7103a182012-04-19 09:56:36 -060077The primary method to build Mesa on Unix systems is with autoconf.
78</p>
Brian Paul8bd70a72008-05-27 13:27:57 -060079
80<p>
Brian Paul7103a182012-04-19 09:56:36 -060081The general approach is the standard:
Andreas Bolldf2be222012-06-12 09:05:22 +020082</p>
Brian Paul7103a182012-04-19 09:56:36 -060083<pre>
84 ./configure
85 make
86 sudo make install
87</pre>
Andreas Bolldf2be222012-06-12 09:05:22 +020088<p>
Brian Paul7103a182012-04-19 09:56:36 -060089But please read the <a href="autoconf.html">detailed autoconf instructions</a>
90for more details.
91</p>
92
93
94
Andreas Boll210a27d2012-06-12 09:05:36 +020095<h1 id="scons">3. Building with SCons (Windows/Linux)</h1>
Brian Paul7103a182012-04-19 09:56:36 -060096
97<p>
98To build Mesa with SCons on Linux or Windows do
99</p>
100<pre>
101 scons
102</pre>
103<p>
104The build output will be placed in
105build/<i>platform</i>-<i>machine</i>-<i>debug</i>/..., where <i>platform</i> is for
106example linux or windows, <i>machine</i> is x86 or x86_64, optionally followed
107by -debug for debug builds.
108</p>
109
110<p>
111To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do
112</p>
113<pre>
114 scons platform=windows toolchain=crossmingw machine=x86 mesagdi libgl-gdi
115</pre>
116<p>
117This will create:
118</p>
119<ul>
Andreas Bollfd64b392012-06-12 09:05:49 +0200120<li>build/windows-x86-debug/mesa/drivers/windows/gdi/opengl32.dll &mdash; Mesa + swrast, binary compatible with Windows's opengl32.dll
121<li>build/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll &mdash; Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
Brian Paul7103a182012-04-19 09:56:36 -0600122</ul>
123<p>
124Put them all in the same directory to test them.
125</p>
126
127
128
Andreas Boll210a27d2012-06-12 09:05:36 +0200129<h1 id="other">4. Building for other systems</h1>
Brian Paul7103a182012-04-19 09:56:36 -0600130
131<p>
132Documentation for other environments (some may be very out of date):
133</p>
134
Andreas Boll210a27d2012-06-12 09:05:36 +0200135<ul>
136<li><a href="README.VMS">README.VMS</a> - VMS
137<li><a href="README.CYGWIN">README.CYGWIN</a> - Cygwin
138<li><a href="README.WIN32">README.WIN32</a> - Win32
139</ul>
Brian Paul7103a182012-04-19 09:56:36 -0600140
141
142
Andreas Boll210a27d2012-06-12 09:05:36 +0200143<h1 id="libs">5. Library Information</h1>
Brian Paul7103a182012-04-19 09:56:36 -0600144
145<p>
146When compilation has finished, look in the top-level <code>lib/</code>
147(or <code>lib64/</code>) directory.
148You'll see a set of library files similar to this:
149</p>
150<pre>
151lrwxrwxrwx 1 brian users 10 Mar 26 07:53 libGL.so -> libGL.so.1*
152lrwxrwxrwx 1 brian users 19 Mar 26 07:53 libGL.so.1 -> libGL.so.1.5.060100*
153-rwxr-xr-x 1 brian users 3375861 Mar 26 07:53 libGL.so.1.5.060100*
Brian Paul7103a182012-04-19 09:56:36 -0600154lrwxrwxrwx 1 brian users 14 Mar 26 07:53 libOSMesa.so -> libOSMesa.so.6*
155lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSMesa.so.6.1.060100*
156-rwxr-xr-x 1 brian users 23871 Mar 26 07:53 libOSMesa.so.6.1.060100*
157</pre>
158
159<p>
160<b>libGL</b> is the main OpenGL library (i.e. Mesa).
161<br>
Brian Paul7103a182012-04-19 09:56:36 -0600162<b>libOSMesa</b> is the OSMesa (Off-Screen) interface library.
163</p>
164
165<p>
166If you built the DRI hardware drivers, you'll also see the DRI drivers:
167</p>
168<pre>
169-rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so
170-rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i965_dri.so
171-rwxr-xr-x 1 brian users 11849858 Jul 21 12:12 r200_dri.so
172-rwxr-xr-x 1 brian users 16050488 Jul 21 12:11 r300_dri.so
173-rwxr-xr-x 1 brian users 11757388 Jul 21 12:12 radeon_dri.so
174</pre>
175
176<p>
177If you built with Gallium support, look in lib/gallium/ for Gallium-based
178versions of libGL and device drivers.
179</p>
180
181
Andreas Boll210a27d2012-06-12 09:05:36 +0200182<h1 id="pkg-config">6. Building OpenGL programs with pkg-config</h1>
Brian5bba58c2007-09-12 10:11:49 -0600183
184<p>
185Running <code>make install</code> will install package configuration files
186for the pkg-config utility.
187</p>
188
189<p>
190When compiling your OpenGL application you can use pkg-config to determine
191the proper compiler and linker flags.
192</p>
193
194<p>
195For example, compiling and linking a GLUT application can be done with:
196</p>
197<pre>
198 gcc `pkg-config --cflags --libs glut` mydemo.c -o mydemo
199</pre>
200
201<br>
Brian Paul5f37abf2003-09-05 14:47:07 +0000202
Brian Paul5f37abf2003-09-05 14:47:07 +0000203
Brian Paul0b27ace2003-03-08 17:38:57 +0000204</body>
205</html>