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 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 |
