Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 1 | <HTML> |
| 2 | |
Brian Paul | 49a3fab | 2008-12-30 07:57:16 -0700 | [diff] [blame] | 3 | <TITLE>Compiling and Installing</TITLE> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 4 | |
Brian Paul | 36da045 | 2005-01-20 03:55:10 +0000 | [diff] [blame] | 5 | <link rel="stylesheet" type="text/css" href="mesa.css"></head> |
| 6 | |
| 7 | <BODY> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 8 | |
Brian Paul | 5f37abf | 2003-09-05 14:47:07 +0000 | [diff] [blame] | 9 | |
Brian Paul | 49a3fab | 2008-12-30 07:57:16 -0700 | [diff] [blame] | 10 | <H1>Compiling and Installing</H1> |
Brian Paul | 5f37abf | 2003-09-05 14:47:07 +0000 | [diff] [blame] | 11 | |
| 12 | <ol> |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 13 | <li><a href="#prereq-general">Prerequisites for building</a> |
Brian Paul | 49a3fab | 2008-12-30 07:57:16 -0700 | [diff] [blame] | 14 | <ul> |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 15 | <li><a href="#prereq-general">General prerequisites</a> |
| 16 | <li><a href="#prereq-dri">For DRI and hardware acceleration</a> |
Brian Paul | 49a3fab | 2008-12-30 07:57:16 -0700 | [diff] [blame] | 17 | </ul> |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 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 |
Brian Paul | 5f37abf | 2003-09-05 14:47:07 +0000 | [diff] [blame] | 24 | </ol> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 25 | |
Brian Paul | 8bd70a7 | 2008-05-27 13:27:57 -0600 | [diff] [blame] | 26 | |
Brian Paul | 32a11e5 | 2011-04-04 11:30:46 -0600 | [diff] [blame] | 27 | <a name="prereq-general"> |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 28 | <h1>1. Prerequisites for building</h1> |
Brian Paul | 32a11e5 | 2011-04-04 11:30:46 -0600 | [diff] [blame] | 29 | |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 30 | <h2>1.1 General</h2> |
Brian Paul | 32a11e5 | 2011-04-04 11:30:46 -0600 | [diff] [blame] | 31 | <ul> |
| 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. |
Brian Paul | 4f869e9 | 2012-03-05 13:02:59 -0700 | [diff] [blame] | 35 | <br> |
| 36 | <br> |
| 37 | On Windows with MinGW, install flex and bison with: |
| 38 | <pre>mingw-get install msys-flex msys-bison</pre> |
Brian Paul | 32a11e5 | 2011-04-04 11:30:46 -0600 | [diff] [blame] | 39 | </li> |
| 40 | <li>python - Python is needed for building the Gallium components. |
| 41 | Version 2.6.4 or later should work. |
Brian Paul | 4f869e9 | 2012-03-05 13:02:59 -0700 | [diff] [blame] | 42 | <br> |
| 43 | <br> |
| 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>. |
Brian Paul | 32a11e5 | 2011-04-04 11:30:46 -0600 | [diff] [blame] | 46 | </li> |
| 47 | </ul> |
| 48 | |
| 49 | |
| 50 | <a name="prereq-dri"> |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 51 | <h3>1.2 For DRI and hardware acceleration</h3> |
Brian Paul | 5f37abf | 2003-09-05 14:47:07 +0000 | [diff] [blame] | 52 | |
| 53 | <p> |
Brian Paul | 9069248 | 2009-10-08 20:49:32 -0600 | [diff] [blame] | 54 | The following are required for DRI-based hardware acceleration with Mesa: |
Brian Paul | 8bd70a7 | 2008-05-27 13:27:57 -0600 | [diff] [blame] | 55 | </p> |
| 56 | |
Brian Paul | 49a3fab | 2008-12-30 07:57:16 -0700 | [diff] [blame] | 57 | <ul> |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 58 | <li><a href="http://xorg.freedesktop.org/releases/individual/proto/" |
| 59 | target="_parent">dri2proto</a> version 2.6 or later |
Brian Paul | 2c56dd7 | 2009-01-10 11:52:55 -0700 | [diff] [blame] | 60 | <li><a href="http://dri.freedesktop.org/libdrm/" target="_parent">libDRM</a> |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 61 | version 2.4.33 or later |
Brian Paul | 2c56dd7 | 2009-01-10 11:52:55 -0700 | [diff] [blame] | 62 | <li>Xorg server version 1.5 or later |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 63 | <li>Linux 2.6.28 or later |
Brian Paul | 49a3fab | 2008-12-30 07:57:16 -0700 | [diff] [blame] | 64 | </ul> |
Brian Paul | 8bd70a7 | 2008-05-27 13:27:57 -0600 | [diff] [blame] | 65 | </p> |
Alex Hultman | c3fe44c | 2012-03-16 09:46:42 -0600 | [diff] [blame] | 66 | <p> |
| 67 | If you're using a fedora distro the following command should install all |
| 68 | the needed dependencies: |
| 69 | <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 Paul | 8bd70a7 | 2008-05-27 13:27:57 -0600 | [diff] [blame] | 74 | |
| 75 | |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 76 | |
Brian Paul | 49a3fab | 2008-12-30 07:57:16 -0700 | [diff] [blame] | 77 | <a name="autoconf"> |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 78 | <H1>2. Building with autoconf (Linux/Unix/X11)</H1> |
Brian Paul | 8bd70a7 | 2008-05-27 13:27:57 -0600 | [diff] [blame] | 79 | |
| 80 | <p> |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 81 | The primary method to build Mesa on Unix systems is with autoconf. |
| 82 | </p> |
Brian Paul | 8bd70a7 | 2008-05-27 13:27:57 -0600 | [diff] [blame] | 83 | |
| 84 | <p> |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 85 | The general approach is the standard: |
| 86 | <pre> |
| 87 | ./configure |
| 88 | make |
| 89 | sudo make install |
| 90 | </pre> |
| 91 | But please read the <a href="autoconf.html">detailed autoconf instructions</a> |
| 92 | for more details. |
| 93 | </p> |
| 94 | |
| 95 | |
| 96 | |
| 97 | <a name="scons"> |
| 98 | <H1>3. Building with SCons (Windows)</H1> |
| 99 | |
| 100 | <p> |
| 101 | To build Mesa with SCons on Linux or Windows do |
| 102 | </p> |
| 103 | <pre> |
| 104 | scons |
| 105 | </pre> |
| 106 | <p> |
| 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. |
| 111 | </p> |
| 112 | |
| 113 | <p> |
| 114 | To 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> |
| 120 | This will create: |
| 121 | </p> |
| 122 | <ul> |
| 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 |
| 125 | </ul> |
| 126 | <p> |
| 127 | Put them all in the same directory to test them. |
| 128 | </p> |
| 129 | |
| 130 | |
| 131 | |
| 132 | <a name="legacy"> |
| 133 | <h1>4. Building with legacy Makefiles (deprecated)</h1> |
| 134 | |
| 135 | <p> |
| 136 | The legacy Mesa build system is based on a collection of pre-defined |
Brian Paul | 8bd70a7 | 2008-05-27 13:27:57 -0600 | [diff] [blame] | 137 | system configurations. |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 138 | Some of these might work for older systems not supported by autoconf. |
Brian Paul | 8bd70a7 | 2008-05-27 13:27:57 -0600 | [diff] [blame] | 139 | </p> |
| 140 | <p> |
Brian Paul | 49a3fab | 2008-12-30 07:57:16 -0700 | [diff] [blame] | 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> |
| 143 | <em>configname</em>. |
Brian Paul | 8bd70a7 | 2008-05-27 13:27:57 -0600 | [diff] [blame] | 144 | </p> |
| 145 | |
| 146 | <p> |
| 147 | Mesa may be built in several different ways using the predefined configurations: |
Brian Paul | 5f37abf | 2003-09-05 14:47:07 +0000 | [diff] [blame] | 148 | </p> |
Brian Paul | f87bb14 | 2005-07-21 18:45:44 +0000 | [diff] [blame] | 149 | <ul> |
Brian Paul | 5dbd0a4 | 2006-06-08 23:42:07 +0000 | [diff] [blame] | 150 | <li><b><em>Stand-alone/Xlib mode</em></b> - Mesa will be compiled as |
Brian Paul | f87bb14 | 2005-07-21 18:45:44 +0000 | [diff] [blame] | 151 | a software renderer using Xlib to do all rendering. |
Brian Paul | 5dbd0a4 | 2006-06-08 23:42:07 +0000 | [diff] [blame] | 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). |
Brian Paul | d9eff8b | 2006-07-12 20:14:43 +0000 | [diff] [blame] | 155 | You will <em>not</em> be able to use hardware 3D acceleration. |
Brian Paul | b0eee79 | 2003-03-16 16:43:04 +0000 | [diff] [blame] | 156 | <p> |
Brian Paul | 49a3fab | 2008-12-30 07:57:16 -0700 | [diff] [blame] | 157 | To compile stand-alone Mesa type <code>make</code> in the top-level directory. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 158 | You'll see a list of supported system configurations. |
Brian Paul | 5f37abf | 2003-09-05 14:47:07 +0000 | [diff] [blame] | 159 | Choose one from the list (such as linux-x86), and type: |
| 160 | </p> |
| 161 | <pre> |
| 162 | make linux-x86 |
| 163 | </pre> |
Brian Paul | f87bb14 | 2005-07-21 18:45:44 +0000 | [diff] [blame] | 164 | <p>This will produce libGL.so and several other libraries</p> |
| 165 | </li> |
| 166 | |
Brian Paul | 5dbd0a4 | 2006-06-08 23:42:07 +0000 | [diff] [blame] | 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. |
| 171 | |
Brian Paul | 5dbd0a4 | 2006-06-08 23:42:07 +0000 | [diff] [blame] | 172 | |
| 173 | <p> |
| 174 | Build Mesa and the DRI hardware drivers by running |
Brian Paul | f87bb14 | 2005-07-21 18:45:44 +0000 | [diff] [blame] | 175 | </p> |
| 176 | <pre> |
Brian Paul | 5dbd0a4 | 2006-06-08 23:42:07 +0000 | [diff] [blame] | 177 | make linux-dri |
Brian Paul | f87bb14 | 2005-07-21 18:45:44 +0000 | [diff] [blame] | 178 | </pre> |
| 179 | <p> |
| 180 | There are also <code>linux-dri-x86</code>, <code>linux-dri-x86-64</code>, |
Brian Paul | 5dbd0a4 | 2006-06-08 23:42:07 +0000 | [diff] [blame] | 181 | and <code>linux-ppc</code> configurations which are optimized for those |
| 182 | architectures. |
Brian Paul | f87bb14 | 2005-07-21 18:45:44 +0000 | [diff] [blame] | 183 | </p> |
Brian Paul | 8bd70a7 | 2008-05-27 13:27:57 -0600 | [diff] [blame] | 184 | <p> |
| 185 | Make sure you have the prerequisite versions of DRM and Xserver mentioned |
| 186 | above. |
| 187 | </p> |
Brian Paul | f87bb14 | 2005-07-21 18:45:44 +0000 | [diff] [blame] | 188 | |
Brian Paul | f87bb14 | 2005-07-21 18:45:44 +0000 | [diff] [blame] | 189 | </ul> |
| 190 | |
| 191 | |
| 192 | <p> |
| 193 | Later, if you want to rebuild for a different configuration run |
Brian Paul | 26f334a | 2004-03-26 15:20:08 +0000 | [diff] [blame] | 194 | <code>make realclean</code> before rebuilding. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 195 | </p> |
| 196 | |
Brian Paul | 26f334a | 2004-03-26 15:20:08 +0000 | [diff] [blame] | 197 | |
Brian Paul | 5f37abf | 2003-09-05 14:47:07 +0000 | [diff] [blame] | 198 | |
Brian Paul | 49a3fab | 2008-12-30 07:57:16 -0700 | [diff] [blame] | 199 | <a name="install"> |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 200 | <H2>Installing the header and library files</H2> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 201 | |
| 202 | <p> |
| 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>. |
| 209 | </p> |
| 210 | |
| 211 | <p> |
| 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>. |
| 215 | </p> |
| 216 | |
| 217 | <p> |
Brian Paul | d9eff8b | 2006-07-12 20:14:43 +0000 | [diff] [blame] | 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. |
Dan Nicholson | f5557c3 | 2007-09-12 09:57:53 -0600 | [diff] [blame] | 221 | Change them if needed, then run <code>make install</code>. |
| 222 | </p> |
| 223 | |
| 224 | <p> |
| 225 | The variable |
| 226 | <b>DESTDIR</b> may also be used to install the contents to a temporary |
| 227 | staging directory. |
| 228 | This can be useful for package management. |
| 229 | For example: <code>make install DESTDIR=/somepath/</code> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 230 | </p> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 231 | |
| 232 | <p> |
Brian Paul | d9eff8b | 2006-07-12 20:14:43 +0000 | [diff] [blame] | 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. |
Brian Paul | 5f37abf | 2003-09-05 14:47:07 +0000 | [diff] [blame] | 236 | This is a handy way to compare multiple OpenGL implementations. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 237 | </p> |
| 238 | |
Brian Paul | 5f37abf | 2003-09-05 14:47:07 +0000 | [diff] [blame] | 239 | |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 240 | |
| 241 | |
| 242 | <a name="other"> |
| 243 | <H1>5. Building for other systems</H1> |
| 244 | |
| 245 | <p> |
| 246 | Documentation for other environments (some may be very out of date): |
| 247 | </p> |
| 248 | |
| 249 | <UL> |
| 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 |
| 253 | </UL> |
| 254 | |
| 255 | |
| 256 | |
| 257 | <a name="libs"> |
| 258 | <H1>6. Library Information</H1> |
| 259 | |
| 260 | <p> |
| 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: |
| 264 | </p> |
| 265 | <pre> |
| 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* |
| 275 | </pre> |
| 276 | |
| 277 | <p> |
| 278 | <b>libGL</b> is the main OpenGL library (i.e. Mesa). |
| 279 | <br> |
| 280 | <b>libGLU</b> is the OpenGL Utility library. |
| 281 | <br> |
| 282 | <b>libOSMesa</b> is the OSMesa (Off-Screen) interface library. |
| 283 | </p> |
| 284 | |
| 285 | <p> |
| 286 | If you built the DRI hardware drivers, you'll also see the DRI drivers: |
| 287 | </p> |
| 288 | <pre> |
| 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 |
| 294 | </pre> |
| 295 | |
| 296 | <p> |
| 297 | If you built with Gallium support, look in lib/gallium/ for Gallium-based |
| 298 | versions of libGL and device drivers. |
| 299 | </p> |
| 300 | |
| 301 | |
Brian Paul | 49a3fab | 2008-12-30 07:57:16 -0700 | [diff] [blame] | 302 | <a name="pkg-config"> |
Brian Paul | 7103a18 | 2012-04-19 09:56:36 -0600 | [diff] [blame^] | 303 | <H1>7. Building OpenGL programs with pkg-config</H1> |
Brian | 5bba58c | 2007-09-12 10:11:49 -0600 | [diff] [blame] | 304 | |
| 305 | <p> |
| 306 | Running <code>make install</code> will install package configuration files |
| 307 | for the pkg-config utility. |
| 308 | </p> |
| 309 | |
| 310 | <p> |
| 311 | When compiling your OpenGL application you can use pkg-config to determine |
| 312 | the proper compiler and linker flags. |
| 313 | </p> |
| 314 | |
| 315 | <p> |
| 316 | For example, compiling and linking a GLUT application can be done with: |
| 317 | </p> |
| 318 | <pre> |
| 319 | gcc `pkg-config --cflags --libs glut` mydemo.c -o mydemo |
| 320 | </pre> |
| 321 | |
| 322 | <br> |
Brian Paul | 5f37abf | 2003-09-05 14:47:07 +0000 | [diff] [blame] | 323 | |
Brian Paul | 5f37abf | 2003-09-05 14:47:07 +0000 | [diff] [blame] | 324 | |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 325 | </body> |
| 326 | </html> |