ref-manual: Add example for SYSROOT_DIRS
PATCH 1/3 ref-manual: Add example for SYSROOT_DIRS
--- documentation/ref-manual/variables.rst | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
documentation/ref-manual/variables.rst +29 -0
@@ -8414,6 +8414,35 @@ system and gives an overview of their function and contents. /sysroot-only \ " + Consider the following example in which you need to manipulate this variable. + If you have a recipe ``A`` that provides a shared library ``.so.*`` with all + required symbolic links for it, specially the ``.so`` link, into custom folder + other than "``${libdir}``", or "``${base_libdir}``" (example: "``/opt/lib``"). + + .. note:: + + This is not recommended when working with provided shared libraries, + but this is for the goal of understanding an example for :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 fail + because the linker does not know that location since :term:`TARGET_LDFLAGS` (if your recipe + is for target) doesn't contain it, so you should add that:: + + TARGET_LDFLAGS:append = " -L${RECIPE_SYSROOT}/opt/lib" + :term:`SYSROOT_DIRS_IGNORE` Directories that are not staged into the sysroot by the :ref:`ref-tasks-populate_sysroot` task. You
Signature · 1 line
2.25.1
Hi Talel
Thanks for the patch!
Quoted 10 lines · BELHADJ SALEM Talel
Signed-off-by Talel BELHAJSALEM <[email protected]>--- documentation/ref-manual/variables.rst | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)documentation/ref-manual/variables.rst +0
-0
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 8419
Quoted 6 lines
documentation/ref-manual/variables.rst +3
-0@@ -8414,6 +8414,35 @@ system and gives an overview of their function and contents. /sysroot-only \ " + Consider the following example in which you need to manipulate this variable. + If you have a recipe ``A`` that provides a shared library ``.so.*`` with all + required symbolic links for it, specially the ``.so`` link, into custom folder
s/links for it/links to it/ ?
s/into custom folder/into a custom folder/
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 8420
Quoted 1 line
documentation/ref-manual/variables.rst +1
-0+ other than "``${libdir}``", or "``${base_libdir}``" (example: "``/opt/lib``").
Hey, that sentence is incomplete! That's like saying...
"If you have a recipe that provides a shared library."
Did you mean "Assume you have a recipe..."?
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 8425
Quoted 5 lines
documentation/ref-manual/variables.rst +5
-0+ + .. note:: + + This is not recommended when working with provided shared libraries, + but this is for the goal of understanding an example for :term:`SYSROOT_DIRS`.
I would rephrase this a little... What about
"This is not a recommended way to deal with shared libraries, but this is just to show the usefulness of setting :term:SYSROOT_DIR."?
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 8427
Quoted 2 lines
documentation/ref-manual/variables.rst +2
-0+ + When a recipe ``B`` :term:`DEPENDS` on ``A`` it means what is in
I'd add ", " before "it means" (easier to read)
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 8432
Quoted 5 lines
documentation/ref-manual/variables.rst +5
-0+ :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,
Hey, your patches are out of order here ;-)
I need to apply your second patch first to get the first one to compile.
So the patch defining :term:RECIPE_SYSROOT should come first ;-)
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 8433
Quoted 1 line
documentation/ref-manual/variables.rst +1
-0+ the linking process will fail.
I'd also add ", " before "it will" and "which is".
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 8440
Quoted 7 lines
documentation/ref-manual/variables.rst +7
-0+ + 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 fail
s/will fail/will still fail/
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 8442
Quoted 2 lines
documentation/ref-manual/variables.rst +2
-0+ because the linker does not know that location since :term:`TARGET_LDFLAGS` (if your recipe + is for target) doesn't contain it, so you should add that::
s/for target/for the target/
s/, so you should add that::/. Therefore, you should add::/
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 8445
Quoted 3 lines
documentation/ref-manual/variables.rst +3
-0+ + TARGET_LDFLAGS:append = " -L${RECIPE_SYSROOT}/opt/lib" +
Thanks in advance for a V2 ;-)
These are mostly style issues, and documenting this is much appreciated :)
Cheers
Michael.
Signature · 3 lines
Michael Opdenacker, Bootlin Embedded Linux and Kernel engineering https://bootlin.com