VirtualBox

source: vbox/trunk/src/VBox/Additions/3D/mesa/mesa-21.3.8/docs/install.rst@ 107981

Last change on this file since 107981 was 96488, checked in by vboxsync, 3 years ago

Additions/3D/mesa: Export to OSE and remove symlinks.

  • Property svn:eol-style set to native
File size: 7.4 KB
Line 
1Compiling and Installing
2========================
3
4.. toctree::
5 :maxdepth: 1
6 :hidden:
7
8 meson
9
101. Prerequisites for building
11-----------------------------
12
131.1 General
14~~~~~~~~~~~
15
16Build system
17^^^^^^^^^^^^
18
19- `Meson <https://mesonbuild.com>`__ is required when building on \*nix
20 platforms and on Windows.
21- Android Build system when building as native Android component. Meson
22 is used when building ARC.
23
24Compiler
25^^^^^^^^
26
27The following compilers are known to work, if you know of others or
28you're willing to maintain support for other compiler get in touch.
29
30- GCC 4.2.0 or later (some parts of Mesa may require later versions)
31- Clang - exact minimum requirement is currently unknown.
32- Microsoft Visual Studio 2015 or later is required, for building on
33 Windows.
34
35Third party/extra tools.
36^^^^^^^^^^^^^^^^^^^^^^^^
37
38- `Python <https://www.python.org/>`__ - Python 3.5 or newer is required.
39- `Python Mako module <http://www.makotemplates.org/>`__ - Python Mako
40 module is required. Version 0.8.0 or later should work.
41- Lex / Yacc - for building the Mesa IR and GLSL compiler.
42
43 On Linux systems, Flex and Bison versions 2.5.35 and 2.4.1,
44 respectively, (or later) should work. On Windows with MinGW, install
45 Flex and Bison with:
46
47 .. code-block:: console
48
49 mingw-get install msys-flex msys-bison
50
51 For MSVC on Windows, install `Win
52 flex-bison <http://winflexbison.sourceforge.net/>`__.
53
54.. note::
55
56 Some versions can be buggy (e.g. Flex 2.6.2) so do try others
57 if things fail.
58
591.2 Requirements
60~~~~~~~~~~~~~~~~
61
62The requirements depends on the features selected at configure stage.
63Check/install the respective development package as prompted by the
64configure error message.
65
66Here are some common ways to retrieve most/all of the dependencies based
67on the packaging tool used by your distro.
68
69.. code-block:: console
70
71 zypper source-install --build-deps-only Mesa # openSUSE/SLED/SLES
72 yum-builddep mesa # yum Fedora, OpenSuse(?)
73 dnf builddep mesa # dnf Fedora
74 apt-get build-dep mesa # Debian and derivatives
75 ... # others
76
772. Building with meson
78----------------------
79
80**Meson >= 0.46.0 is required**
81
82Meson is the latest build system in mesa, it is currently able to build
83for \*nix systems like Linux and BSD, macOS, Haiku, and Windows.
84
85The general approach is:
86
87.. code-block:: console
88
89 meson builddir/
90 ninja -C builddir/
91 sudo ninja -C builddir/ install
92
93On Windows you can also use the Visual Studio backend
94
95.. code-block:: console
96
97 meson builddir --backend=vs
98 cd builddir
99 msbuild mesa.sln /m
100
101Please read the :doc:`detailed meson instructions <meson>` for more
102information
103
1043. Running against a local build
105--------------------------------
106
107It's often necessary or useful when debugging driver issues or testing new
108branches to run against a local build of Mesa without doing a system-wide
109install. To do this, choose a temporary location for the install. A directory
110called ``installdir`` inside your mesa tree is as good as anything. All of the
111commands below will assume ``$MESA_INSTALLDIR`` is an absolute path to this
112location.
113
114First, configure Mesa and install in the temporary location:
115
116.. code-block:: console
117
118 meson builddir/ -Dprefix="$MESA_INSTALLDIR" OTHER_OPTIONS
119 ninja -C builddir/ install
120
121where ``OTHER_OPTIONS`` is replaced by any meson configuration options you may
122want. For instance, if you want to build the LLVMpipe drivers, it would look
123like this:
124
125.. code-block:: console
126
127 meson builddir/ -Dprefix="$MESA_INSTALLDIR" -Ddri-drivers= \
128 -Dgallium-drivers=swrast -Dvulkan-drivers=swrast
129 ninja -C builddir/ install
130
131Once Mesa has built and installed to ``$MESA_INSTALLDIR``, you can run any app
132against your temporary install by setting the right environment variables.
133Which variable you have to set depends on the API.
134
135OpenGL
136~~~~~~
137
138.. code-block:: console
139
140 LD_LIBRARY_PATH="$MESA_INSTALLDIR/lib64" glxinfo
141
142You may need to use ``lib`` instead of ``lib64`` on some systems or a full
143library specifier on debian. Look inside ``installdir`` for the directory that
144contains ``libGL.so`` and use that one.
145
146Vulkan
147~~~~~~
148
149.. code-block:: console
150
151 VK_ICD_FILENAMES="$MESA_INSTALLDIR/share/vulkan/icd/my_icd.json" vulkaninfo
152
153where ``my_icd.json`` is replaced with the actual ICD json file name. This
154will depend on your driver. For instance, the 64-bit lavapipe driver ICD file
155is named ``lvp_icd.x86_64.json``.
156
157OpenCL
158~~~~~~
159
160.. code-block:: console
161
162 OCL_ICD_VENDORS="$MESA_INSTALLDIR/etc/OpenCL/vendors" clinfo
163
164Unlike Vulkan, OpenCL takes a path to the whole ``vendors`` folder and will
165enumerate any drivers found there.
166
167Troubleshooting local builds
168~~~~~~~~~~~~~~~~~~~~~~~~~~~~
169
170If you are trying to run an app against a local build and it's not working,
171here are a few things to check:
172
173 1. Double-check your paths and try with the simplest app you can. Before
174 banging your head on a Steam game, make sure your path works with
175 ``glxgears`` first.
176
177 2. Watch out for wrapper scripts. Some more complex apps such as games have
178 big start-up scripts. Sometimes those scripts scrub the environment or set
179 ``LD_LIBRARY_PATH`` to something in the game's install directory.
180
181 3. Is your Mesa build the same arch as your app? Lots of games are still
182 32-bit and your Mesa build is probably 64-bit by default.
183
184 4. 32 and 64-bit builds in the same local install directory doesn't typically
185 work. Distros go to great lengths to make this work in your system install
186 and it's hard to get it right for a local install. If you've recently
187 built 64-bit and are now building 32-bit, throw away the install directory
188 first to prevent conflicts.
189
1904. Building with AOSP (Android)
191-------------------------------
192
193<TODO>
194
1955. Library Information
196----------------------
197
198When compilation has finished, look in the top-level ``lib/`` (or
199``lib64/``) directory. You'll see a set of library files similar to
200this:
201
202.. code-block:: console
203
204 lrwxrwxrwx 1 brian users 10 Mar 26 07:53 libGL.so -> libGL.so.1*
205 lrwxrwxrwx 1 brian users 19 Mar 26 07:53 libGL.so.1 -> libGL.so.1.5.060100*
206 -rwxr-xr-x 1 brian users 3375861 Mar 26 07:53 libGL.so.1.5.060100*
207 lrwxrwxrwx 1 brian users 14 Mar 26 07:53 libOSMesa.so -> libOSMesa.so.6*
208 lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSMesa.so.6.1.060100*
209 -rwxr-xr-x 1 brian users 23871 Mar 26 07:53 libOSMesa.so.6.1.060100*
210
211**libGL** is the main OpenGL library (i.e. Mesa), while **libOSMesa** is
212the OSMesa (Off-Screen) interface library.
213
214If you built the DRI hardware drivers, you'll also see the DRI drivers:
215
216.. code-block:: console
217
218 -rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so
219 -rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i965_dri.so
220 -rwxr-xr-x 1 brian users 11849858 Jul 21 12:12 r200_dri.so
221 -rwxr-xr-x 1 brian users 11757388 Jul 21 12:12 radeon_dri.so
222
223If you built with Gallium support, look in lib/gallium/ for
224Gallium-based versions of libGL and device drivers.
225
2266. Building OpenGL programs with pkg-config
227-------------------------------------------
228
229Running ``ninja install`` will install package configuration files for
230the pkg-config utility.
231
232When compiling your OpenGL application you can use pkg-config to
233determine the proper compiler and linker flags.
234
235For example, compiling and linking a GLUT application can be done with:
236
237.. code-block:: console
238
239 gcc `pkg-config --cflags --libs glut` mydemo.c -o mydemo
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette