public inbox for docs@lists.yoctoproject.org
 help / color / mirror / Atom feed
From: michael.opdenacker@bootlin.com
To: docs@lists.yoctoproject.org
Cc: Michael Opdenacker <michael.opdenacker@bootlin.com>,
	Talel BELHAJSALEM <bhstalel@gmail.com>
Subject: [mickledore][PATCH 13/13] ref-manual: variables: add example for SYSROOT_DIRS variable
Date: Tue, 24 Oct 2023 15:23:18 +0200	[thread overview]
Message-ID: <20231024132318.90209-14-michael.opdenacker@bootlin.com> (raw)
In-Reply-To: <20231024132318.90209-1-michael.opdenacker@bootlin.com>

From: Michael Opdenacker <michael.opdenacker@bootlin.com>

From: BELHADJ SALEM Talel <bhstalel@gmail.com>

Signed-off-by: Talel BELHAJSALEM <bhstalel@gmail.com>
Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
---
 documentation/ref-manual/variables.rst | 29 ++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 3529b6f47c..4a0b50ed67 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.
              ${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
-- 
2.34.1



      parent reply	other threads:[~2023-10-24 13:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 13:23 [mickledore][PATCH 00/13] mickledore documentation backports michael.opdenacker
2023-10-24 13:23 ` [mickledore][PATCH 01/13] ref-manual: Warn about COMPATIBLE_MACHINE skipping native recipes michael.opdenacker
2023-10-24 13:23 ` [mickledore][PATCH 02/13] bsp-guide: bsp: skip Intel machines no longer supported in Poky michael.opdenacker
2023-10-24 13:23 ` [mickledore][PATCH 03/13] sdk-manual: appendix-obtain: improve and update descriptions michael.opdenacker
2023-10-24 13:23 ` [mickledore][PATCH 04/13] dev-manual: new-recipe.rst: add missing parenthesis to "Patching Code" section michael.opdenacker
2023-10-24 13:23 ` [mickledore][PATCH 05/13] ref-manual: Fix PACKAGECONFIG term and add an example michael.opdenacker
2023-10-24 13:23 ` [mickledore][PATCH 06/13] profile-manual: aesthetic cleanups michael.opdenacker
2023-10-24 13:23 ` [mickledore][PATCH 07/13] ref-manual: variables: provide no-match example for COMPATIBLE_MACHINE michael.opdenacker
2023-10-24 13:23 ` [mickledore][PATCH 08/13] dev-manual: layers: Add notes about layer.conf michael.opdenacker
2023-10-24 13:23 ` [mickledore][PATCH 09/13] brief-yoctoprojectqs: use new CDN mirror for sstate michael.opdenacker
2023-10-24 13:23 ` [mickledore][PATCH 10/13] dev-manual: start.rst: remove obsolete reference michael.opdenacker
2023-10-24 13:23 ` [mickledore][PATCH 11/13] ref-manual: variables: add RECIPE_SYSROOT and RECIPE_SYSROOT_NATIVE michael.opdenacker
2023-10-24 13:23 ` [mickledore][PATCH 12/13] ref-manual: variables: add TOOLCHAIN_OPTIONS variable michael.opdenacker
2023-10-24 13:23 ` michael.opdenacker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231024132318.90209-14-michael.opdenacker@bootlin.com \
    --to=michael.opdenacker@bootlin.com \
    --cc=bhstalel@gmail.com \
    --cc=docs@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox