diff options
| author | Antonin Godard <antonin.godard@bootlin.com> | 2025-07-22 15:33:37 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-08-01 11:59:18 +0100 |
| commit | 649c93080f1e6db1f5c8c8436a797038a5c12c87 (patch) | |
| tree | 92e54b395060f24ca84bfaa0de6cc4fd77066830 /documentation | |
| parent | e9a49660a5bc3f42b414e4da9bfc0070dbf762d5 (diff) | |
| download | poky-649c93080f1e6db1f5c8c8436a797038a5c12c87.tar.gz | |
ref-manual: document new toolchain classes and variables
Document the new classes under classes/toolchain as well as
PREFERRED_TOOLCHAIN* and TOOLCHAIN variables, which allow selecting the
toolchain. For now there's "gcc" and "clang" as available toolchain.
(From yocto-docs rev: 69a9568f8bd7ed57efddab507a4294ad3408f4dd)
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation')
| -rw-r--r-- | documentation/ref-manual/classes.rst | 80 | ||||
| -rw-r--r-- | documentation/ref-manual/variables.rst | 78 |
2 files changed, 158 insertions, 0 deletions
diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst index 4705ca3f4d..ff41c84a73 100644 --- a/documentation/ref-manual/classes.rst +++ b/documentation/ref-manual/classes.rst | |||
| @@ -3443,6 +3443,86 @@ This class is not intended to be used directly. | |||
| 3443 | The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up | 3443 | The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up |
| 3444 | the environment for installed SDKs. | 3444 | the environment for installed SDKs. |
| 3445 | 3445 | ||
| 3446 | .. _ref-classes-toolchain-clang: | ||
| 3447 | |||
| 3448 | ``toolchain/clang`` | ||
| 3449 | =================== | ||
| 3450 | |||
| 3451 | The :ref:`ref-classes-toolchain-clang` class defines commands for building | ||
| 3452 | recipes with Clang/LLVM compiler and utilities. | ||
| 3453 | |||
| 3454 | This class is not meant to be inherited directly. Instead, you should either: | ||
| 3455 | |||
| 3456 | - set the :term:`PREFERRED_TOOLCHAIN_TARGET`, :term:`PREFERRED_TOOLCHAIN_NATIVE` | ||
| 3457 | or :term:`PREFERRED_TOOLCHAIN_SDK` variables to "clang" from a | ||
| 3458 | :term:`Configuration File`. This will make the :ref:`ref-classes-base` class | ||
| 3459 | use the :ref:`ref-classes-toolchain-clang` accordingly. All recipes will | ||
| 3460 | be built with the Clang/LLVM toolchain, exception be made for recipes that | ||
| 3461 | override the value of :term:`TOOLCHAIN` or :term:`TOOLCHAIN_NATIVE` to | ||
| 3462 | another value. | ||
| 3463 | |||
| 3464 | - set :term:`TOOLCHAIN` or :term:`TOOLCHAIN_NATIVE` to "clang" from a recipe | ||
| 3465 | when the recipe needs to override the default toolchain set by | ||
| 3466 | :term:`PREFERRED_TOOLCHAIN_TARGET`, :term:`PREFERRED_TOOLCHAIN_NATIVE` or | ||
| 3467 | :term:`PREFERRED_TOOLCHAIN_SDK`. | ||
| 3468 | |||
| 3469 | .. _ref-classes-toolchain-clang-native: | ||
| 3470 | |||
| 3471 | ``toolchain/clang-native`` | ||
| 3472 | ========================== | ||
| 3473 | |||
| 3474 | The :ref:`ref-classes-toolchain-clang-native` class defines commands for | ||
| 3475 | building :ref:`ref-classes-native` recipes with Clang/LLVM compiler and | ||
| 3476 | utilities independently of the build context. | ||
| 3477 | |||
| 3478 | The :ref:`ref-classes-toolchain-gcc-native` class defines :term:`BUILD_CC`, | ||
| 3479 | :term:`BUILD_CXX` and other such variables which are rarely used in recipes. | ||
| 3480 | Exception be made for target recipes that need to use the compiler from the | ||
| 3481 | build host at some point during the build. | ||
| 3482 | |||
| 3483 | This class should not be inherited directly. It is inherited by the | ||
| 3484 | :ref:`ref-classes-base` class if :term:`TOOLCHAIN_NATIVE` is set to "clang". | ||
| 3485 | |||
| 3486 | .. _ref-classes-toolchain-gcc: | ||
| 3487 | |||
| 3488 | ``toolchain/gcc`` | ||
| 3489 | ================= | ||
| 3490 | |||
| 3491 | The :ref:`ref-classes-toolchain-gcc` class defines commands for building | ||
| 3492 | recipes with GCC/Binutils compiler and utilities. | ||
| 3493 | |||
| 3494 | This class is not meant to be inherited directly. Instead, you should either: | ||
| 3495 | |||
| 3496 | - set the :term:`PREFERRED_TOOLCHAIN_TARGET`, :term:`PREFERRED_TOOLCHAIN_NATIVE` | ||
| 3497 | or :term:`PREFERRED_TOOLCHAIN_SDK` variables to "gcc" from a | ||
| 3498 | :term:`Configuration File`. This will make the :ref:`ref-classes-base` class | ||
| 3499 | use the :ref:`ref-classes-toolchain-gcc` accordingly. All recipes will | ||
| 3500 | be built with the GCC/Binutils toolchain, exception be made for recipes that | ||
| 3501 | override the value of :term:`TOOLCHAIN` or :term:`TOOLCHAIN_NATIVE` to | ||
| 3502 | another value. | ||
| 3503 | |||
| 3504 | - set :term:`TOOLCHAIN` or :term:`TOOLCHAIN_NATIVE` to "gcc" from a recipe | ||
| 3505 | when the recipe needs to override the default toolchain set by | ||
| 3506 | :term:`PREFERRED_TOOLCHAIN_TARGET`, :term:`PREFERRED_TOOLCHAIN_NATIVE` or | ||
| 3507 | :term:`PREFERRED_TOOLCHAIN_SDK`. | ||
| 3508 | |||
| 3509 | .. _ref-classes-toolchain-gcc-native: | ||
| 3510 | |||
| 3511 | ``toolchain/gcc-native`` | ||
| 3512 | ======================== | ||
| 3513 | |||
| 3514 | The :ref:`ref-classes-toolchain-gcc-native` class defines commands for building | ||
| 3515 | :ref:`ref-classes-native` recipes with GCC/Binutils compiler and utilities | ||
| 3516 | independently of the build context. | ||
| 3517 | |||
| 3518 | The :ref:`ref-classes-toolchain-gcc-native` class defines :term:`BUILD_CC`, | ||
| 3519 | :term:`BUILD_CXX` and other such variables which are rarely used in recipes. | ||
| 3520 | Exception be made for target recipes that need to use the compiler from the build | ||
| 3521 | host at some point during the build. | ||
| 3522 | |||
| 3523 | This class should not be inherited directly. It is inherited by the | ||
| 3524 | :ref:`ref-classes-base` class if :term:`TOOLCHAIN_NATIVE` is set to "gcc". | ||
| 3525 | |||
| 3446 | .. _ref-classes-typecheck: | 3526 | .. _ref-classes-typecheck: |
| 3447 | 3527 | ||
| 3448 | ``typecheck`` | 3528 | ``typecheck`` |
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst index 7e4f7e58ad..038e5541ef 100644 --- a/documentation/ref-manual/variables.rst +++ b/documentation/ref-manual/variables.rst | |||
| @@ -7325,6 +7325,57 @@ system and gives an overview of their function and contents. | |||
| 7325 | ":ref:`dev-manual/new-recipe:using virtual providers`" section in the | 7325 | ":ref:`dev-manual/new-recipe:using virtual providers`" section in the |
| 7326 | Yocto Project Development Tasks Manual. | 7326 | Yocto Project Development Tasks Manual. |
| 7327 | 7327 | ||
| 7328 | :term:`PREFERRED_TOOLCHAIN` | ||
| 7329 | The :term:`PREFERRED_TOOLCHAIN` variable selects the toolchain to use for | ||
| 7330 | compiling recipes. This variable is not meant to be overridden globally. | ||
| 7331 | Instead, the values of :term:`PREFERRED_TOOLCHAIN_TARGET`, | ||
| 7332 | :term:`PREFERRED_TOOLCHAIN_NATIVE` and :term:`PREFERRED_TOOLCHAIN_SDK` | ||
| 7333 | should be overridden. | ||
| 7334 | |||
| 7335 | :term:`PREFERRED_TOOLCHAIN_NATIVE` | ||
| 7336 | This variable controls the toolchain used for compiling | ||
| 7337 | :ref:`ref-classes-native` recipes. | ||
| 7338 | |||
| 7339 | This variable should be set globally from a :term:`configuration file`. | ||
| 7340 | |||
| 7341 | See :term:`PREFERRED_TOOLCHAIN_TARGET` for more details on the possible | ||
| 7342 | values for this variable. | ||
| 7343 | |||
| 7344 | A recipe that does not support the toolchain specified by | ||
| 7345 | :term:`PREFERRED_TOOLCHAIN_NATIVE` can override it locally with | ||
| 7346 | :term:`TOOLCHAIN_NATIVE`. | ||
| 7347 | |||
| 7348 | :term:`PREFERRED_TOOLCHAIN_SDK` | ||
| 7349 | This variable controls the toolchain used for compiling | ||
| 7350 | :ref:`ref-classes-nativesdk` recipes. | ||
| 7351 | |||
| 7352 | This variable should be set globally from a :term:`configuration file`. | ||
| 7353 | |||
| 7354 | See :term:`PREFERRED_TOOLCHAIN_TARGET` for more details on the possible | ||
| 7355 | values for this variable. | ||
| 7356 | |||
| 7357 | :term:`PREFERRED_TOOLCHAIN_TARGET` | ||
| 7358 | This variable controls the toolchain used for compiling recipes in the | ||
| 7359 | architecture of the target :term:`MACHINE`. | ||
| 7360 | |||
| 7361 | There are two possible values for this variable at the moment: | ||
| 7362 | |||
| 7363 | - :ref:`gcc <ref-classes-toolchain-gcc>` (default): the GCC/Binutils toolchain. | ||
| 7364 | - :ref:`clang <ref-classes-toolchain-clang>`: the Clang/LLVM toolchain. | ||
| 7365 | |||
| 7366 | :term:`PREFERRED_TOOLCHAIN_TARGET` will make the :ref:`ref-classes-base` | ||
| 7367 | class inherit one of the toolchain classes defined in | ||
| 7368 | :oe_git:`meta/classes/toolchain | ||
| 7369 | </openembedded-core/tree/meta/classes/toolchain>`. As a consequence, this | ||
| 7370 | variable should be set globally from a :term:`configuration file`. | ||
| 7371 | |||
| 7372 | These classes define commands used for cross-compiling such as :term:`CC`, | ||
| 7373 | :term:`CXX`, :term:`LD` and so on. | ||
| 7374 | |||
| 7375 | A recipe that does not support the toolchain specified by | ||
| 7376 | :term:`PREFERRED_TOOLCHAIN_TARGET` can override it locally with | ||
| 7377 | :term:`TOOLCHAIN`. | ||
| 7378 | |||
| 7328 | :term:`PREFERRED_VERSION` | 7379 | :term:`PREFERRED_VERSION` |
| 7329 | If there are multiple versions of a recipe available, this variable | 7380 | If there are multiple versions of a recipe available, this variable |
| 7330 | determines which version should be given preference. You must always | 7381 | determines which version should be given preference. You must always |
| @@ -10125,6 +10176,21 @@ system and gives an overview of their function and contents. | |||
| 10125 | implementations, NFS does not meet this minimum requirement. | 10176 | implementations, NFS does not meet this minimum requirement. |
| 10126 | Consequently, :term:`TMPDIR` cannot be on NFS. | 10177 | Consequently, :term:`TMPDIR` cannot be on NFS. |
| 10127 | 10178 | ||
| 10179 | :term:`TOOLCHAIN` | ||
| 10180 | The :term:`TOOLCHAIN` variable can be used to override the toolchain used | ||
| 10181 | by a recipe. | ||
| 10182 | |||
| 10183 | The default value for this variable is the value of | ||
| 10184 | :term:`PREFERRED_TOOLCHAIN`. See the description of | ||
| 10185 | :term:`PREFERRED_TOOLCHAIN` to know the list of possible values for | ||
| 10186 | :term:`TOOLCHAIN`. | ||
| 10187 | |||
| 10188 | It is possible to override the value of this variable from a recipe if | ||
| 10189 | this recipe is known to support only a specific toolchain. For example, | ||
| 10190 | the :oe_git:`Pseudo </openembedded-core/tree/meta/recipes-devtools/pseudo/pseudo_git.bb>` | ||
| 10191 | recipe overrides this variable to "gcc", because Pseudo uses GCC compiler | ||
| 10192 | built-ins options that the Clang/LLVM compiler does not provide. | ||
| 10193 | |||
| 10128 | :term:`TOOLCHAIN_HOST_TASK` | 10194 | :term:`TOOLCHAIN_HOST_TASK` |
| 10129 | This variable lists packages the OpenEmbedded build system uses when | 10195 | This variable lists packages the OpenEmbedded build system uses when |
| 10130 | building an SDK, which contains a cross-development environment. The | 10196 | building an SDK, which contains a cross-development environment. The |
| @@ -10180,6 +10246,18 @@ system and gives an overview of their function and contents. | |||
| 10180 | :term:`SDK_VERSION` variables for additional | 10246 | :term:`SDK_VERSION` variables for additional |
| 10181 | information. | 10247 | information. |
| 10182 | 10248 | ||
| 10249 | :term:`TOOLCHAIN_NATIVE` | ||
| 10250 | The :term:`TOOLCHAIN_NATIVE` variable can be used to override the | ||
| 10251 | toolchain used by a :ref:`ref-classes-native` recipe. | ||
| 10252 | |||
| 10253 | The default value for this variable is the value of | ||
| 10254 | :term:`PREFERRED_TOOLCHAIN` (in :ref:`ref-classes-native` contexts). See | ||
| 10255 | the description of :term:`PREFERRED_TOOLCHAIN` to know the list of | ||
| 10256 | possible values for :term:`TOOLCHAIN_NATIVE`. | ||
| 10257 | |||
| 10258 | It is possible to override the value of this variable from a recipe if | ||
| 10259 | this recipe is known to support only a specific toolchain. | ||
| 10260 | |||
| 10183 | :term:`TOOLCHAIN_TARGET_TASK` | 10261 | :term:`TOOLCHAIN_TARGET_TASK` |
| 10184 | This variable lists packages the OpenEmbedded build system uses when | 10262 | This variable lists packages the OpenEmbedded build system uses when |
| 10185 | it creates the target part of an SDK (i.e. the part built for the | 10263 | it creates the target part of an SDK (i.e. the part built for the |
