diff mbox

[v2,1/4] libfslcodec: add install hooks to fix libraries path

Message ID 1449755560-2911-2-git-send-email-gary.bisson@boundarydevices.com
State Superseded
Headers show

Commit Message

Gary Bisson Dec. 10, 2015, 1:52 p.m. UTC
By default, all the libraries are installed under /usr/lib/imx-mm which
causes problems at runtime.

The hooks are inspired from the mechanism used in the Yocto recipe:
https://github.com/Freescale/meta-fsl-arm/blob/fido/recipes-
multimedia/libfslcodec/libfslcodec.inc

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---

Here are the dependencies the pipelines above are testing:
$ for i in `find target/usr/lib/gstreamer*/*`; do readelf -d $i | grep NEEDED | grep lib_ && echo "($i)"; done
 0x00000001 (NEEDED)                     Shared library: [lib_nb_amr_dec_arm9_elinux.so.2]
 0x00000001 (NEEDED)                     Shared library: [lib_wb_amr_dec_arm9_elinux.so.2]
(target/usr/lib/gstreamer-0.10/libmfw_gst_amrdec.so)
 0x00000001 (NEEDED)                     Shared library: [lib_peq_arm11_elinux.so.1.fhw]
(target/usr/lib/gstreamer-0.10/libmfw_gst_audio_pp.so)
 0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]
(target/usr/lib/gstreamer-0.10/libmfw_gst_mp3enc.so)
 0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]
(target/usr/lib/gstreamer-1.0/libgstimxaudio.so)

Note that I added a staging install hook as well because otherwise the
gst1-imx plugin doesn't find lib_mp3_enc_arm12_elinux.so at build time.

Not to copy the same library twice I decided to go with a symlink. Let
me know if that's acceptable.

Regards,
Gary

---
 package/libfslcodec/libfslcodec.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Yann E. MORIN Dec. 13, 2015, 8:31 p.m. UTC | #1
Gary, All,

On 2015-12-10 14:52 +0100, Gary Bisson spake thusly:
> By default, all the libraries are installed under /usr/lib/imx-mm which
> causes problems at runtime.
> 
> The hooks are inspired from the mechanism used in the Yocto recipe:
> https://github.com/Freescale/meta-fsl-arm/blob/fido/recipes-
> multimedia/libfslcodec/libfslcodec.inc
> 
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> ---
> 
> Here are the dependencies the pipelines above are testing:
> $ for i in `find target/usr/lib/gstreamer*/*`; do readelf -d $i | grep NEEDED | grep lib_ && echo "($i)"; done
>  0x00000001 (NEEDED)                     Shared library: [lib_nb_amr_dec_arm9_elinux.so.2]
>  0x00000001 (NEEDED)                     Shared library: [lib_wb_amr_dec_arm9_elinux.so.2]
> (target/usr/lib/gstreamer-0.10/libmfw_gst_amrdec.so)
>  0x00000001 (NEEDED)                     Shared library: [lib_peq_arm11_elinux.so.1.fhw]
> (target/usr/lib/gstreamer-0.10/libmfw_gst_audio_pp.so)
>  0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]
> (target/usr/lib/gstreamer-0.10/libmfw_gst_mp3enc.so)
>  0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]
> (target/usr/lib/gstreamer-1.0/libgstimxaudio.so)
> 
> Note that I added a staging install hook as well because otherwise the
> gst1-imx plugin doesn't find lib_mp3_enc_arm12_elinux.so at build time.
> 
> Not to copy the same library twice I decided to go with a symlink. Let
> me know if that's acceptable.

The link you pointed to does a move, not a copy. Why do you do a symlink?

1) Where are the libraries searched for at build time? If they are
   only searched for in /usr/lib/ , then do a move. If womething is
   positively looking for them in /usr/lin/imx-mm/ , then do a symlink,
   indeed.

2) Where are libraries searched for at runtime? Same logic as for build
   time.

Regards,
Yann E. MORIN.

> Regards,
> Gary
> 
> ---
>  package/libfslcodec/libfslcodec.mk | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/package/libfslcodec/libfslcodec.mk b/package/libfslcodec/libfslcodec.mk
> index 473d662..f8c6aa8 100644
> --- a/package/libfslcodec/libfslcodec.mk
> +++ b/package/libfslcodec/libfslcodec.mk
> @@ -20,4 +20,19 @@ endef
>  # FIXME The Makefile installs both the arm9 and arm11 versions of the
>  # libraries, but we only need one of them.
>  
> +# Use symlinks in staging dir so every application can link against the libs
> +# whether they look at imx-mm or not (gst-fsl-plugins vs. gst1-imx).
> +define LIBFSLCODEC_FIXUP_STAGING_PATH
> +	find $(STAGING_DIR)/usr/lib/imx-mm -mindepth 2 -maxdepth 2 -not -type d \
> +		-exec ln -fs {} $(STAGING_DIR)/usr/lib \;
> +endef
> +LIBFSLCODEC_POST_INSTALL_STAGING_HOOKS += LIBFSLCODEC_FIXUP_STAGING_PATH
> +
> +# Use symlinks in install dir as well to match staging setup.
> +define LIBFSLCODEC_FIXUP_TARGET_PATH
> +	find $(TARGET_DIR)/usr/lib/imx-mm -mindepth 2 -maxdepth 2 -not -type d \
> +		-exec ln -fs {} $(TARGET_DIR)/usr/lib \;
> +endef
> +LIBFSLCODEC_POST_INSTALL_TARGET_HOOKS += LIBFSLCODEC_FIXUP_TARGET_PATH
> +
>  $(eval $(autotools-package))
> -- 
> 2.6.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Yann E. MORIN Dec. 13, 2015, 8:36 p.m. UTC | #2
Gary, All,

On 2015-12-10 14:52 +0100, Gary Bisson spake thusly:
> By default, all the libraries are installed under /usr/lib/imx-mm which
> causes problems at runtime.
> 
> The hooks are inspired from the mechanism used in the Yocto recipe:
> https://github.com/Freescale/meta-fsl-arm/blob/fido/recipes-
> multimedia/libfslcodec/libfslcodec.inc
> 
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> ---
> 
> Here are the dependencies the pipelines above are testing:
> $ for i in `find target/usr/lib/gstreamer*/*`; do readelf -d $i | grep NEEDED | grep lib_ && echo "($i)"; done
>  0x00000001 (NEEDED)                     Shared library: [lib_nb_amr_dec_arm9_elinux.so.2]
>  0x00000001 (NEEDED)                     Shared library: [lib_wb_amr_dec_arm9_elinux.so.2]
> (target/usr/lib/gstreamer-0.10/libmfw_gst_amrdec.so)
>  0x00000001 (NEEDED)                     Shared library: [lib_peq_arm11_elinux.so.1.fhw]
> (target/usr/lib/gstreamer-0.10/libmfw_gst_audio_pp.so)
>  0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]
> (target/usr/lib/gstreamer-0.10/libmfw_gst_mp3enc.so)
>  0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]
> (target/usr/lib/gstreamer-1.0/libgstimxaudio.so)
> 
> Note that I added a staging install hook as well because otherwise the
> gst1-imx plugin doesn't find lib_mp3_enc_arm12_elinux.so at build time.
> 
> Not to copy the same library twice I decided to go with a symlink. Let
> me know if that's acceptable.
> 
> Regards,
> Gary
> 
> ---
>  package/libfslcodec/libfslcodec.mk | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/package/libfslcodec/libfslcodec.mk b/package/libfslcodec/libfslcodec.mk
> index 473d662..f8c6aa8 100644
> --- a/package/libfslcodec/libfslcodec.mk
> +++ b/package/libfslcodec/libfslcodec.mk
> @@ -20,4 +20,19 @@ endef
>  # FIXME The Makefile installs both the arm9 and arm11 versions of the
>  # libraries, but we only need one of them.
>  
> +# Use symlinks in staging dir so every application can link against the libs
> +# whether they look at imx-mm or not (gst-fsl-plugins vs. gst1-imx).

Hmmm.. I may have overlooked that part.

So, gst-fsl-plugins looks for the libraries in /usr/lib/imx-mm/ , while
gst1-imx looks for them in /usr/lib , right?

Is it possible to make gst-fsl-plugins look in /usr/lib, too?

(or the other way around if the lookup is the other way around, of
course...)

Regards,
Yann E. MORIN.

> +define LIBFSLCODEC_FIXUP_STAGING_PATH
> +	find $(STAGING_DIR)/usr/lib/imx-mm -mindepth 2 -maxdepth 2 -not -type d \
> +		-exec ln -fs {} $(STAGING_DIR)/usr/lib \;
> +endef
> +LIBFSLCODEC_POST_INSTALL_STAGING_HOOKS += LIBFSLCODEC_FIXUP_STAGING_PATH
> +
> +# Use symlinks in install dir as well to match staging setup.

In complement to my previous reply, with insight from what you said
above: even if gst-fsl-plugins looks for in /usr/lib/imx-mm at build
time, does it still look there at runtime? If not, then just do a move.

