summaryrefslogtreecommitdiffstats
path: root/documentation/ref-manual
diff options
context:
space:
mode:
authorBELHADJ SALEM Talel <bhstalel@gmail.com>2023-10-20 10:41:02 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-20 14:40:29 +0100
commit1b04f4422ebcc58ecae4bb31e5b63543f1da19ae (patch)
tree1bf322febb6a4ca79d9b294e5f3ce359c7a67d1f /documentation/ref-manual
parent6a70a3366d68121b043c413f2e427f208edf15e3 (diff)
downloadpoky-1b04f4422ebcc58ecae4bb31e5b63543f1da19ae.tar.gz
ref-manual: variables: add example for SYSROOT_DIRS variable
(From yocto-docs rev: 65b62118da6f355e56c489c6be08ba9ea94b9f04) Signed-off-by: Talel BELHAJSALEM <bhstalel@gmail.com> Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/ref-manual')
-rw-r--r--documentation/ref-manual/variables.rst29
1 files changed, 29 insertions, 0 deletions
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 0fff292ad1..03234d3f78 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -8498,6 +8498,35 @@ system and gives an overview of their function and contents.
8498 ${libdir}/${BPN}/ptest \ 8498 ${libdir}/${BPN}/ptest \
8499 " 8499 "
8500 8500
8501 Consider the following example in which you need to manipulate this variable.
8502 Assume you have a recipe ``A`` that provides a shared library ``.so.*`` that is
8503 installed into a custom folder other than "``${libdir}``"
8504 or "``${base_libdir}``", let's say "``/opt/lib``".
8505
8506 .. note::
8507
8508 This is not a recommended way to deal with shared libraries, but this
8509 is just to show the usefulness of setting :term:`SYSROOT_DIRS`.
8510
8511 When a recipe ``B`` :term:`DEPENDS` on ``A``, it means what is in
8512 :term:`SYSROOT_DIRS` will be copied from :term:`D` of the recipe ``B``
8513 into ``B``'s :term:`SYSROOT_DESTDIR` that is "``${WORKDIR}/sysroot-destdir``".
8514
8515 Now, since ``/opt/lib`` is not in :term:`SYSROOT_DIRS`, it will never be copied to
8516 ``A``'s :term:`RECIPE_SYSROOT`, which is "``${WORKDIR}/recipe-sysroot``". So,
8517 the linking process will fail.
8518
8519 To fix this, you need to add ``/opt/lib`` to :term:`SYSROOT_DIRS`::
8520
8521 SYSROOT_DIRS:append = " /opt/lib"
8522
8523 .. note::
8524 Even after setting ``/opt/lib`` to :term:`SYSROOT_DIRS`, the linking process will still fail
8525 because the linker does not know that location, since :term:`TARGET_LDFLAGS`
8526 doesn't contain it (if your recipe is for the target). Therefore, so you should add::
8527
8528 TARGET_LDFLAGS:append = " -L${RECIPE_SYSROOT}/opt/lib"
8529
8501 :term:`SYSROOT_DIRS_NATIVE` 8530 :term:`SYSROOT_DIRS_NATIVE`
8502 Extra directories staged into the sysroot by the 8531 Extra directories staged into the sysroot by the
8503 :ref:`ref-tasks-populate_sysroot` task for 8532 :ref:`ref-tasks-populate_sysroot` task for