Skip to contentSkip to conversation

libfslcodecs libraries installation location

Buildroot Thomas Petazzoni 2 participants 5 messages Jul 12, 2015 – Jul 27, 2015

lore
Share & tools
lore
#0 lore raw

Hello Gary,

You recently updated the libfslcodecs package, and said it was working for you with the Freescale GStreamer 0.10 plugin.

However, what seems weird is that many of the libraries installed by libfslcodecs are not in /lib or /usr/lib, but in the custom /usr/lib/imx-mm/ directory:

$ find output/target/usr/lib/imx-mm/
output/target/usr/lib/imx-mm/
output/target/usr/lib/imx-mm/video-codec
output/target/usr/lib/imx-mm/video-codec/lib_jpeg_dec_arm11_elinux.so
output/target/usr/lib/imx-mm/video-codec/lib_jpeg_dec_arm9_elinux.so
output/target/usr/lib/imx-mm/video-codec/lib_H264_dec_arm11_elinux.so.2
output/target/usr/lib/imx-mm/video-codec/lib_png_dec_arm11_elinux.so.1
output/target/usr/lib/imx-mm/video-codec/lib_deinterlace_arm11_elinux.so
[...]

And the GStreamer plugins are linked against those libraries (i.e they are not loaded using dlopen) :

$ LANG=C readelf -d output/target/usr/lib/gstreamer-0.10/libmfw_gst_mp3enc.so | grep lib_mp3
 0x00000001 (NEEDED)                     Shared library: [lib_mp3_enc_arm12_elinux.so.2]

How it is possible that the glibc dynamic linker finds such libraries?

We have a very old patch at http://patchwork.ozlabs.org/patch/409684/
that was moving around the libraries installed in imx-mm to make them appear in /usr/lib rather than /usr/lib/imx-mm. The same problem was also reported in 2014 by J?r?me Pouiller:
http://buildroot-busybox.2317881.n4.nabble.com/PATCH-1-2-skeleton-ld-so-conf-include-ld-so-conf-d-conf-td81900.html.

Can you confirm that you tested that the GStreamer plugin was working ? Did you validate that the video is really decoded using the Freescale stuff and not decoded by the CPU ?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#1 lore raw

Hi Thomas,

Quoted 20 lines · Thomas Petazzoni

Hello Gary,

You recently updated the libfslcodecs package, and said it was working for you with the Freescale GStreamer 0.10 plugin.

However, what seems weird is that many of the libraries installed by libfslcodecs are not in /lib or /usr/lib, but in the custom /usr/lib/imx-mm/ directory:

$ find output/target/usr/lib/imx-mm/
output/target/usr/lib/imx-mm/
output/target/usr/lib/imx-mm/video-codec
output/target/usr/lib/imx-mm/video-codec/lib_jpeg_dec_arm11_elinux.so
output/target/usr/lib/imx-mm/video-codec/lib_jpeg_dec_arm9_elinux.so
output/target/usr/lib/imx-mm/video-codec/lib_H264_dec_arm11_elinux.so.2
output/target/usr/lib/imx-mm/video-codec/lib_png_dec_arm11_elinux.so.1
output/target/usr/lib/imx-mm/video-codec/lib_deinterlace_arm11_elinux.so
[...]
Quoted 4 lines

And the GStreamer plugins are linked against those libraries (i.e they are not loaded using dlopen) :

$ LANG=C readelf -d

output/target/usr/lib/gstreamer-0.10/libmfw_gst_mp3enc.so | grep lib_mp3

Quoted 1 line

0x00000001 (NEEDED) Shared library:

[lib_mp3_enc_arm12_elinux.so.2]

Quoted 2 lines

How it is possible that the glibc dynamic linker finds such libraries?

I remember discussions about it and I didn't get the issue at first for some reason. Then I reproduced it and used ld.so.conf to add imx-mm folder.

Quoted 5 lines

We have a very old patch at http://patchwork.ozlabs.org/patch/409684/
that was moving around the libraries installed in imx-mm to make them appear in /usr/lib rather than /usr/lib/imx-mm. The same problem was also reported in 2014 by J?r?me Pouiller:

http://buildroot-busybox.2317881.n4.nabble.com/PATCH-1-2-skeleton-ld-so-conf-include-ld-so-conf-d-conf-td81900.html
.

Quoted 4 lines

Can you confirm that you tested that the GStreamer plugin was working ? Did you validate that the video is really decoded using the Freescale stuff and not decoded by the CPU ?

Yes, I'm using the 1080p video to make sure it strikes me if not using the VPU as the CPU can't handle it well. However I hope I didn't use the ld.so.conf.
I'm on vacation for two weeks so I'll only be able to do some testing starting on the 27th.

Thanks,
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20150713/d85889ba/attachment.html>

#2 lore raw

Dear Gary Bisson,

Quoted 4 lines · Gary Bisson
Quoted 1 line

How it is possible that the glibc dynamic linker finds such libraries?

I remember discussions about it and I didn't get the issue at first for some reason. Then I reproduced it and used ld.so.conf to add imx-mm folder.

Ah, so you confirm that back then you used ld.so.conf, but not recently?