Regards,
Yann E. MORIN.

> +define LIBFSLCODEC_FIXUP_TARGET_PATH
> +	find $(TARGET_DIR)/usr/lib/imx-mm -mindepth 2 -maxdepth 2 -not -type d \
> +		-exec ln -fs {} $(TARGET_DIR)/usr/lib \;
> +endef
> +LIBFSLCODEC_POST_INSTALL_TARGET_HOOKS += LIBFSLCODEC_FIXUP_TARGET_PATH
> +
>  $(eval $(autotools-package))
> -- 
> 2.6.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Gary Bisson Dec. 14, 2015, 9:25 p.m. UTC | #3
Yann, All,

On Sun, Dec 13, 2015 at 09:36:42PM +0100, Yann E. MORIN wrote:
> Gary, All,
> 
> On 2015-12-10 14:52 +0100, Gary Bisson spake thusly:
> > By default, all the libraries are installed under /usr/lib/imx-mm which
> > causes problems at runtime.
> > 
> > The hooks are inspired from the mechanism used in the Yocto recipe:
> > https://github.com/Freescale/meta-fsl-arm/blob/fido/recipes-
> > multimedia/libfslcodec/libfslcodec.inc
> > 
> > Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> > ---
> > 
> > Here are the dependencies the pipelines above are testing:
> > $ for i in `find target/usr/lib/gstreamer*/*`; do readelf -d $i | grep NEEDED | grep lib_ && echo "($i)"; done
> >  0x00000001 (NEEDED)                     Shared library: [lib_nb_amr_dec_arm9_elinux.so.2]
> >  0x00000001 (NEEDED)                     Shared library: [lib_wb_amr_dec_arm9_elinux.so.2]
> > (target/usr/lib/gstreamer-0.10/libmfw_gst_amrdec.so)
> >  0x00000001 (NEEDED)                     Shared library: [lib_peq_arm11_elinux.so.1.fhw]
> > (target/usr/lib/gstreamer-0.10/libmfw_gst_audio_pp.so)
> >  0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]
> > (target/usr/lib/gstreamer-0.10/libmfw_gst_mp3enc.so)
> >  0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]
> > (target/usr/lib/gstreamer-1.0/libgstimxaudio.so)
> > 
> > Note that I added a staging install hook as well because otherwise the
> > gst1-imx plugin doesn't find lib_mp3_enc_arm12_elinux.so at build time.
> > 
> > Not to copy the same library twice I decided to go with a symlink. Let
> > me know if that's acceptable.
> > 
> > Regards,
> > Gary
> > 
> > ---
> >  package/libfslcodec/libfslcodec.mk | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/package/libfslcodec/libfslcodec.mk b/package/libfslcodec/libfslcodec.mk
> > index 473d662..f8c6aa8 100644
> > --- a/package/libfslcodec/libfslcodec.mk
> > +++ b/package/libfslcodec/libfslcodec.mk
> > @@ -20,4 +20,19 @@ endef
> >  # FIXME The Makefile installs both the arm9 and arm11 versions of the
> >  # libraries, but we only need one of them.
> >  
> > +# Use symlinks in staging dir so every application can link against the libs
> > +# whether they look at imx-mm or not (gst-fsl-plugins vs. gst1-imx).
> 
> Hmmm.. I may have overlooked that part.
> 
> So, gst-fsl-plugins looks for the libraries in /usr/lib/imx-mm/ , while
> gst1-imx looks for them in /usr/lib , right?

That is correct indeed.

> Is it possible to make gst-fsl-plugins look in /usr/lib, too?

Never really looked into it but yep maybe it is just a matter of
modifying a few lines of Makefile.am. It just sounds like more troubles
doing so, maybe having to update the patch every release and so on.

> (or the other way around if the lookup is the other way around, of
> course...)

Gstreamer1-imx is way cleaner that gst-fsl-plugins, I'd like to keep it
that way. What about removing gst-fsl-plugins and gstreamer0.10? ;)

> > +define LIBFSLCODEC_FIXUP_STAGING_PATH
> > +	find $(STAGING_DIR)/usr/lib/imx-mm -mindepth 2 -maxdepth 2 -not -type d \
> > +		-exec ln -fs {} $(STAGING_DIR)/usr/lib \;
> > +endef
> > +LIBFSLCODEC_POST_INSTALL_STAGING_HOOKS += LIBFSLCODEC_FIXUP_STAGING_PATH
> > +
> > +# Use symlinks in install dir as well to match staging setup.
> 
> In complement to my previous reply, with insight from what you said
> above: even if gst-fsl-plugins looks for in /usr/lib/imx-mm at build
> time, does it still look there at runtime? If not, then just do a move.

No, that is what people have been complaining about for quite some time
now:
http://patchwork.ozlabs.org/patch/409684/

Regards,
Gary
Gary Bisson Dec. 14, 2015, 9:34 p.m. UTC | #4
Yann, All,

On Sun, Dec 13, 2015 at 9:31 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Gary, All,
>
> On 2015-12-10 14:52 +0100, Gary Bisson spake thusly:
>> By default, all the libraries are installed under /usr/lib/imx-mm which
>> causes problems at runtime.
>>
>> The hooks are inspired from the mechanism used in the Yocto recipe:
>> https://github.com/Freescale/meta-fsl-arm/blob/fido/recipes-
>> multimedia/libfslcodec/libfslcodec.inc
>>
>> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
>> ---
>>
>> Here are the dependencies the pipelines above are testing:
>> $ for i in `find target/usr/lib/gstreamer*/*`; do readelf -d $i | grep NEEDED | grep lib_ && echo "($i)"; done
>>  0x00000001 (NEEDED)                     Shared library: [lib_nb_amr_dec_arm9_elinux.so.2]
>>  0x00000001 (NEEDED)                     Shared library: [lib_wb_amr_dec_arm9_elinux.so.2]
>> (target/usr/lib/gstreamer-0.10/libmfw_gst_amrdec.so)
>>  0x00000001 (NEEDED)                     Shared library: [lib_peq_arm11_elinux.so.1.fhw]
>> (target/usr/lib/gstreamer-0.10/libmfw_gst_audio_pp.so)
>>  0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]
>> (target/usr/lib/gstreamer-0.10/libmfw_gst_mp3enc.so)
>>  0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]
>> (target/usr/lib/gstreamer-1.0/libgstimxaudio.so)
>>
>> Note that I added a staging install hook as well because otherwise the
>> gst1-imx plugin doesn't find lib_mp3_enc_arm12_elinux.so at build time.
>>
>> Not to copy the same library twice I decided to go with a symlink. Let
>> me know if that's acceptable.
>
> The link you pointed to does a move, not a copy. Why do you do a symlink?
>
> 1) Where are the libraries searched for at build time? If they are
>    only searched for in /usr/lib/ , then do a move. If womething is
>    positively looking for them in /usr/lin/imx-mm/ , then do a symlink,
>    indeed.
>
> 2) Where are libraries searched for at runtime? Same logic as for build
>    time.

Just want to add something here, my v1 was doing a symlink in staging
(because of the build time dependencies) and a move at runtime since
everything is looking at the same location in that case. But then
Jérôme said that he would prefer to have the same mechanism (symlink)
in both even though it is not necessary for the target. The reason was
to have some consistency between staging and target. What are thoughts
on that?

Regards,
Gary
Gary Bisson Jan. 24, 2016, 8:55 p.m. UTC | #5
Yann, All,

On Mon, Dec 14, 2015 at 10:25 PM, Gary Bisson
<gary.bisson@boundarydevices.com> wrote:
> Yann, All,
>
> On Sun, Dec 13, 2015 at 09:36:42PM +0100, Yann E. MORIN wrote:
>> Gary, All,
>>
>> On 2015-12-10 14:52 +0100, Gary Bisson spake thusly:
>> > By default, all the libraries are installed under /usr/lib/imx-mm which
>> > causes problems at runtime.
>> >
>> > The hooks are inspired from the mechanism used in the Yocto recipe:
>> > https://github.com/Freescale/meta-fsl-arm/blob/fido/recipes-
>> > multimedia/libfslcodec/libfslcodec.inc
>> >
>> > Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
>> > ---
>> >
>> > Here are the dependencies the pipelines above are testing:
>> > $ for i in `find target/usr/lib/gstreamer*/*`; do readelf -d $i | grep NEEDED | grep lib_ && echo "($i)"; done
>> >  0x00000001 (NEEDED)                     Shared library: [lib_nb_amr_dec_arm9_elinux.so.2]
>> >  0x00000001 (NEEDED)                     Shared library: [lib_wb_amr_dec_arm9_elinux.so.2]
>> > (target/usr/lib/gstreamer-0.10/libmfw_gst_amrdec.so)
>> >  0x00000001 (NEEDED)                     Shared library: [lib_peq_arm11_elinux.so.1.fhw]
>> > (target/usr/lib/gstreamer-0.10/libmfw_gst_audio_pp.so)
>> >  0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]
>> > (target/usr/lib/gstreamer-0.10/libmfw_gst_mp3enc.so)
>> >  0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]
>> > (target/usr/lib/gstreamer-1.0/libgstimxaudio.so)
>> >
>> > Note that I added a staging install hook as well because otherwise the
>> > gst1-imx plugin doesn't find lib_mp3_enc_arm12_elinux.so at build time.
>> >
>> > Not to copy the same library twice I decided to go with a symlink. Let
>> > me know if that's acceptable.
>> >
>> > Regards,
>> > Gary
>> >
>> > ---
>> >  package/libfslcodec/libfslcodec.mk | 15 +++++++++++++++
>> >  1 file changed, 15 insertions(+)
>> >
>> > diff --git a/package/libfslcodec/libfslcodec.mk b/package/libfslcodec/libfslcodec.mk
>> > index 473d662..f8c6aa8 100644
>> > --- a/package/libfslcodec/libfslcodec.mk
>> > +++ b/package/libfslcodec/libfslcodec.mk
>> > @@ -20,4 +20,19 @@ endef
>> >  # FIXME The Makefile installs both the arm9 and arm11 versions of the
>> >  # libraries, but we only need one of them.
>> >
>> > +# Use symlinks in staging dir so every application can link against the libs
>> > +# whether they look at imx-mm or not (gst-fsl-plugins vs. gst1-imx).
>>
>> Hmmm.. I may have overlooked that part.
>>
>> So, gst-fsl-plugins looks for the libraries in /usr/lib/imx-mm/ , while
>> gst1-imx looks for them in /usr/lib , right?
>
> That is correct indeed.
>
>> Is it possible to make gst-fsl-plugins look in /usr/lib, too?
>
> Never really looked into it but yep maybe it is just a matter of
> modifying a few lines of Makefile.am. It just sounds like more troubles
> doing so, maybe having to update the patch every release and so on.
>
>> (or the other way around if the lookup is the other way around, of
>> course...)
>
> Gstreamer1-imx is way cleaner that gst-fsl-plugins, I'd like to keep it
> that way. What about removing gst-fsl-plugins and gstreamer0.10? ;)
>
>> > +define LIBFSLCODEC_FIXUP_STAGING_PATH
>> > +   find $(STAGING_DIR)/usr/lib/imx-mm -mindepth 2 -maxdepth 2 -not -type d \
>> > +           -exec ln -fs {} $(STAGING_DIR)/usr/lib \;
>> > +endef
>> > +LIBFSLCODEC_POST_INSTALL_STAGING_HOOKS += LIBFSLCODEC_FIXUP_STAGING_PATH
>> > +
>> > +# Use symlinks in install dir as well to match staging setup.
>>
>> In complement to my previous reply, with insight from what you said
>> above: even if gst-fsl-plugins looks for in /usr/lib/imx-mm at build
>> time, does it still look there at runtime? If not, then just do a move.
>
> No, that is what people have been complaining about for quite some time
> now:
> http://patchwork.ozlabs.org/patch/409684/

Any update on this series? Would using symlink be acceptable?

Regards,
Gary
diff mbox

Patch

diff --git a/package/libfslcodec/libfslcodec.mk b/package/libfslcodec/libfslcodec.mk
index 473d662..f8c6aa8 100644
--- a/package/libfslcodec/libfslcodec.mk
+++ b/package/libfslcodec/libfslcodec.mk
@@ -20,4 +20,19 @@  endef
 # FIXME The Makefile installs both the arm9 and arm11 versions of the
 # libraries, but we only need one of them.
 
+# Use symlinks in staging dir so every application can link against the libs
+# whether they look at imx-mm or not (gst-fsl-plugins vs. gst1-imx).
+define LIBFSLCODEC_FIXUP_STAGING_PATH
+	find $(STAGING_DIR)/usr/lib/imx-mm -mindepth 2 -maxdepth 2 -not -type d \
+		-exec ln -fs {} $(STAGING_DIR)/usr/lib \;
+endef
+LIBFSLCODEC_POST_INSTALL_STAGING_HOOKS += LIBFSLCODEC_FIXUP_STAGING_PATH
+
+# Use symlinks in install dir as well to match staging setup.
+define LIBFSLCODEC_FIXUP_TARGET_PATH
+	find $(TARGET_DIR)/usr/lib/imx-mm -mindepth 2 -maxdepth 2 -not -type d \
+		-exec ln -fs {} $(TARGET_DIR)/usr/lib \;
+endef
+LIBFSLCODEC_POST_INSTALL_TARGET_HOOKS += LIBFSLCODEC_FIXUP_TARGET_PATH
+
 $(eval $(autotools-package))