summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBELHADJ SALEM Talel <bhstalel@gmail.com>2023-10-20 10:41:02 +0100
committerSteve Sakoman <steve@sakoman.com>2023-10-25 04:51:01 -1000
commit6c3c62ebc171e16a45f55f276a83a32db075794e (patch)
tree9a5eb1bbb54aa0d2dcb94bb708e7e880b668f699
parent7a43e961796b0f1d4ba9f6e0f812a1dcbcf31fff (diff)
downloadpoky-6c3c62ebc171e16a45f55f276a83a32db075794e.tar.gz
ref-manual: variables: add example for SYSROOT_DIRS variable
(From yocto-docs rev: 11906c1497afb5876d8f5a9c50b4b0160ef4c8ec) Signed-off-by: Talel BELHAJSALEM <bhstalel@gmail.com> Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-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 9f3a67c64f..76dfcbf1e3 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -8294,6 +8294,35 @@ system and gives an overview of their function and contents.
8294 ${libdir}/${BPN}/ptest \ 8294 ${libdir}/${BPN}/ptest \
8295 " 8295 "
8296 8296
8297 Consider the following example in which you need to manipulate this variable.
8298 Assume you have a recipe ``A`` that provides a shared library ``.so.*`` that is
8299 installed into a custom folder other than "``${libdir}``"
8300 or "``${base_libdir}``", let's say "``/opt/lib``".
8301
8302 .. note::
8303
8304 This is not a recommended way to deal with shared libraries, but this
8305 is just to show the usefulness of setting :term:`SYSROOT_DIRS`.
8306
8307 When a recipe ``B`` :term:`DEPENDS` on ``A``, it means what is in
8308 :term:`SYSROOT_DIRS` will be copied from :term:`D` of the recipe ``B``
8309 into ``B``'s :term:`SYSROOT_DESTDIR` that is "``${WORKDIR}/sysroot-destdir``".
8310
8311 Now, since ``/opt/lib`` is not in :term:`SYSROOT_DIRS`, it will never be copied to
8312 ``A``'s :term:`RECIPE_SYSROOT`, which is "``${WORKDIR}/recipe-sysroot``". So,
8313 the linking process will fail.
8314
8315 To fix this, you need to add ``/opt/lib`` to :term:`SYSROOT_DIRS`::
8316
8317 SYSROOT_DIRS:append = " /opt/lib"
8318
8319 .. note::
8320 Even after setting ``/opt/lib`` to :term:`SYSROOT_DIRS`, the linking process will still fail
8321 because the linker does not know that location, since :term:`TARGET_LDFLAGS`
8322 doesn't contain it (if your recipe is for the target). Therefore, so you should add::
8323
8324 TARGET_LDFLAGS:append = " -L${RECIPE_SYSROOT}/opt/lib"
8325
8297 :term:`SYSROOT_DIRS_NATIVE` 8326 :term:`SYSROOT_DIRS_NATIVE`
8298 Extra directories staged into the sysroot by the 8327 Extra directories staged into the sysroot by the
8299 :ref:`ref-tasks-populate_sysroot` task for 8328 :ref:`ref-tasks-populate_sysroot` task for