Cross-compiling Swfdec over DirectFB v0.2

By | July 30, 2008

This guide describes how to cross-compile the OSS Flash player Swfdec for a SH4 processor.


Intro

Sfwdec 0.6.6 has made significant progress since version 0.5.2. Building it is almost straight forward compared to older versions in which you had to heavily tweak the Makefiles.

Since Swfdec 0.6.6 uses its GTK+ player in order to run in standalone mode, it needs GTK+ and all the libraries below it.

The procedure for compiling GTK+ is described in the post Cross-compiling GTK+ over DirectFB v0.2 .

There is a DirectFB player for Swfdec 0.5.2, but it needs to be ported to the 0.6.6 and I haven’t had time for doing it, but when we tested it several months ago, it was significant faster than the GTK+ player. If you are interested in how to compile the DirectFB player check the post  Cross-compiling swfdec over DirectFB

Additionally to the GTK+ libs, Sfwdec needs some other libs for working like libsoup.
These are the packages and their versions used for compiling Swfdec 0.6.6

I tested this procedure in a STMicroelectronics ST40 processor (SH4 architecture). If you’re using this processor, this is the configuration I have:

  • Board: STB7109 cut 3.0, also called cocoref_gold_7109
  • Linux distribution: STLinux 2.2
  • DirectFB driver: stgfb-3.0_stm23_0008-4


Environment configuration

Suppose that Swfdec and its libraries will be installed in /opt/oe/STM/STLinux-2.2/devkit/sh4/target and that the cross-toolchain (compiler, linker…) is in your path

Set the following environment variables:

$ export PREFIX=/opt/oe/STM/STLinux-2.2/devkit/sh4/target/usr/local
$ export LD_LIBRARY_PATH=$PREFIX/lib
$ export PKG_CONFIG_PATH=$LD_LIBRARY_PATH/pkgconfig
$ export COMPILER=sh4-linux-gcc
$ export HOST=sh4-linux
$ export BUILD=i386-linux


Building the requirements


liboil 0.3.15

Configure, compile and install:

$ ./configure --build=$BUILD --host=$HOST --prefix=$PREFIX
$ make
$ make install


libsoup 2.4.1

Configure, compile and install:

$ ./configure --build=$BUILD --host=$HOST --prefix=$PREFIX 
  --disable-glibtest --disable-ssl --enable-debug=no
$ make
$ make install


libmad 0.15.1b

Configure, compile and install:

$ ./configure --build=$BUILD --host=$HOST --prefix=$PREFIX 
  --disable-debugging --enable-speed
$ make
$ make install

Building Swfdec 0.6.6

Change to $PREFIX and uncompress it:

$ cd $PREFIX
$ tar xvfz swfdec-0.6.6.tar.gz

Configure:

$ PANGO_CFLAGS="-I$PREFIX/include/pango-1.0 
    -I$PREFIX/include/glib-2.0 
    -I$PREFIX/lib/glib-2.0/include" 
  PANGO_LIBS="-L$PREFIX/lib -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0" 
  GTK_CFLAGS="-D_REENTRANT -I$PREFIX/include/gtk-2.0 
    -I$PREFIX/lib/gtk-2.0/include 
    -I$PREFIX/include/cairo 
    -I$PREFIX/include/freetype2 
    -I$PREFIX/include 
    -I$PREFIX/include/libpng12 
    -I$PREFIX/../../usr/include/directfb 
    -I$PREFIX/include/atk-1.0 
    -I$PREFIX/include/pango-1.0 
    -I$PREFIX/include/glib-2.0 
    -I$PREFIX/lib/glib-2.0/include 
    -I$PREFIX/include/libsoup-2.4" 
  GTK_LIBS="-L$PREFIX/lib 
    -lgtk-directfb-2.0 -lgdk-directfb-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 
    -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -lsoup-2.4" 
  HTTP_CFLAGS="-I$PREFIX/include/libsoup-2.4 
    -I$PREFIX/include/libxml2 
    -I$PREFIX/include/glib-2.0 
    -I$PREFIX/lib/glib-2.0/include" 
  HTTP_LIBS="-L$PREFIX/lib 
    -lsoup-2.4 -lxml2 -lglib-2.0" 
  ./configure 
  --build=$BUILD 
  --host=$HOST 
  --prefix=$PREFIX 
  --disable-gstreamer 
  --enable-mad 
  --with-audio=none

Edit tools/Makefile:
Set the LIBS variable the following value:

LIBS = -ldirectfb -ldirect -lfusion -lfontconfig -lpangocairo-1.0

Compile and install:

$ make
$ make install

That’s it.

5 thoughts on “Cross-compiling Swfdec over DirectFB v0.2

  1. paguilar

    Hi adelide,

    Sorry for the late reply. I’ve been very busy at work and at home.

    I just found your email. It was discarded because of the initial characters in the ‘From’ header.

    The e2 in which I’m working is still under heavy development and quite unstable. Once it is stable it will be released because it’s licensed under the GPL.

    Regards.

    Reply
  2. Ravi

    Hi Paguilar,

    I am trying to follow the above procedure for my sh4 platform. While compiling libsoup, I got the following error:

    /opt/STM/STLinux-2.3/devkit/sh4/lib/gcc/sh4-linux/4.2.4/../../../../sh4-linux/bin/ld: skipping incompatible /lib/ld-linux.so.2 when searching for /lib/ld-linux.so.2
    /opt/STM/STLinux-2.3/devkit/sh4/lib/gcc/sh4-linux/4.2.4/../../../../sh4-linux/bin/ld: cannot find /lib/ld-linux.so.2

    I have got the same error previously when I tried to compile GTK-DFB. Somehow the compiler is looking into the system library only. I have a target filesystem (NFS) where the dependency libraries are installed. I have also set the environment variables correctly.

    I could not find a working solution anywhere else. Please help me.

    Thanks!

    Reply
  3. Sandeep

    Hi,

    Audio is not working while testing swfdec-0.6.6 over DFB on STi7109 board.What may be the reason?
    Also i would like to know whether swfdec plays youtube files(.flv)?

    Regards,
    Sandeep

    Reply
  4. paguilar

    Hi,
    Latest versions of Swfdec have YouTube support. I’m not sure if 0.6.6 already has it.
    The audio that is not working could be due to several different reasons. Eg. if you use the STAPI, you won’t have any audio because Swfdec doesn’t know how to talk to the STAPI. Instead, if you use ALSA, it could be a compilation issue because something could be missing.

    Regards.

    Reply

Leave a Reply to Ravi Cancel reply

Your email address will not be published. Required fields are marked *