diff options
| -rw-r--r-- | documentation/ref-manual/variables.rst | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst index 87081d94b9..827c94acd4 100644 --- a/documentation/ref-manual/variables.rst +++ b/documentation/ref-manual/variables.rst | |||
| @@ -7913,6 +7913,35 @@ system and gives an overview of their function and contents. | |||
| 7913 | ${libdir}/${BPN}/ptest \ | 7913 | ${libdir}/${BPN}/ptest \ |
| 7914 | " | 7914 | " |
| 7915 | 7915 | ||
| 7916 | Consider the following example in which you need to manipulate this variable. | ||
| 7917 | Assume you have a recipe ``A`` that provides a shared library ``.so.*`` that is | ||
| 7918 | installed into a custom folder other than "``${libdir}``" | ||
| 7919 | or "``${base_libdir}``", let's say "``/opt/lib``". | ||
| 7920 | |||
| 7921 | .. note:: | ||
| 7922 | |||
| 7923 | This is not a recommended way to deal with shared libraries, but this | ||
| 7924 | is just to show the usefulness of setting :term:`SYSROOT_DIRS`. | ||
| 7925 | |||
| 7926 | When a recipe ``B`` :term:`DEPENDS` on ``A``, it means what is in | ||
| 7927 | :term:`SYSROOT_DIRS` will be copied from :term:`D` of the recipe ``B`` | ||
| 7928 | into ``B``'s :term:`SYSROOT_DESTDIR` that is "``${WORKDIR}/sysroot-destdir``". | ||
| 7929 | |||
| 7930 | Now, since ``/opt/lib`` is not in :term:`SYSROOT_DIRS`, it will never be copied to | ||
| 7931 | ``A``'s :term:`RECIPE_SYSROOT`, which is "``${WORKDIR}/recipe-sysroot``". So, | ||
| 7932 | the linking process will fail. | ||
| 7933 | |||
| 7934 | To fix this, you need to add ``/opt/lib`` to :term:`SYSROOT_DIRS`:: | ||
| 7935 | |||
| 7936 | SYSROOT_DIRS:append = " /opt/lib" | ||
| 7937 | |||
| 7938 | .. note:: | ||
| 7939 | Even after setting ``/opt/lib`` to :term:`SYSROOT_DIRS`, the linking process will still fail | ||
| 7940 | because the linker does not know that location, since :term:`TARGET_LDFLAGS` | ||
| 7941 | doesn't contain it (if your recipe is for the target). Therefore, so you should add:: | ||
| 7942 | |||
| 7943 | TARGET_LDFLAGS:append = " -L${RECIPE_SYSROOT}/opt/lib" | ||
| 7944 | |||
| 7916 | :term:`SYSROOT_DIRS_NATIVE` | 7945 | :term:`SYSROOT_DIRS_NATIVE` |
| 7917 | Extra directories staged into the sysroot by the | 7946 | Extra directories staged into the sysroot by the |
| 7918 | :ref:`ref-tasks-populate_sysroot` task for | 7947 | :ref:`ref-tasks-populate_sysroot` task for |