Quoted 8 lines
Quoted 5 lines

We have a very old patch at http://patchwork.ozlabs.org/patch/409684/
that was moving around the libraries installed in imx-mm to make them appear in /usr/lib rather than /usr/lib/imx-mm. The same problem was also reported in 2014 by J?r?me Pouiller:

http://buildroot-busybox.2317881.n4.nabble.com/PATCH-1-2-skeleton-ld-so-conf-include-ld-so-conf-d-conf-td81900.html
.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

Can you confirm that you tested that the GStreamer plugin was working ? Did you validate that the video is really decoded using the Freescale stuff and not decoded by the CPU ?

Yes, I'm using the 1080p video to make sure it strikes me if not using the VPU as the CPU can't handle it well. However I hope I didn't use the ld.so.conf.

But it seems that not all codecs use those libraries. Arnout was saying that maybe some codecs such as H.264 are decoded by real dedicated hardware, while some others (like the MP3 example are gave) require a firmware to be pushed to a DSP. And in this last case, a library in imx-mm would be needed.

Can you try playing a MP3 file for example?

Quoted 2 lines

I'm on vacation for two weeks so I'll only be able to do some testing starting on the 27th.

Yes, sure, no problem. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

Hi Thomas,

Quoted 10 lines · Thomas Petazzoni

Dear Gary Bisson,

Quoted 4 lines · Gary Bisson
Quoted 1 line

How it is possible that the glibc dynamic linker finds such libraries?

I remember discussions about it and I didn't get the issue at first for some reason. Then I reproduced it and used ld.so.conf to add imx-mm folder.

Ah, so you confirm that back then you used ld.so.conf, but not recently?

I just did some testing again and confirm that I didn't need it for my testing as it wasn't covering every scenario.

Quoted 16 lines
Quoted 8 lines
Quoted 5 lines

We have a very old patch at http://patchwork.ozlabs.org/patch/409684/
that was moving around the libraries installed in imx-mm to make them appear in /usr/lib rather than /usr/lib/imx-mm. The same problem was also reported in 2014 by J?r?me Pouiller:

http://buildroot-busybox.2317881.n4.nabble.com/PATCH-1-2-skeleton-ld-so-conf-include-ld-so-conf-d-conf-td81900.html
.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

Can you confirm that you tested that the GStreamer plugin was working ? Did you validate that the video is really decoded using the Freescale stuff and not decoded by the CPU ?

Yes, I'm using the 1080p video to make sure it strikes me if not using the VPU as the CPU can't handle it well. However I hope I didn't use the ld.so.conf.

Quoted 7 lines

But it seems that not all codecs use those libraries. Arnout was saying that maybe some codecs such as H.264 are decoded by real dedicated hardware, while some others (like the MP3 example are gave) require a firmware to be pushed to a DSP. And in this last case, a library in imx-mm would be needed.

Can you try playing a MP3 file for example?

Indeed, only a few (audio) plugins are using the libraries located under /usr/lib/imx-mm:

$ for i in `find target/usr/lib/gstreamer-0.10/*`; 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]
(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)

For the audio plugins above, it requires to add /usr/lib/imx-mm/audio-codec/ to LD_LIBRARY_PATH. Funny thing is that all the other libs (video-codec) do not seem to be used.

Anyway, it seems the ld.so.conf is still needed for those specific plugins:

# gst-launch audiotestsrc ! mfw_mp3encoder ! fakesink

(gst-launch-0.10:267): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libmfw_gst_mp3enc.so': li b_mp3_enc_arm12_elinux.so.2: cannot open shared object file: No such file or directory
WARNING: erroneous pipeline: no element "mfw_mp3encoder"

# export LD_LIBRARY_PATH=/usr/lib/imx-mm/audio-codec/
# gst-launch audiotestsrc ! mfw_mp3encoder ! fakesink
BLN_MAD-MMCODECS_MP3E_ARM_02.03.00_ARM12  build on Jun 17 2013 11:16:14.
MFW_GST_MP3_ENCODER_PLUGIN 4.0.2 build on Jul 26 2015 19:56:47.
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
...

I'd use Jerome approach (ld.so.conf) instead of copying the libraries to another path.

Regards,
Gary

#4 lore raw

Dear Gary Bisson,

Quoted 3 lines · Gary Bisson

For the audio plugins above, it requires to add /usr/lib/imx-mm/audio-codec/ to LD_LIBRARY_PATH. Funny thing is that all the other libs (video-codec) do not seem to be used.

Ok, thanks for testing!

Quoted 2 lines

I'd use Jerome approach (ld.so.conf) instead of copying the libraries to another path.

Unfortunately, I wanted to remove completely the ld.so.conf/ldconfig logic. Having a ldconfig that works in a cross-compilation mode to generate the ld.so.cache at build time is complicated and not supported by upstream glibc.

And ld.so.conf is not used by the dynamic linker itself as far as I understood, it's only used by ldconfig to build ld.so.cache.

So my plan was to get rid completely of ld.so.conf and the bogus call to ldconfig in the main Buildroot Makefile, and simply make sure that all libraries are either in /lib or /usr/lib.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com