diff options
Diffstat (limited to 'documentation')
| -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 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 |
