Home | History | Annotate | Line # | Download | only in docs
      1      1.1  mrg <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      2      1.1  mrg <html lang="en">
      3      1.1  mrg <head>
      4      1.1  mrg   <meta http-equiv="content-type" content="text/html; charset=utf-8">
      5      1.1  mrg   <title>Compiling and Installing</title>
      6      1.1  mrg   <link rel="stylesheet" type="text/css" href="mesa.css">
      7      1.1  mrg </head>
      8      1.1  mrg <body>
      9      1.1  mrg 
     10      1.1  mrg <div class="header">
     11      1.1  mrg   <h1>The Mesa 3D Graphics Library</h1>
     12      1.1  mrg </div>
     13      1.1  mrg 
     14      1.1  mrg <iframe src="contents.html"></iframe>
     15      1.1  mrg <div class="content">
     16      1.1  mrg 
     17      1.1  mrg <h1>Compiling and Installing</h1>
     18      1.1  mrg 
     19      1.1  mrg <ol>
     20      1.1  mrg <li><a href="#prereq-general">Prerequisites for building</a>
     21      1.1  mrg   <ul>
     22      1.1  mrg   <li><a href="#prereq-general">General prerequisites</a>
     23      1.1  mrg   <li><a href="#prereq-dri">For DRI and hardware acceleration</a>
     24      1.1  mrg   </ul>
     25  1.1.1.2  mrg <li><a href="#meson">Building with meson</a>
     26      1.1  mrg <li><a href="#autoconf">Building with autoconf (Linux/Unix/X11)</a>
     27      1.1  mrg <li><a href="#scons">Building with SCons (Windows/Linux)</a>
     28  1.1.1.2  mrg <li><a href="#android">Building with AOSP (Android)</a>
     29      1.1  mrg <li><a href="#libs">Library Information</a>
     30      1.1  mrg <li><a href="#pkg-config">Building OpenGL programs with pkg-config</a>
     31      1.1  mrg </ol>
     32      1.1  mrg 
     33      1.1  mrg 
     34      1.1  mrg <h1 id="prereq-general">1. Prerequisites for building</h1>
     35      1.1  mrg 
     36      1.1  mrg <h2>1.1 General</h2>
     37  1.1.1.2  mrg 
     38  1.1.1.2  mrg <p>
     39  1.1.1.2  mrg Build system.
     40  1.1.1.2  mrg </p>
     41  1.1.1.2  mrg 
     42      1.1  mrg <ul>
     43  1.1.1.2  mrg <li><a href="https://mesonbuild.com">meson</a> is required when building on *nix platforms.
     44  1.1.1.2  mrg <li>Autoconf was removed in 19.1.0, use meson instead
     45      1.1  mrg <li><a href="http://www.scons.org/">SCons</a> is required for building on
     46  1.1.1.2  mrg Windows and optional for Linux (it's an alternative to meson.)
     47      1.1  mrg </li>
     48  1.1.1.2  mrg <li>Android Build system when building as native Android component. Autoconf
     49  1.1.1.2  mrg is used when when building ARC.
     50      1.1  mrg </li>
     51      1.1  mrg </ul>
     52      1.1  mrg 
     53      1.1  mrg 
     54  1.1.1.2  mrg <p>
     55  1.1.1.2  mrg The following compilers are known to work, if you know of others or you're
     56  1.1.1.2  mrg willing to maintain support for other compiler get in touch.
     57  1.1.1.2  mrg </p>
     58  1.1.1.2  mrg 
     59  1.1.1.2  mrg <ul>
     60  1.1.1.2  mrg <li>GCC 4.2.0 or later (some parts of Mesa may require later versions)
     61  1.1.1.2  mrg <li>clang - exact minimum requirement is currently unknown.
     62  1.1.1.2  mrg <li>Microsoft Visual Studio 2015 or later is required, for building on Windows.
     63  1.1.1.2  mrg </ul>
     64  1.1.1.2  mrg 
     65      1.1  mrg 
     66      1.1  mrg <p>
     67  1.1.1.2  mrg Third party/extra tools.
     68  1.1.1.2  mrg <br>
     69  1.1.1.2  mrg <strong>Note</strong>: These should not be required, when building from a release tarball. If
     70  1.1.1.2  mrg you think you've spotted a bug let developers know by filing a
     71  1.1.1.2  mrg <a href="bugs.html">bug report</a>.
     72      1.1  mrg </p>
     73      1.1  mrg 
     74  1.1.1.2  mrg 
     75      1.1  mrg <ul>
     76  1.1.1.2  mrg <li><a href="https://www.python.org/">Python</a> - Python is required.
     77  1.1.1.2  mrg When building with scons 2.7 is required.
     78  1.1.1.2  mrg When building with meson 3.5 or newer is required.
     79  1.1.1.2  mrg </li>
     80  1.1.1.2  mrg <li><a href="http://www.makotemplates.org/">Python Mako module</a> -
     81  1.1.1.2  mrg Python Mako module is required. Version 0.8.0 or later should work.
     82  1.1.1.2  mrg </li>
     83  1.1.1.2  mrg <li>lex / yacc - for building the Mesa IR and GLSL compiler.
     84  1.1.1.2  mrg <div>
     85  1.1.1.2  mrg On Linux systems, flex and bison versions 2.5.35 and 2.4.1, respectively,
     86  1.1.1.2  mrg (or later) should work.
     87  1.1.1.2  mrg On Windows with MinGW, install flex and bison with:
     88  1.1.1.2  mrg <pre>mingw-get install msys-flex msys-bison</pre>
     89  1.1.1.2  mrg For MSVC on Windows, install
     90  1.1.1.2  mrg <a href="http://winflexbison.sourceforge.net/">Win flex-bison</a>.
     91  1.1.1.2  mrg </div>
     92      1.1  mrg </ul>
     93  1.1.1.2  mrg <p><strong>Note</strong>: Some versions can be buggy (eg. flex 2.6.2) so do try others if things fail.</p>
     94  1.1.1.2  mrg 
     95  1.1.1.2  mrg 
     96  1.1.1.2  mrg <h3 id="prereq-dri">1.2 Requirements</h3>
     97  1.1.1.2  mrg 
     98      1.1  mrg <p>
     99  1.1.1.2  mrg The requirements depends on the features selected at configure stage.
    100  1.1.1.2  mrg Check/install the respective -devel package as prompted by the configure error
    101  1.1.1.2  mrg message.
    102      1.1  mrg </p>
    103      1.1  mrg 
    104  1.1.1.2  mrg <p>
    105  1.1.1.2  mrg Here are some common ways to retrieve most/all of the dependencies based on
    106  1.1.1.2  mrg the packaging tool used by your distro.
    107  1.1.1.2  mrg </p>
    108      1.1  mrg 
    109  1.1.1.2  mrg <pre>
    110  1.1.1.2  mrg   zypper source-install --build-deps-only Mesa # openSUSE/SLED/SLES
    111  1.1.1.2  mrg   yum-builddep mesa # yum Fedora, OpenSuse(?)
    112  1.1.1.2  mrg   dnf builddep mesa # dnf Fedora
    113  1.1.1.2  mrg   apt-get build-dep mesa # Debian and derivatives
    114  1.1.1.2  mrg   ... # others
    115  1.1.1.2  mrg </pre>
    116      1.1  mrg 
    117  1.1.1.2  mrg <h1 id="meson">2. Building with meson</h1>
    118      1.1  mrg 
    119      1.1  mrg <p>
    120  1.1.1.2  mrg Meson is the latest build system in mesa, it is currently able to build for
    121  1.1.1.2  mrg *nix systems like Linux and BSD, and will be able to build for windows as well.
    122      1.1  mrg </p>
    123      1.1  mrg 
    124      1.1  mrg <p>
    125  1.1.1.2  mrg The general approach is:
    126      1.1  mrg </p>
    127      1.1  mrg <pre>
    128  1.1.1.2  mrg   meson builddir/
    129  1.1.1.2  mrg   ninja -C builddir/
    130  1.1.1.2  mrg   sudo ninja -C builddir/ install
    131      1.1  mrg </pre>
    132      1.1  mrg <p>
    133  1.1.1.2  mrg Please read the <a href="meson.html">detailed meson instructions</a>
    134  1.1.1.2  mrg for more information
    135  1.1.1.2  mrg </p>
    136  1.1.1.2  mrg 
    137  1.1.1.2  mrg <h1 id="autoconf">3. Building with autoconf (Linux/Unix/X11)</h1>
    138  1.1.1.2  mrg 
    139  1.1.1.2  mrg <p>
    140  1.1.1.2  mrg   Autoconf support was removed in Mesa 19.1.0. Please use meson instead.
    141      1.1  mrg </p>
    142      1.1  mrg 
    143      1.1  mrg 
    144      1.1  mrg 
    145  1.1.1.2  mrg <h1 id="scons">4. Building with SCons (Windows/Linux)</h1>
    146      1.1  mrg 
    147      1.1  mrg <p>
    148      1.1  mrg To build Mesa with SCons on Linux or Windows do
    149      1.1  mrg </p>
    150      1.1  mrg <pre>
    151      1.1  mrg     scons
    152      1.1  mrg </pre>
    153      1.1  mrg <p>
    154      1.1  mrg The build output will be placed in
    155      1.1  mrg build/<i>platform</i>-<i>machine</i>-<i>debug</i>/..., where <i>platform</i> is for
    156      1.1  mrg example linux or windows, <i>machine</i> is x86 or x86_64, optionally followed
    157      1.1  mrg by -debug for debug builds.
    158      1.1  mrg </p>
    159      1.1  mrg 
    160      1.1  mrg <p>
    161      1.1  mrg To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do
    162      1.1  mrg </p>
    163      1.1  mrg <pre>
    164  1.1.1.2  mrg     scons platform=windows toolchain=crossmingw machine=x86 libgl-gdi
    165      1.1  mrg </pre>
    166      1.1  mrg <p>
    167      1.1  mrg This will create:
    168      1.1  mrg </p>
    169      1.1  mrg <ul>
    170  1.1.1.2  mrg <li>build/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll &mdash; Mesa + Gallium + softpipe (or llvmpipe), binary compatible with Windows's opengl32.dll
    171      1.1  mrg </ul>
    172      1.1  mrg <p>
    173      1.1  mrg Put them all in the same directory to test them.
    174  1.1.1.2  mrg 
    175  1.1.1.2  mrg Additional information is available in <a href="README.WIN32">README.WIN32</a>.
    176  1.1.1.2  mrg 
    177      1.1  mrg </p>
    178      1.1  mrg 
    179      1.1  mrg 
    180      1.1  mrg 
    181  1.1.1.2  mrg <h1 id="android">5. Building with AOSP (Android)</h1>
    182      1.1  mrg 
    183      1.1  mrg <p>
    184  1.1.1.2  mrg Currently one can build Mesa for Android as part of the AOSP project, yet
    185  1.1.1.2  mrg your experience might vary.
    186      1.1  mrg </p>
    187      1.1  mrg 
    188  1.1.1.2  mrg <p>
    189  1.1.1.2  mrg In order to achieve that one should update their local manifest to point to the
    190  1.1.1.2  mrg upstream repo, set the appropriate BOARD_GPU_DRIVERS and build the
    191  1.1.1.2  mrg libGLES_mesa library.
    192  1.1.1.2  mrg </p>
    193      1.1  mrg 
    194  1.1.1.2  mrg <p>
    195  1.1.1.2  mrg FINISHME: Improve on the instructions add references to Rob H repos/Jenkins,
    196  1.1.1.2  mrg Android-x86 and/or other resources.
    197  1.1.1.2  mrg </p>
    198      1.1  mrg 
    199      1.1  mrg 
    200  1.1.1.2  mrg <h1 id="libs">6. Library Information</h1>
    201      1.1  mrg 
    202      1.1  mrg <p>
    203      1.1  mrg When compilation has finished, look in the top-level <code>lib/</code>
    204      1.1  mrg (or <code>lib64/</code>) directory.
    205      1.1  mrg You'll see a set of library files similar to this:
    206      1.1  mrg </p>
    207      1.1  mrg <pre>
    208  1.1.1.2  mrg lrwxrwxrwx    1 brian    users          10 Mar 26 07:53 libGL.so -&gt; libGL.so.1*
    209  1.1.1.2  mrg lrwxrwxrwx    1 brian    users          19 Mar 26 07:53 libGL.so.1 -&gt; libGL.so.1.5.060100*
    210      1.1  mrg -rwxr-xr-x    1 brian    users     3375861 Mar 26 07:53 libGL.so.1.5.060100*
    211  1.1.1.2  mrg lrwxrwxrwx    1 brian    users          14 Mar 26 07:53 libOSMesa.so -&gt; libOSMesa.so.6*
    212  1.1.1.2  mrg lrwxrwxrwx    1 brian    users          23 Mar 26 07:53 libOSMesa.so.6 -&gt; libOSMesa.so.6.1.060100*
    213      1.1  mrg -rwxr-xr-x    1 brian    users       23871 Mar 26 07:53 libOSMesa.so.6.1.060100*
    214      1.1  mrg </pre>
    215      1.1  mrg 
    216      1.1  mrg <p>
    217      1.1  mrg <b>libGL</b> is the main OpenGL library (i.e. Mesa).
    218      1.1  mrg <br>
    219      1.1  mrg <b>libOSMesa</b> is the OSMesa (Off-Screen) interface library.
    220      1.1  mrg </p>
    221      1.1  mrg 
    222      1.1  mrg <p>
    223      1.1  mrg If you built the DRI hardware drivers, you'll also see the DRI drivers:
    224      1.1  mrg </p>
    225      1.1  mrg <pre>
    226      1.1  mrg -rwxr-xr-x   1 brian users 16895413 Jul 21 12:11 i915_dri.so
    227      1.1  mrg -rwxr-xr-x   1 brian users 16895413 Jul 21 12:11 i965_dri.so
    228      1.1  mrg -rwxr-xr-x   1 brian users 11849858 Jul 21 12:12 r200_dri.so
    229      1.1  mrg -rwxr-xr-x   1 brian users 11757388 Jul 21 12:12 radeon_dri.so
    230      1.1  mrg </pre>
    231      1.1  mrg 
    232      1.1  mrg <p>
    233      1.1  mrg If you built with Gallium support, look in lib/gallium/ for Gallium-based
    234      1.1  mrg versions of libGL and device drivers.
    235      1.1  mrg </p>
    236      1.1  mrg 
    237      1.1  mrg 
    238  1.1.1.2  mrg <h1 id="pkg-config">7. Building OpenGL programs with pkg-config</h1>
    239      1.1  mrg 
    240      1.1  mrg <p>
    241  1.1.1.2  mrg Running <code>ninja install</code> will install package configuration files
    242      1.1  mrg for the pkg-config utility.
    243      1.1  mrg </p>
    244      1.1  mrg 
    245      1.1  mrg <p>
    246      1.1  mrg When compiling your OpenGL application you can use pkg-config to determine
    247      1.1  mrg the proper compiler and linker flags.
    248      1.1  mrg </p>
    249      1.1  mrg 
    250      1.1  mrg <p>
    251      1.1  mrg For example, compiling and linking a GLUT application can be done with:
    252      1.1  mrg </p>
    253      1.1  mrg <pre>
    254      1.1  mrg    gcc `pkg-config --cflags --libs glut` mydemo.c -o mydemo
    255      1.1  mrg </pre>
    256      1.1  mrg 
    257      1.1  mrg <br>
    258      1.1  mrg 
    259      1.1  mrg </div>
    260      1.1  mrg </body>
    261      1.1  mrg </html>
    262