| 1 |
Compilation and Installation Using Meson |
| 2 |
======================================== |
| 3 |
|
| 4 |
1. Introduction |
| 5 |
--------------- |
| 6 |
|
| 7 |
For general information about Meson see the `Meson |
| 8 |
website <https://mesonbuild.com/>`__. |
| 9 |
|
| 10 |
.. note:: |
| 11 |
|
| 12 |
If your distribution doesn't have something recent enough in its |
| 13 |
repositories, you can `try the methods suggested here |
| 14 |
<https://mesonbuild.com/Getting-meson.html>`__ to install the |
| 15 |
current version of Meson. |
| 16 |
|
| 17 |
The Meson build of Mesa is tested on Linux, macOS, Windows, Cygwin, |
| 18 |
Haiku, FreeBSD, DragonflyBSD, NetBSD, and should work on OpenBSD. |
| 19 |
|
| 20 |
Unix-like OSes |
| 21 |
^^^^^^^^^^^^^^ |
| 22 |
|
| 23 |
If Meson is not already installed on your system, you can typically |
| 24 |
install it with your package installer. For example: |
| 25 |
|
| 26 |
.. code-block:: sh |
| 27 |
|
| 28 |
sudo apt-get install meson # Ubuntu |
| 29 |
|
| 30 |
or |
| 31 |
|
| 32 |
.. code-block:: sh |
| 33 |
|
| 34 |
sudo dnf install meson # Fedora |
| 35 |
|
| 36 |
Some older versions of Meson do not check that they are too old and will |
| 37 |
error out in odd ways. |
| 38 |
|
| 39 |
You'll also need `Ninja <https://ninja-build.org/>`__. If it's not |
| 40 |
already installed, use apt-get or dnf to install the *ninja-build* |
| 41 |
package. |
| 42 |
|
| 43 |
Dependencies |
| 44 |
++++++++++++ |
| 45 |
|
| 46 |
Following are the dependencies you would need to install on linux to build and install mesa main. You can install these packages using your linux distibutions' package manager. |
| 47 |
On Debian, Ubuntu and similar, ``sudo apt-get build-dep mesa`` installs |
| 48 |
most of these with just one command. On Fedora and similar, ``sudo dnf |
| 49 |
builddep mesa`` does the same. |
| 50 |
|
| 51 |
.. note:: |
| 52 |
All these dependencies are for latest Linux distributions and is tested on Ubuntu 24.xx only for now. |
| 53 |
|
| 54 |
Also note, some packages below might not be available in your OS with the exact name, in such case you can search for it and install the distribution specific one. |
| 55 |
|
| 56 |
For some packages (eg: libclc etc), you will need the full content of the packages, so make sure to also install ``-dev``/``-devel``/``-headers``/etc. packages (if available) on distributions that split the files into multiple packages. |
| 57 |
|
| 58 |
1. glslang-tools |
| 59 |
2. python3-pyyaml |
| 60 |
3. python3-mako |
| 61 |
4. libdrm (This will get libdrm for intel, amd, qualcomm, nvidia, etc. If you are building a specific driver out of these, you can install only that specific libdrm) |
| 62 |
5. libclc-<version> |
| 63 |
6. llvm-<version> |
| 64 |
7. libllvmspirvlib-<version> |
| 65 |
8. libclang-<version> |
| 66 |
9. byacc (or) bison |
| 67 |
10. flex |
| 68 |
|
| 69 |
.. note:: |
| 70 |
You should make sure that all the llvm related packages (libclc, libclc-dev, llvm, libllvmspirvlib, libclang) are of the same version. You can go with the latest version available on your OS if you are not aware of which version to select. |
| 71 |
|
| 72 |
wayland specific: |
| 73 |
|
| 74 |
1. libwayland |
| 75 |
2. libwayland-egl-backend |
| 76 |
|
| 77 |
x11 specific: |
| 78 |
|
| 79 |
1. libx11 |
| 80 |
2. libxext |
| 81 |
3. libxfixes |
| 82 |
4. libxcb-glx |
| 83 |
5. libxcb-shm |
| 84 |
6. libx11-xcb |
| 85 |
7. libxcb-dri2 |
| 86 |
8. libxcb-dri3 |
| 87 |
9. libxcb-present |
| 88 |
10. libxshmfence |
| 89 |
11. libxxf86vm |
| 90 |
12. libxrandr |
| 91 |
|
| 92 |
for intel vulkan ray-tracing: |
| 93 |
|
| 94 |
1. python3-ply |
| 95 |
|
| 96 |
radeon specific: |
| 97 |
|
| 98 |
1. libelf |
| 99 |
|
| 100 |
nouveau/rusticl specific: |
| 101 |
|
| 102 |
1. rustc |
| 103 |
2. rustfmt |
| 104 |
3. bindgen |
| 105 |
4. cbindgen |
| 106 |
|
| 107 |
Windows |
| 108 |
^^^^^^^ |
| 109 |
|
| 110 |
You will need to install Python 3 and Meson as a module using pip. This |
| 111 |
is because we use Python for generating code, and rely on external |
| 112 |
modules (Mako). You also need pkg-config (a hard dependency of Meson), |
| 113 |
Flex, and Bison. The easiest way to install everything you need is with |
| 114 |
`WinGet <https://github.com/microsoft/winget-cli>`__. |
| 115 |
|
| 116 |
.. code-block:: sh |
| 117 |
|
| 118 |
winget install python3 WinFlexBison.win_flex_bison bloodrock.pkg-config-lite |
| 119 |
|
| 120 |
You can even use WinGet to install MinGW and Ninja (Ninja can be |
| 121 |
used with MSVC as well) |
| 122 |
|
| 123 |
.. code-block:: sh |
| 124 |
|
| 125 |
winget install Ninja-build.Ninja MartinStorsjo.LLVM-MinGW.UCRT |
| 126 |
|
| 127 |
Then install Meson using pip |
| 128 |
|
| 129 |
.. code-block:: sh |
| 130 |
|
| 131 |
py -3 -m pip install meson packaging mako |
| 132 |
|
| 133 |
You may need to add the Python 3 scripts directory to your path for |
| 134 |
Meson. |
| 135 |
|
| 136 |
2. Basic Usage |
| 137 |
-------------- |
| 138 |
|
| 139 |
The Meson program is used to configure the source directory and |
| 140 |
generates either a Ninja build file or Visual Studio® build files. The |
| 141 |
latter must be enabled via the ``--backend`` switch, as Ninja is the |
| 142 |
default backend on all operating systems. |
| 143 |
|
| 144 |
Meson only supports out-of-tree builds, and must be passed a directory |
| 145 |
to put built and generated sources into. We'll call that directory |
| 146 |
"build" here. It's recommended to create a `separate build |
| 147 |
directory <https://mesonbuild.com/Using-multiple-build-directories.html>`__ |
| 148 |
for each configuration you might want to use. |
| 149 |
|
| 150 |
Basic configuration is done with: |
| 151 |
|
| 152 |
.. code-block:: sh |
| 153 |
|
| 154 |
meson setup build/ |
| 155 |
|
| 156 |
This will create the build directory. If any dependencies are missing, |
| 157 |
you can install them, or try to remove the dependency with a Meson |
| 158 |
configuration option (see below). Meson will print a summary of the |
| 159 |
build options at the end. |
| 160 |
|
| 161 |
To review the options which Meson chose, run: |
| 162 |
|
| 163 |
.. code-block:: sh |
| 164 |
|
| 165 |
meson configure build/ |
| 166 |
|
| 167 |
Recent version of Meson can print the available options and their |
| 168 |
default values by running ``meson configure`` in the source directory. |
| 169 |
If your Meson version is too old, you can always look in the |
| 170 |
`meson.options <https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/meson.options>`__ |
| 171 |
file at the root of the project. |
| 172 |
|
| 173 |
With additional arguments ``meson configure`` can be used to change |
| 174 |
options for a previously configured build directory. All options passed |
| 175 |
to this command are in the form ``-D "option"="value"``. For example: |
| 176 |
|
| 177 |
.. code-block:: sh |
| 178 |
|
| 179 |
meson configure build/ -Dprefix=/tmp/install -Dglx=true |
| 180 |
|
| 181 |
Note that options taking lists (such as ``platforms``) are `a bit more |
| 182 |
complicated <https://mesonbuild.com/Build-options.html#using-build-options>`__, |
| 183 |
but the simplest form compatible with Mesa options is to use a comma to |
| 184 |
separate values (``-D platforms=drm,wayland``) and brackets to represent |
| 185 |
an empty list (``-D platforms=[]``). |
| 186 |
|
| 187 |
Once you've run the initial ``meson`` command successfully you can use |
| 188 |
your configured backend to build the project in your build directory: |
| 189 |
|
| 190 |
.. code-block:: sh |
| 191 |
|
| 192 |
ninja -C build/ |
| 193 |
|
| 194 |
The next step is to install the Mesa libraries, drivers, etc. This also |
| 195 |
finishes up some final steps of the build process (such as creating |
| 196 |
symbolic links for drivers). To install: |
| 197 |
|
| 198 |
.. code-block:: sh |
| 199 |
|
| 200 |
ninja -C build/ install |
| 201 |
|
| 202 |
After installation, you can check if the installation happened properly or not by running the command: |
| 203 |
|
| 204 |
.. code-block:: sh |
| 205 |
|
| 206 |
glxinfo | grep OpenGL |
| 207 |
|
| 208 |
If the installation succeeded, you should see the Mesa devel version and also the commit hash of the latest commit. |
| 209 |
|
| 210 |
In case you don't see the devel version, you can run |
| 211 |
|
| 212 |
.. code-block:: sh |
| 213 |
|
| 214 |
sudo ldconfig |
| 215 |
|
| 216 |
Windows specific instructions |
| 217 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 218 |
|
| 219 |
On Windows you have a couple of choices for compilers. If you installed |
| 220 |
MinGW with winget and want to use Ninja you should be able to open |
| 221 |
any shell and follow the instructions above. If you want to you MSVC, |
| 222 |
clang-cl, or ICL (the Intel Compiler), read on. |
| 223 |
|
| 224 |
Both ICL and MSVC come with shell environments, the easiest way to use |
| 225 |
Meson with these it to open a shell. For clang-cl you will need to open |
| 226 |
an MSVC shell, and then override the compilers, either using a `native |
| 227 |
file <https://mesonbuild.com/Native-environments.html>`__, or with the |
| 228 |
CC and CXX environment variables. |
| 229 |
|
| 230 |
All of these compilers are tested and work with Ninja, but if you want |
| 231 |
Visual Studio integration or you just like msbuild, passing |
| 232 |
``--backend=vs`` to Meson will generate a Visual Studio solution. |
| 233 |
|
| 234 |
3. Advanced Usage |
| 235 |
----------------- |
| 236 |
|
| 237 |
Installation Location |
| 238 |
^^^^^^^^^^^^^^^^^^^^^ |
| 239 |
|
| 240 |
Meson default to installing :file:`libGL.so` in your system's main |
| 241 |
:file:`lib/` directory and DRI drivers to a :file:`dri/` subdirectory. |
| 242 |
|
| 243 |
Developers will often want to install Mesa to a testing directory rather |
| 244 |
than the system library directory. This can be done with the --prefix |
| 245 |
option. For example: |
| 246 |
|
| 247 |
.. code-block:: sh |
| 248 |
|
| 249 |
meson --prefix="${PWD}/build/install" build/ |
| 250 |
|
| 251 |
will put the final libraries and drivers into the build/install/ |
| 252 |
directory. Then you can set LD_LIBRARY_PATH to that location to run/test |
| 253 |
the driver. |
| 254 |
|
| 255 |
Meson also honors ``DESTDIR`` for installs. |
| 256 |
|
| 257 |
Compiler Options |
| 258 |
^^^^^^^^^^^^^^^^ |
| 259 |
|
| 260 |
Meson supports the common CFLAGS, CXXFLAGS, etc. environment variables |
| 261 |
but their use is discouraged because of the many caveats in using them. |
| 262 |
|
| 263 |
Instead, it is recommended to use ``-D${lang}_args`` and |
| 264 |
``-D${lang}_link_args``. Among the benefits of these options is that |
| 265 |
they are guaranteed to persist across rebuilds and reconfigurations. |
| 266 |
|
| 267 |
This example sets -fmax-errors for compiling C sources and -DMAGIC=123 |
| 268 |
for C++ sources: |
| 269 |
|
| 270 |
.. code-block:: sh |
| 271 |
|
| 272 |
meson setup builddir/ -Dc_args=-fmax-errors=10 -Dcpp_args=-DMAGIC=123 |
| 273 |
|
| 274 |
Compiler Specification |
| 275 |
^^^^^^^^^^^^^^^^^^^^^^ |
| 276 |
|
| 277 |
Meson supports the standard CC and CXX environment variables for |
| 278 |
changing the default compiler. Note that Meson does not allow changing |
| 279 |
the compilers in a configured build directory so you will need to create |
| 280 |
a new build dir for a different compiler. |
| 281 |
|
| 282 |
This is an example of specifying the Clang compilers and cleaning the |
| 283 |
build directory before reconfiguring with an extra C option: |
| 284 |
|
| 285 |
.. code-block:: sh |
| 286 |
|
| 287 |
CC=clang CXX=clang++ meson setup build-clang |
| 288 |
ninja -C build-clang |
| 289 |
ninja -C build-clang clean |
| 290 |
meson configure build -Dc_args="-Wno-typedef-redefinition" |
| 291 |
ninja -C build-clang |
| 292 |
|
| 293 |
The default compilers depends on your operating system. Meson supports |
| 294 |
most of the popular compilers, a complete list is available |
| 295 |
`here <https://mesonbuild.com/Reference-tables.html#compiler-ids>`__. |
| 296 |
|
| 297 |
LLVM |
| 298 |
^^^^ |
| 299 |
|
| 300 |
Meson includes upstream logic to wrap llvm-config using its standard |
| 301 |
dependency interface. |
| 302 |
|
| 303 |
Meson can use CMake to find LLVM. But due to the way LLVM implements its |
| 304 |
CMake finder it will only find static libraries, it will never find |
| 305 |
:file:`libllvm.so`. There is also a ``-Dcmake_module_path`` option, |
| 306 |
which points to the root of an alternative installation (the prefix). |
| 307 |
For example: |
| 308 |
|
| 309 |
.. code-block:: sh |
| 310 |
|
| 311 |
meson setup builddir -Dcmake_module_path=/home/user/mycmake/prefix |
| 312 |
|
| 313 |
As of Meson 0.49.0 Meson also has the concept of a `"native |
| 314 |
file" <https://mesonbuild.com/Native-environments.html>`__, these files |
| 315 |
provide information about the native build environment (as opposed to a |
| 316 |
cross build environment). They are INI formatted and can override where |
| 317 |
to find llvm-config: |
| 318 |
|
| 319 |
.. code-block:: ini |
| 320 |
:caption: custom-llvm.ini |
| 321 |
|
| 322 |
[binaries] |
| 323 |
llvm-config = '/usr/local/bin/llvm/llvm-config' |
| 324 |
|
| 325 |
Then configure Meson: |
| 326 |
|
| 327 |
.. code-block:: sh |
| 328 |
|
| 329 |
meson setup builddir/ --native-file custom-llvm.ini |
| 330 |
|
| 331 |
For selecting llvm-config for cross compiling a `"cross |
| 332 |
file" <https://mesonbuild.com/Cross-compilation.html#defining-the-environment>`__ |
| 333 |
should be used. It uses the same format as the native file above: |
| 334 |
|
| 335 |
.. code-block:: ini |
| 336 |
:caption: cross-llvm.ini |
| 337 |
|
| 338 |
[binaries] |
| 339 |
... |
| 340 |
llvm-config = '/usr/lib/llvm-config-32' |
| 341 |
cmake = '/usr/bin/cmake-for-my-arch' |
| 342 |
|
| 343 |
Obviously, only CMake or llvm-config is required. |
| 344 |
|
| 345 |
Then configure Meson: |
| 346 |
|
| 347 |
.. code-block:: sh |
| 348 |
|
| 349 |
meson setup builddir/ --cross-file cross-llvm.ini |
| 350 |
|
| 351 |
See the :ref:`Cross Compilation <cross-compilation>` section for more |
| 352 |
information. |
| 353 |
|
| 354 |
On Windows (and in other cases), using llvm-config or CMake may be |
| 355 |
either undesirable or impossible. Meson's solution for this is a |
| 356 |
`wrap <https://mesonbuild.com/Wrap-dependency-system-manual.html>`__, in |
| 357 |
this case a "binary wrap". Follow the steps below: |
| 358 |
|
| 359 |
- Install the binaries and headers into the |
| 360 |
``$mesa_src/subprojects/llvm`` |
| 361 |
- Add a :file:`meson.build` file to that directory (more on that later) |
| 362 |
|
| 363 |
The wrap file must define the following: |
| 364 |
|
| 365 |
- ``dep_llvm``: a ``declare_dependency()`` object with |
| 366 |
include_directories, dependencies, and version set) |
| 367 |
|
| 368 |
It may also define: |
| 369 |
|
| 370 |
- ``irbuilder_h``: a ``files()`` object pointing to llvm/IR/IRBuilder.h |
| 371 |
- ``has_rtti``: a ``bool`` that declares whether LLVM was built with |
| 372 |
RTTI. Defaults to true |
| 373 |
|
| 374 |
such a :file:`meson.build` file might look like: |
| 375 |
|
| 376 |
:: |
| 377 |
|
| 378 |
project('llvm', ['cpp']) |
| 379 |
|
| 380 |
cpp = meson.get_compiler('cpp') |
| 381 |
|
| 382 |
_deps = [] |
| 383 |
_search = join_paths(meson.current_source_dir(), 'lib') |
| 384 |
foreach d : ['libLLVMCodeGen', 'libLLVMScalarOpts', 'libLLVMAnalysis', |
| 385 |
'libLLVMTransformUtils', 'libLLVMCore', 'libLLVMX86CodeGen', |
| 386 |
'libLLVMSelectionDAG', 'libLLVMipo', 'libLLVMAsmPrinter', |
| 387 |
'libLLVMInstCombine', 'libLLVMInstrumentation', 'libLLVMMC', |
| 388 |
'libLLVMGlobalISel', 'libLLVMObjectYAML', 'libLLVMDebugInfoPDB', |
| 389 |
'libLLVMVectorize', 'libLLVMPasses', 'libLLVMSupport', |
| 390 |
'libLLVMLTO', 'libLLVMObject', 'libLLVMDebugInfoCodeView', |
| 391 |
'libLLVMDebugInfoDWARF', 'libLLVMOrcJIT', 'libLLVMProfileData', |
| 392 |
'libLLVMObjCARCOpts', 'libLLVMBitReader', 'libLLVMCoroutines', |
| 393 |
'libLLVMBitWriter', 'libLLVMRuntimeDyld', 'libLLVMMIRParser', |
| 394 |
'libLLVMX86Desc', 'libLLVMAsmParser', 'libLLVMTableGen', |
| 395 |
'libLLVMFuzzMutate', 'libLLVMLinker', 'libLLVMMCParser', |
| 396 |
'libLLVMExecutionEngine', 'libLLVMCoverage', 'libLLVMInterpreter', |
| 397 |
'libLLVMTarget', 'libLLVMX86AsmParser', 'libLLVMSymbolize', |
| 398 |
'libLLVMDebugInfoMSF', 'libLLVMMCJIT', 'libLLVMXRay', |
| 399 |
'libLLVMX86AsmPrinter', 'libLLVMX86Disassembler', |
| 400 |
'libLLVMMCDisassembler', 'libLLVMOption', 'libLLVMIRReader', |
| 401 |
'libLLVMLibDriver', 'libLLVMDlltoolDriver', 'libLLVMDemangle', |
| 402 |
'libLLVMBinaryFormat', 'libLLVMLineEditor', |
| 403 |
'libLLVMWindowsManifest', 'libLLVMX86Info', 'libLLVMX86Utils'] |
| 404 |
_deps += cpp.find_library(d, dirs : _search) |
| 405 |
endforeach |
| 406 |
|
| 407 |
dep_llvm = declare_dependency( |
| 408 |
include_directories : include_directories('include'), |
| 409 |
dependencies : _deps, |
| 410 |
version : '6.0.0', |
| 411 |
) |
| 412 |
|
| 413 |
has_rtti = false |
| 414 |
irbuilder_h = files('include/llvm/IR/IRBuilder.h') |
| 415 |
|
| 416 |
It is very important that version is defined and is accurate, if it is |
| 417 |
not, workarounds for the wrong version of LLVM might be used resulting |
| 418 |
in build failures. |
| 419 |
|
| 420 |
``PKG_CONFIG_PATH`` |
| 421 |
^^^^^^^^^^^^^^^^^^^ |
| 422 |
|
| 423 |
The ``pkg-config`` utility is a hard requirement for configuring and |
| 424 |
building Mesa on Unix-like systems. It is used to search for external |
| 425 |
libraries on the system. This environment variable is used to control |
| 426 |
the search path for ``pkg-config``. For instance, setting |
| 427 |
``PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig`` will search for package |
| 428 |
metadata in ``/usr/X11R6`` before the standard directories. |
| 429 |
|
| 430 |
Options |
| 431 |
^^^^^^^ |
| 432 |
|
| 433 |
One of the oddities of Meson is that some options are different when |
| 434 |
passed to :program:`meson` than to ``meson configure``. These options are |
| 435 |
passed as --option=foo to :program:`meson`, but -Doption=foo to |
| 436 |
``meson configure``. Mesa defined options are always passed as |
| 437 |
-Doption=foo. |
| 438 |
|
| 439 |
For those coming from Autotools be aware of the following: |
| 440 |
|
| 441 |
``--buildtype/-Dbuildtype`` |
| 442 |
This option will set the compiler debug/optimization levels to aid |
| 443 |
debugging the Mesa libraries. |
| 444 |
|
| 445 |
Note that in Meson this defaults to ``debugoptimized``, and not |
| 446 |
setting it to ``release`` will yield non-optimal performance and |
| 447 |
binary size. Not using ``debug`` may interfere with debugging as some |
| 448 |
code and validation will be optimized away. |
| 449 |
|
| 450 |
For those wishing to pass their own optimization flags, use the |
| 451 |
``plain`` buildtype, which causes Meson to inject no additional |
| 452 |
compiler arguments, only those in the C/CXXFLAGS and those that mesa |
| 453 |
itself defines. |
| 454 |
|
| 455 |
``-Db_ndebug`` |
| 456 |
This option controls assertions in Meson projects. When set to |
| 457 |
``false`` (the default) assertions are enabled, when set to true they |
| 458 |
are disabled. This is unrelated to the ``buildtype``; setting the |
| 459 |
latter to ``release`` will not turn off assertions. |
| 460 |
|
| 461 |
.. _cross-compilation: |
| 462 |
|
| 463 |
4. Cross-compilation and 32-bit builds |
| 464 |
-------------------------------------- |
| 465 |
|
| 466 |
`Meson supports |
| 467 |
cross-compilation <https://mesonbuild.com/Cross-compilation.html>`__ by |
| 468 |
specifying a number of binary paths and settings in a file and passing |
| 469 |
this file to ``meson`` or ``meson configure`` with the ``--cross-file`` |
| 470 |
parameter. |
| 471 |
|
| 472 |
This file can live at any location, but you can use the bare filename |
| 473 |
(without the folder path) if you put it in |
| 474 |
:file:`$XDG_DATA_HOME/meson/cross` or :file:`~/.local/share/meson/cross` |
| 475 |
|
| 476 |
Below are a few example of cross files, but keep in mind that you will |
| 477 |
likely have to alter them for your system. |
| 478 |
|
| 479 |
Those running on Arch Linux can use the AUR-maintained packages for some |
| 480 |
of those, as they'll have the right values for your system: |
| 481 |
|
| 482 |
- `meson-cross-x86-linux-gnu <https://aur.archlinux.org/packages/meson-cross-x86-linux-gnu>`__ |
| 483 |
- `meson-cross-aarch64-linux-gnu <https://github.com/dcbaker/archlinux-meson-cross-aarch64-linux-gnu>`__ |
| 484 |
|
| 485 |
Cross-compilation requires cross-compiled versions of the same build |
| 486 |
dependencies listed at the top of this page. |
| 487 |
|
| 488 |
On Debian, Ubuntu and similar, the command ``sudo apt-rdepends |
| 489 |
--build-depends --follow=DEPENDS mesa`` provides a complete and |
| 490 |
up-to-date list of all build dependencies. Append the ``:i386`` suffix |
| 491 |
(or your desired architecture) to package names and install the ones you |
| 492 |
need like this: ``sudo apt install libwayland-dev:i386 libelf-dev:i386 |
| 493 |
...`` |
| 494 |
|
| 495 |
On Fedora and similar, try ``sudo setarch i686 dnf builddep mesa``. If |
| 496 |
that fails, ``sudo dnf builddep mesa`` prints all native dependencies |
| 497 |
even when they are already installed. Replace the ``.x86_64`` suffix |
| 498 |
with ``.686`` (or your desired architecture) and install the ones you |
| 499 |
need. |
| 500 |
|
| 501 |
You do not need a cross-compiled version of the dependencies like |
| 502 |
``python3``, ``bison``, ``flex``, ``bindgen``,... that are *used only at |
| 503 |
build time*. Some unnecessary ones may even confuse your system |
| 504 |
configuration. Also, remember that some dependencies are optional |
| 505 |
depending on how you configure your ``meson setup ...`` command - this |
| 506 |
is not specific to cross-compilation; see details above. So you may want |
| 507 |
to proceed with trial-and-error and install only cross-compiled packages |
| 508 |
needed to fix build error messages. |
| 509 |
|
| 510 |
32-bit build on x86 linux: |
| 511 |
|
| 512 |
.. code-block:: ini |
| 513 |
|
| 514 |
[binaries] |
| 515 |
c = '/usr/bin/gcc' |
| 516 |
cpp = '/usr/bin/g++' |
| 517 |
# ccache is not automatically used when specifying [binaries]. |
| 518 |
# To accelerate cross-compilation as much as native compilation: |
| 519 |
# c = ['ccache', 'gcc'] |
| 520 |
# cpp = ['ccache', 'g++'] |
| 521 |
ar = '/usr/bin/gcc-ar' |
| 522 |
strip = '/usr/bin/strip' |
| 523 |
llvm-config = '/usr/bin/llvm-config32' |
| 524 |
pkg-config = '/usr/bin/pkg-config-32' |
| 525 |
# As of version 40, Fedora uses a full target platform prefix for |
| 526 |
# pkg-config instead, like the ARM and Windows examples below: |
| 527 |
# pkg-config = 'i686-redhat-linux-gnu-pkg-config' |
| 528 |
|
| 529 |
[built-in options] |
| 530 |
c_args = ['-m32'] |
| 531 |
c_link_args = ['-m32'] |
| 532 |
cpp_args = ['-m32'] |
| 533 |
cpp_link_args = ['-m32'] |
| 534 |
|
| 535 |
[host_machine] |
| 536 |
system = 'linux' |
| 537 |
cpu_family = 'x86' |
| 538 |
cpu = 'i686' |
| 539 |
endian = 'little' |
| 540 |
|
| 541 |
64-bit build on ARM linux: |
| 542 |
|
| 543 |
.. code-block:: ini |
| 544 |
|
| 545 |
[binaries] |
| 546 |
c = '/usr/bin/aarch64-linux-gnu-gcc' |
| 547 |
cpp = '/usr/bin/aarch64-linux-gnu-g++' |
| 548 |
ar = '/usr/bin/aarch64-linux-gnu-gcc-ar' |
| 549 |
strip = '/usr/bin/aarch64-linux-gnu-strip' |
| 550 |
pkg-config = '/usr/bin/aarch64-linux-gnu-pkg-config' |
| 551 |
exe_wrapper = '/usr/bin/qemu-aarch64-static' |
| 552 |
|
| 553 |
[host_machine] |
| 554 |
system = 'linux' |
| 555 |
cpu_family = 'aarch64' |
| 556 |
cpu = 'aarch64' |
| 557 |
endian = 'little' |
| 558 |
|
| 559 |
64-bit build on x86 Windows: |
| 560 |
|
| 561 |
.. code-block:: ini |
| 562 |
|
| 563 |
[binaries] |
| 564 |
c = '/usr/bin/x86_64-w64-mingw32-gcc' |
| 565 |
cpp = '/usr/bin/x86_64-w64-mingw32-g++' |
| 566 |
ar = '/usr/bin/x86_64-w64-mingw32-ar' |
| 567 |
strip = '/usr/bin/x86_64-w64-mingw32-strip' |
| 568 |
pkg-config = '/usr/bin/x86_64-w64-mingw32-pkg-config' |
| 569 |
exe_wrapper = 'wine' |
| 570 |
|
| 571 |
[host_machine] |
| 572 |
system = 'windows' |
| 573 |
cpu_family = 'x86_64' |
| 574 |
cpu = 'i686' |
| 575 |
endian = 'little' |