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.


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 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


$ PANGO_CFLAGS="-I$PREFIX/include/pango-1.0 
  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 
    -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" 
    -lsoup-2.4 -lxml2 -lglib-2.0" 

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.


  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/ when searching for /lib/
    /opt/STM/STLinux-2.3/devkit/sh4/lib/gcc/sh4-linux/4.2.4/../../../../sh4-linux/bin/ld: cannot find /lib/

    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.


  3. Sandeep


    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)?


  4. paguilar

    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.



Leave a Reply

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