Building GStreamer plugins under Ubuntu
Published on July 5, 2010
In my previous post, I described the components that comprise the Freescale GStreamer plugins for i.MX processors. In this post, I'll walk through the steps needed to actually build each of them, moving through the diagram to the right more or less from bottom to top. There are only four components, so this should be straightforward, right? I'll let you decide at the tail end.Linux-headers and prerequisites
If you're working with a Boundary Devices release as your baseline, you'll already have the build-essential
package installed, as well as a set of kernel headers installed in /usr/src/linux-headers-`uname -r`/
.If not, you'll need to install a set of i.MX kernel headers from either the L2.6.31_10.04.00_ER_SOURCE
package or the Boundary Devices Git repository. For the newbie, a kernel header package contains the include/linux/
tree of a kernel source package, configured for a particular platform, including symlinks. Given a kernel source tree and a configuration name, the process for installation usually goes something like this:
- make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- nitrogen_ubuntu_defconfig
- srcdir=/path/to/target/usr/src/`cat ./localversion`
- make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- INSTALL_HDR_PATH=$srcdir headers_install
Note the use of the localversion
file to identify the kernel's release information.imx-libOnce you've installed the kernel headers, compilation of the imx-lib package is fairly straightforward. The only caveat is that the sahara/
and rng/
sub-projects won't compile without a full kernel source installation, since they refer to headers that are not in the public include/linux
tree.
ubuntu@ubuntu:~$ tar zxvf imx-lib-10.05.02.tar.gz
ubuntu@ubuntu:~$ cd imx-lib-10.05.02
ubuntu@ubuntu:~/imx-lib-10.05.02$ rm -rf sahara2/ rng/
ubuntu@ubuntu:~/imx-lib-10.05.02$ make PLATFORM=IMX51
INCLUDE="-I/usr/src/linux-headers-`uname -r`/include"
ubuntu@ubuntu:~/imx-lib-10.05.02$ sudo make install
ubuntu@ubuntu:~/imx-lib-10.05.02$ ls -l /usr/include/vpu_*
-rw-r--r-- 1 root root 2498 2010-07-05 18:11 /usr/include/vpu_io.h
-rw-r--r-- 1 root root 13922 2010-07-05 18:11 /usr/include/vpu_lib.h
gstreamer-coreBuilding gstreamer-core
is more complicated and time-consuming because it has many more dependencies. The process is made a bit easier by the availability of a Debian package, but it still takes a while. You'll likely also want to skip some of the dependencies because they're only used to generate PDF documentation.The package used to refer to gstreamer-core
is libgstreamer0.10-0
. Running apt-get build-dep
shows the full list of packages needed:
ubuntu@ubuntu:~$ sudo apt-get build-dep libgstreamer0.10-0
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'gstreamer0.10' as source package instead of 'libgstreamer0.10-0'
The following NEW packages will be installed:
autoconf automake autotools-dev bison cdbs cvs dblatex debhelper docbook docbook-dsssl docbook-to-man docbook-utils docbook-xsl docbook-xsl-doc-html fdupes flex gettext gir-repository-dev
gir1.0-freedesktop gir1.0-glib-2.0 gnome-common gnome-pkg-tools gobject-introspection gtk-doc-tools html2text intltool intltool-debian jade jadetex lacheck latex-beamer latex-xcolor libffi-dev
libgirepository1.0-0 libgirepository1.0-dev libglib2.0-dev libglib2.0-doc libgmp3-dev libgmpxx4ldbl libgsl0-dev libltdl-dev libmail-sendmail-perl libnetpbm10 libsgmls-perl libsp1c2
libsys-hostname-long-perl libtool libxml2-dev libxml2-doc lmodern luatex m4 netpbm perl-doc pgf po-debconf preview-latex-style prosper ps2eps sgmlspl sp tex-common texlive texlive-base
texlive-bibtex-extra texlive-binaries texlive-common texlive-doc-base texlive-extra-utils texlive-font-utils texlive-fonts-recommended texlive-fonts-recommended-doc texlive-generic-recommended
texlive-latex-base texlive-latex-base-doc texlive-latex-extra texlive-latex-extra-doc texlive-latex-recommended texlive-latex-recommended-doc texlive-luatex texlive-math-extra texlive-pictures
texlive-pictures-doc texlive-pstricks texlive-pstricks-doc tipa transfig xmlto zlib1g-dev
0 upgraded, 89 newly installed, 0 to remove and 7 not upgraded.
Need to get 475MB of archives.
After this operation, 854MB of additional disk space will be used.
Do you want to continue [Y/n]? n
Abort.
854MB is a lot, but it turns out that most of this is from the dependency on texlive
to build PDF documentation. We can trim this back substantially by removing all of the *-doc
and texlive
packages:
ubuntu@ubuntu:~$ sudo apt-get build-dep autoconf automake autotools-dev bison fdupes flex gettext gir1.0-freedesktop gir1.0-glib-2.0
gobject-introspection gnome-common intltool intltool-debian libsys-hostname-long-perl libtool libxml2-dev libgirepository1.0-0
libgirepository1.0-dev libglib2.0-dev libgmp3-dev libgmpxx4ldbl libgsl0-dev libltdl-dev libmail-sendmail-perl libnetpbm10
libsgmls-perl libsp1c2 m4 netpbm perl-doc pgf po-debconf jade libffi-dev sgmlspl sp xmlto zlib1g-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'automake1.11' as source package instead of 'automake'
Picking 'gobject-introspection' as source package instead of 'gir1.0-freedesktop'
Picking 'gobject-introspection' as source package instead of 'gir1.0-glib-2.0'
Picking 'libxml2' as source package instead of 'libxml2-dev'
Picking 'gobject-introspection' as source package instead of 'libgirepository1.0-0'
Picking 'gobject-introspection' as source package instead of 'libgirepository1.0-dev'
Picking 'glib2.0' as source package instead of 'libglib2.0-dev'
Picking 'gmp' as source package instead of 'libgmp3-dev'
Picking 'gmp' as source package instead of 'libgmpxx4ldbl'
Picking 'gsl' as source package instead of 'libgsl0-dev'
Picking 'libtool' as source package instead of 'libltdl-dev'
Picking 'netpbm-free' as source package instead of 'libnetpbm10'
Picking 'jade' as source package instead of 'libsp1c2'
Picking 'netpbm-free' as source package instead of 'netpbm'
Picking 'perl' as source package instead of 'perl-doc'
Picking 'libffi' as source package instead of 'libffi-dev'
Picking 'libsgmls-perl' as source package instead of 'sgmlspl'
Picking 'jade' as source package instead of 'sp'
Picking 'zlib' as source package instead of 'zlib1g-dev'
The following NEW packages will be installed:
autoconf automake autotools-dev bison ca-certificates-java cdbs cvs debhelper default-jdk default-jre default-jre-headless dejagnu dh-buildinfo
diffstat docbook docbook-dsssl docbook-to-man docbook-xsl docbook-xsl-doc-html dpatch expect fastjar fdupes flex gettext gfortran gfortran-4.4
gnome-common gnome-pkg-tools gtk-doc-tools help2man html2text icedtea-6-jre-cacao intltool intltool-debian jade java-common libaccess-bridge-java
libaccess-bridge-java-jni libbz2-dev libcroco3-dev libdb-dev libdb4.8-dev libexpat1-dev libffi-dev libgamin-dev libgdbm-dev libgfortran3
libglib2.0-dev libice-dev libjpeg62-dev libltdl-dev libmail-sendmail-perl libncurses5-dev libpcre3-dev libpcrecpp0 libpng12-dev libpthread-stubs0
libpthread-stubs0-dev libreadline6-dev libselinux1-dev libsepol1-dev libsgmls-perl libsm-dev libsp1c2 libsys-hostname-long-perl libtiff4-dev
libtiffxx0c2 libtool libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxml2-dev libxt-dev m4 openjdk-6-jdk openjdk-6-jre openjdk-6-jre-headless
openjdk-6-jre-lib patchutils po-debconf po4a python-all python-all-dbg python-all-dev python-dbg python-dev python2.6-dbg python2.6-dev
quilt sp tcl8.5 texi2html texinfo type-handling tzdata-java x11proto-core-dev x11proto-input-dev x11proto-kb-dev xtrans-dev zlib1g-dev
0 upgraded, 102 newly installed, 0 to remove and 7 not upgraded.
Need to get 89.5MB of archives.
After this operation, 271MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 https://ports.ubuntu.com/ubuntu-ports/ lucid/main m4 1.4.13-3 [234kB]
Get:2 https://ports.ubuntu.com/ubuntu-ports/ lucid/main flex 2.5.35-9 [249kB]
...
After installing the prerequisites, you'll need to install the sources:
ubuntu@ubuntu:~$ sudo apt-get source libgstreamer0.10-0
ubuntu@ubuntu:~$ sudo chown -R ubuntu.ubuntu gstreamer0.10-0.10.28
Patching, configuring and building are fairly straightforward once you've downloaded all of the needed packages. The patches do need to be applied in the proper order:
ubuntu@ubuntu:~$ sudo apt-get source libgstreamer0.10-0
ubuntu@ubuntu:~/gstreamer0.10-0.10.28$ patch -p1
If you're using the Lucid version of Ubuntu, the patch of gst/Makefile.in
will fail, so you'll also need to fixup the _v2
patch. Since the only change is the addition of gstmfwbuffer.h
and gstmfwbuffer.c
, you can edit this quite easily by making sure there's a reference to gstmfwbuffer.x
wherever you see a reference to gstbuffer.x
.
There's probably a way to apply these patches and make a true debian package using the debian/rules
script, but I haven't figured it out yet.
Configuring and compiling is fairly easy to do, although you will see some error messages about timeouts. If we dig into this, we can see that these are actually just notices that things aren't running as fast as on a hypothetical 'known good' machine. A second make all
will skip the tests and succeed. Note that you'll need the --prefix=/usr
clause to install things in the proper spot.
ubuntu@ubuntu:~$ ./configure --prefix=/usr && make all
... error messages about timeouts
ubuntu@ubuntu:~$ make all
... clean
Installation is trivial:
ubuntu@ubuntu:~$ sudo make install
ubuntu@ubuntu:~/gstreamer0.10-0.10.28$ ls -lt /usr/include/gstreamer-0.10/
-rw-r--r-- 1 root root 4001 2010-07-05 19:38 /usr/include/gstreamer-0.10/gst/gstmfwbuffer.h
fsl-mm-codec
The fsl-mm-codec
package appears in two places. In the MMCODEC
package, there's a tarball named fsl-mm-codeclib-1.7.3.tar.gz
which contains the shared libraries, headers, and pkgconfig file but no workable makefile.
The MMCODEC_DEBIAN
package contains a couple of .deb files:
- libfsl-mm-core1_1.7.3-8_armel.deb
- libfsl-mm-core-dev_1.7.3-8_armel.deb
They have an additional dependency on udev-fsl-rules
, though. Scanning my hard drive, I find that this package can be found in the package L2.6.31_10.04.01_ER_images_MX5X
:
ubuntu@ubuntu:~$ sudo dpkg -i udev-fsl-rules_10.04.01-4_armel.deb
Selecting previously deselected package udev-fsl-rules.
(Reading database ... 157621 files and directories currently installed.)
Unpacking udev-fsl-rules (from udev-fsl-rules_10.04.01-4_armel.deb) ...
Setting up udev-fsl-rules (10.04.01) ...
Once that's installed, you can install the fsl-mm-core debian packages:
ubuntu@ubuntu:~$ sudo dpkg --install libfsl-mm-core*.deb
Also, there are some bugs in the libfsl-mm-core
packages (both tarball and debian file) that will screw up your installation. The problem stems from a set of zero-length shared library (.so) files that are included in the packages. You can fix these up like so:
ubuntu@ubuntu:~$ cd /usr/lib
ubuntu@ubuntu:/usr/lib$ sudo rm -f lib_wb_amr_enc_arm11_elinux.so
lib_nb_amr_dec_arm11_elinux.so
lib_nb_amr_enc_arm11_elinux.so
lib_wb_amr_dec_arm11_elinux.so
lib_g.723.1_dec_arm11_elinux.so
lib_jpeg_enc_arm9_elinux.so
lib_gif_dec_arm9_elinux.so
lib_g.723.1_enc_arm11_elinux.so
ubuntu@ubuntu:/usr/lib$ sudo ldconfig
gst-fsl-plugin
The GStreamer Freescale plugins are relatively easy to build and install, but they have a number of dependencies that probably haven't been installed. Using the target libgstreamer-plugins-base0.10-0
will give us the list:
ubuntu@ubuntu:~$ sudo apt-get build-dep libgstreamer-plugins-base0.10-0
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'gst-plugins-base0.10' as source package instead of 'libgstreamer-plugins-base0.10-0'
The following NEW packages will be installed:
gir-repository-dev gir1.0-freedesktop gir1.0-glib-2.0 gir1.0-gstreamer-0.10
gobject-introspection gstreamer-tools gstreamer0.10-doc libasound2-dev
libatk1.0-dev libavahi-client-dev libavahi-common-dev libavahi-glib-dev
libcairo2-dev libcdparanoia-dev libdbus-1-dev libdirectfb-dev
libdirectfb-extra libfontconfig1-dev libfreetype6-dev libgconf2-dev
libgcrypt11-dev libgirepository1.0-0 libgirepository1.0-dev libglib2.0-doc
libgnomevfs2-dev libgnutls-dev libgpg-error-dev libgstreamer0.10-dev
libgtk2.0-dev libgudev-1.0-dev libidl-dev libogg-dev liboil0.3-dev
liborbit2-dev libpango1.0-dev libpixman-1-dev libsysfs-dev libtasn1-3-dev
libtheora-dev libudev-dev libvisual-0.4-dev libvorbis-dev
libxcb-render-util0-dev libxcb-render0-dev libxcomposite-dev libxcursor-dev
libxdamage-dev libxext-dev libxfixes-dev libxft-dev libxi-dev
libxinerama-dev libxml2-doc libxrandr-dev libxrender-dev libxv-dev orbit2
x11proto-composite-dev x11proto-damage-dev x11proto-fixes-dev
x11proto-randr-dev x11proto-render-dev x11proto-video-dev x11proto-xext-dev
x11proto-xinerama-dev
0 upgraded, 65 newly installed, 0 to remove and 7 not upgraded.
Need to get 17.2MB of archives.
After this operation, 89.1MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 https://ports.ubuntu.com/ubuntu-ports/ lucid/main x11proto-xext-dev 7.1.1-2 [27.2kB]
...
ubuntu@ubuntu:~$ sudo apt-get install libgstreamer-plugins-base0.10-dev
After this, the compilation process is relatively easy:
ubuntu@ubuntu:~$ tar zxvf gst-fsl-plugin-1.7.3.tar.gz
ubuntu@ubuntu:~$ cd gst-fsl-plugin-1.7.3
ubuntu@ubuntu:~/gst-fsl-plugin-1.7.3$ ./configure --prefix=/usr PLATFORM=MX51
#
# This is where you may want to patch things up
#
ubuntu@ubuntu:~/gst-fsl-plugin-1.7.3$ make FBHEADER_PATH=/usr/src/linux-headers-`uname -r`/include all
ubuntu@ubuntu:~/gst-fsl-plugin-1.7.3$ sudo make install
ubuntu@ubuntu:~/gstreamer0.10-0.10.28$ /usr/bin/gst-inspect | grep mfw
mfw_mpg2demuxer: mfw_mpg2demuxer: Freescale MPEG demuxer
mfw_ipucsc: mfw_ipucsc: Freescale IPU Color Space Converter
mfw_audio_pp: mfw_audio_pp: Freescale Audio Post-process Filter
mfw_aacdecoder: mfw_aacdecoder: Freescale AAC Decoder Plugin
mfw_mp4demuxer: mfw_mp4demuxer: FSL MP4 Demuxer
mfw_wma8encoder: mfw_wma8encoder: freescale wma8 encoder
mfw_deinterlacer: mfw_deinterlacer: Mfw De-interlace
mfw_isink: mfw_isink: Freescale: i_sink
mfw_wma10decoder: mfw_wma10decoder: Freescale's wma10 decoder
mfw_downmixer: mfw_downmixer: Freescale Audio Down Mixer
mfw_vpudecoder: mfw_vpudecoder: Freescale: Hardware (VPU) Decoder
mfw_v4lsink: mfw_v4lsink: Freescale: V4L Sink
mfw_asfdemuxer: mfw_asfdemuxer: FSL Asf Demuxer
mfw_v4lsrc: mfw_v4lsrc: Freescale Video Source plug-in
mfw_vpuencoder: mfw_vpuencoder: Freescale: Hardware (VPU) Encoder
mfw_wmvdecoder: mfw_wmvdecoder: Freescale wmv decoder
mfw_aacplusdecoder: mfw_aacplusdecoder: Freescale AAC Decoder Plugin
mfw_mp3encoder: mfw_mp3encoder: freescale mp3 encoder
mfw_vorbisdecoder: mfw_vorbisdecoder: Freescale vorbis Decoder Plugin
mfw_avidemuxer: mfw_avidemuxer: FSL Avi Demuxer
mfw_mp3decoder: mfw_mp3decoder: freescale mp3 decoder
Summary
At the beginning of this post, I said that this would be straightforward, and for the most part it is. In the process of compiling and installing these components, we pulled in dependencies to the tune of 300MB or so. The Ubuntu packaging made much more straightforward, although we did need to work to avoid having to install 1G+ with the inclusion of texlive.
There were some quirks along the way, though. I'll summarize them here:
imx-lib
has references into the source tree for sahara/
and rng/
directories. This would be more straightforward if the headers were published in the kernel headers.
apt-get build-dep libgstreamer0.10-0
wants to pull in texlive
.
- patch
gstreamer0.10.25_gstmfwbuffer_v2.patch
doesn't apply cleanly against the Lucid release of Ubuntu.
- There are timeout errors during the
gstreamer-core
build. However, I haven't always seen these. This may have something to do with whether or not I have other processes running on the machine at build time.
fsl-mm-codeclib
Debian package has a dependency on udev-fsl-rules
that should probably be a 'recommends' reference.
fsl-mm-codeclib
'source' package has no makefile for installation.
- Both source and Debian packages for
fsl-mm-codeclib
contain zero-length shared libraries.
- The
gst-fsl-plugin
package could probably safely default to /usr/src/linux-headers-`uname -r`/include
for the FBHEADER_PATH
value and test it during the configure stage.