ref-manual: fix typo and move SYSROOT_DIRS example

1. Changed one letter (s/B/A), so the sentence is correct again.
2. Moved example from SYSROOT_DIRS_IGNORE into SYSROOT_DIRS section.

(From yocto-docs rev: 9fcd6d6ef4a87f69b8a00907051c1ece41e75a82)

Signed-off-by: Matthias Pritschet <matthias@pritschet.eu>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
Matthias Pritschet 2024-07-15 18:23:48 +02:00 committed by Steve Sakoman
parent 54d061affe
commit fbba5a616d

View File

@ -8123,6 +8123,35 @@ system and gives an overview of their function and contents.
/sysroot-only \
"
Consider the following example in which you need to manipulate this variable.
Assume you have a recipe ``A`` that provides a shared library ``.so.*`` that is
installed into a custom folder other than "``${libdir}``"
or "``${base_libdir}``", let's say "``/opt/lib``".
.. note::
This is not a recommended way to deal with shared libraries, but this
is just to show the usefulness of setting :term:`SYSROOT_DIRS`.
When a recipe ``B`` :term:`DEPENDS` on ``A``, it means what is in
:term:`SYSROOT_DIRS` will be copied from :term:`D` of the recipe ``A``
into ``B``'s :term:`SYSROOT_DESTDIR` that is "``${WORKDIR}/sysroot-destdir``".
Now, since ``/opt/lib`` is not in :term:`SYSROOT_DIRS`, it will never be copied to
``A``'s :term:`RECIPE_SYSROOT`, which is "``${WORKDIR}/recipe-sysroot``". So,
the linking process will fail.
To fix this, you need to add ``/opt/lib`` to :term:`SYSROOT_DIRS`::
SYSROOT_DIRS:append = " /opt/lib"
.. note::
Even after setting ``/opt/lib`` to :term:`SYSROOT_DIRS`, the linking process will still fail
because the linker does not know that location, since :term:`TARGET_LDFLAGS`
doesn't contain it (if your recipe is for the target). Therefore, so you should add::
TARGET_LDFLAGS:append = " -L${RECIPE_SYSROOT}/opt/lib"
:term:`SYSROOT_DIRS_IGNORE`
Directories that are not staged into the sysroot by the
:ref:`ref-tasks-populate_sysroot` task. You
@ -8146,35 +8175,6 @@ system and gives an overview of their function and contents.
${libdir}/${BPN}/ptest \
"
Consider the following example in which you need to manipulate this variable.
Assume you have a recipe ``A`` that provides a shared library ``.so.*`` that is
installed into a custom folder other than "``${libdir}``"
or "``${base_libdir}``", let's say "``/opt/lib``".
.. note::
This is not a recommended way to deal with shared libraries, but this
is just to show the usefulness of setting :term:`SYSROOT_DIRS`.
When a recipe ``B`` :term:`DEPENDS` on ``A``, it means what is in
:term:`SYSROOT_DIRS` will be copied from :term:`D` of the recipe ``B``
into ``B``'s :term:`SYSROOT_DESTDIR` that is "``${WORKDIR}/sysroot-destdir``".
Now, since ``/opt/lib`` is not in :term:`SYSROOT_DIRS`, it will never be copied to
``A``'s :term:`RECIPE_SYSROOT`, which is "``${WORKDIR}/recipe-sysroot``". So,
the linking process will fail.
To fix this, you need to add ``/opt/lib`` to :term:`SYSROOT_DIRS`::
SYSROOT_DIRS:append = " /opt/lib"
.. note::
Even after setting ``/opt/lib`` to :term:`SYSROOT_DIRS`, the linking process will still fail
because the linker does not know that location, since :term:`TARGET_LDFLAGS`
doesn't contain it (if your recipe is for the target). Therefore, so you should add::
TARGET_LDFLAGS:append = " -L${RECIPE_SYSROOT}/opt/lib"
:term:`SYSROOT_DIRS_NATIVE`
Extra directories staged into the sysroot by the
:ref:`ref-tasks-populate_sysroot` task for