blob: 5061eded056cda13c4193ed621055d7a9eee5ed4 [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 Bollb5da52a2012-09-18 18:57:02 +020010<div class="header">
11 <h1>The Mesa 3D Graphics Library</h1>
12</div>
13
14<iframe src="contents.html"></iframe>
15<div class="content">
16
Andreas Bollecd5c7c2012-06-12 09:05:03 +020017<h1>Compiling and Installing</h1>
Brian Paul5f37abf2003-09-05 14:47:07 +000018
19<ol>
Brian Paul7103a182012-04-19 09:56:36 -060020<li><a href="#prereq-general">Prerequisites for building</a>
Brian Paul49a3fab2008-12-30 07:57:16 -070021 <ul>
Brian Paul7103a182012-04-19 09:56:36 -060022 <li><a href="#prereq-general">General prerequisites</a>
23 <li><a href="#prereq-dri">For DRI and hardware acceleration</a>
Brian Paul49a3fab2008-12-30 07:57:16 -070024 </ul>
Brian Paul7103a182012-04-19 09:56:36 -060025<li><a href="#autoconf">Building with autoconf (Linux/Unix/X11)</a>
Brian Pauladc58e92012-06-01 09:19:36 -060026<li><a href="#scons">Building with SCons (Windows/Linux)</a>
Brian Paul7103a182012-04-19 09:56:36 -060027<li><a href="#other">Building for other systems</a>
28<li><a href="#libs">Library Information</a>
Andreas Bolldf2be222012-06-12 09:05:22 +020029<li><a href="#pkg-config">Building OpenGL programs with pkg-config</a>
Brian Paul5f37abf2003-09-05 14:47:07 +000030</ol>
Brian Paul0b27ace2003-03-08 17:38:57 +000031
Brian Paul8bd70a72008-05-27 13:27:57 -060032
Andreas Bollcc418882012-06-12 09:05:33 +020033<h1 id="prereq-general">1. Prerequisites for building</h1>
Brian Paul32a11e52011-04-04 11:30:46 -060034
Brian Paul7103a182012-04-19 09:56:36 -060035<h2>1.1 General</h2>
Brian Paul32a11e52011-04-04 11:30:46 -060036<ul>
37<li>lex / yacc - for building the GLSL compiler.
38On Linux systems, flex and bison are used.
39Versions 2.5.35 and 2.4.1, respectively, (or later) should work.
Brian Paul4f869e92012-03-05 13:02:59 -070040<br>
41<br>
42On Windows with MinGW, install flex and bison with:
43<pre>mingw-get install msys-flex msys-bison</pre>
Brian Paul32a11e52011-04-04 11:30:46 -060044</li>
45<li>python - Python is needed for building the Gallium components.
46Version 2.6.4 or later should work.
47</li>
48</ul>
49
50
Andreas Bollcc418882012-06-12 09:05:33 +020051<h3 id="prereq-dri">1.2 For DRI and hardware acceleration</h3>
Brian Paul5f37abf2003-09-05 14:47:07 +000052
53<p>
Brian Paul90692482009-10-08 20:49:32 -060054The following are required for DRI-based hardware acceleration with Mesa:
Brian Paul8bd70a72008-05-27 13:27:57 -060055</p>
56
Brian Paul49a3fab2008-12-30 07:57:16 -070057<ul>
Andreas Bolla73c59b2012-09-18 19:31:28 +020058<li><a href="http://xorg.freedesktop.org/releases/individual/proto/">
59dri2proto</a> version 2.6 or later
60<li><a href="http://dri.freedesktop.org/libdrm/">libDRM</a>
Brian Paul7103a182012-04-19 09:56:36 -060061version 2.4.33 or later
Brian Paul2c56dd72009-01-10 11:52:55 -070062<li>Xorg server version 1.5 or later
Brian Paul7103a182012-04-19 09:56:36 -060063<li>Linux 2.6.28 or later
Brian Paul49a3fab2008-12-30 07:57:16 -070064</ul>
Alex Hultmanc3fe44c2012-03-16 09:46:42 -060065<p>
66If you're using a fedora distro the following command should install all
67the needed dependencies:
Andreas Bolldf2be222012-06-12 09:05:22 +020068</p>
Alex Hultmanc3fe44c2012-03-16 09:46:42 -060069<pre>
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
73</pre>
Brian Paul8bd70a72008-05-27 13:27:57 -060074
75
Brian Paul7103a182012-04-19 09:56:36 -060076
Andreas Boll210a27d2012-06-12 09:05:36 +020077<h1 id="autoconf">2. Building with autoconf (Linux/Unix/X11)</h1>
Brian Paul8bd70a72008-05-27 13:27:57 -060078
79<p>
Brian Paul7103a182012-04-19 09:56:36 -060080The primary method to build Mesa on Unix systems is with autoconf.
81</p>
Brian Paul8bd70a72008-05-27 13:27:57 -060082
83<p>
Brian Paul7103a182012-04-19 09:56:36 -060084The general approach is the standard:
Andreas Bolldf2be222012-06-12 09:05:22 +020085</p>
Brian Paul7103a182012-04-19 09:56:36 -060086<pre>
87 ./configure
88 make
89 sudo make install
90</pre>
Andreas Bolldf2be222012-06-12 09:05:22 +020091<p>
Brian Paul7103a182012-04-19 09:56:36 -060092But please read the <a href="autoconf.html">detailed autoconf instructions</a>
93for more details.
94</p>
95
96
97
Andreas Boll210a27d2012-06-12 09:05:36 +020098<h1 id="scons">3. Building with SCons (Windows/Linux)</h1>
Brian Paul7103a182012-04-19 09:56:36 -060099
100<p>
101To build Mesa with SCons on Linux or Windows do
102</p>
103<pre>
104 scons
105</pre>
106<p>
107The build output will be placed in
108build/<i>platform</i>-<i>machine</i>-<i>debug</i>/..., where <i>platform</i> is for
109example linux or windows, <i>machine</i> is x86 or x86_64, optionally followed
110by -debug for debug builds.
111</p>
112
113<p>
114To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do
115</p>
116<pre>
117 scons platform=windows toolchain=crossmingw machine=x86 mesagdi libgl-gdi
118</pre>
119<p>
120This will create:
121</p>
122<ul>
Andreas Bollfd64b392012-06-12 09:05:49 +0200123<li>build/windows-x86-debug/mesa/drivers/windows/gdi/opengl32.dll &mdash; Mesa + swrast, binary compatible with Windows's opengl32.dll
124<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 -0600125</ul>
126<p>
127Put them all in the same directory to test them.
128</p>
129
130
131
Andreas Boll210a27d2012-06-12 09:05:36 +0200132<h1 id="other">4. Building for other systems</h1>
Brian Paul7103a182012-04-19 09:56:36 -0600133
134<p>
135Documentation for other environments (some may be very out of date):
136</p>
137
Andreas Boll210a27d2012-06-12 09:05:36 +0200138<ul>
139<li><a href="README.VMS">README.VMS</a> - VMS
140<li><a href="README.CYGWIN">README.CYGWIN</a> - Cygwin
141<li><a href="README.WIN32">README.WIN32</a> - Win32
142</ul>
Brian Paul7103a182012-04-19 09:56:36 -0600143
144
145
Andreas Boll210a27d2012-06-12 09:05:36 +0200146<h1 id="libs">5. Library Information</h1>
Brian Paul7103a182012-04-19 09:56:36 -0600147
148<p>
149When compilation has finished, look in the top-level <code>lib/</code>
150(or <code>lib64/</code>) directory.
151You'll see a set of library files similar to this:
152</p>
153<pre>
154lrwxrwxrwx 1 brian users 10 Mar 26 07:53 libGL.so -> libGL.so.1*
155lrwxrwxrwx 1 brian users 19 Mar 26 07:53 libGL.so.1 -> libGL.so.1.5.060100*
156-rwxr-xr-x 1 brian users 3375861 Mar 26 07:53 libGL.so.1.5.060100*
Brian Paul7103a182012-04-19 09:56:36 -0600157lrwxrwxrwx 1 brian users 14 Mar 26 07:53 libOSMesa.so -> libOSMesa.so.6*
158lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSMesa.so.6.1.060100*
159-rwxr-xr-x 1 brian users 23871 Mar 26 07:53 libOSMesa.so.6.1.060100*
160</pre>
161
162<p>
163<b>libGL</b> is the main OpenGL library (i.e. Mesa).
164<br>
Brian Paul7103a182012-04-19 09:56:36 -0600165<b>libOSMesa</b> is the OSMesa (Off-Screen) interface library.
166</p>
167
168<p>
169If you built the DRI hardware drivers, you'll also see the DRI drivers:
170</p>
171<pre>
172-rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so
173-rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i965_dri.so
174-rwxr-xr-x 1 brian users 11849858 Jul 21 12:12 r200_dri.so
Brian Paul7103a182012-04-19 09:56:36 -0600175-rwxr-xr-x 1 brian users 11757388 Jul 21 12:12 radeon_dri.so
176</pre>
177
178<p>
179If you built with Gallium support, look in lib/gallium/ for Gallium-based
180versions of libGL and device drivers.
181</p>
182
183
Andreas Boll210a27d2012-06-12 09:05:36 +0200184<h1 id="pkg-config">6. Building OpenGL programs with pkg-config</h1>
Brian5bba58c2007-09-12 10:11:49 -0600185
186<p>
187Running <code>make install</code> will install package configuration files
188for the pkg-config utility.
189</p>
190
191<p>
192When compiling your OpenGL application you can use pkg-config to determine
193the proper compiler and linker flags.
194</p>
195
196<p>
197For example, compiling and linking a GLUT application can be done with:
198</p>
199<pre>
200 gcc `pkg-config --cflags --libs glut` mydemo.c -o mydemo
201</pre>
202
203<br>
Brian Paul5f37abf2003-09-05 14:47:07 +0000204
Andreas Bollb5da52a2012-09-18 18:57:02 +0200205</div>
Brian Paul0b27ace2003-03-08 17:38:57 +0000206</body>
207</html>