Message ID | 20231016215524.3090203-1-bhstalel@gmail.com |
---|---|
State | New |
Headers | show |
Series | [1/3] ref-manual: Add example for SYSROOT_DIRS | expand |
Hi Talel Thanks for the patch! On 16.10.23 at 23:55, BELHADJ SALEM Talel wrote: > Signed-off-by: Talel BELHAJSALEM <bhstalel@gmail.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 c52271e8b..a6e550aa5 100644 > --- a/documentation/ref-manual/variables.rst > +++ b/documentation/ref-manual/variables.rst > @@ -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/ > + 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..."? > + > + .. 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`."? > + > + When a recipe ``B`` :term:`DEPENDS` on ``A`` it means what is in I'd add ", " before "it means" (easier to read) > + :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 ;-) > + the linking process will fail. I'd also add ", " before "it will" and "which is". > + > + 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/ > + 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::/ > + > + 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.
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst index c52271e8b..a6e550aa5 100644 --- a/documentation/ref-manual/variables.rst +++ b/documentation/ref-manual/variables.rst @@ -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
Signed-off-by: Talel BELHAJSALEM <bhstalel@gmail.com> --- documentation/ref-manual/variables.rst | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)