Compiling enigma2 for the sh4 arch

By | July 21, 2008

[Update: A new post that follows-up this one clarifies why compiling enigma2 for this arch may not be sufficient for running it properly]

During the last days I’ve been asked to run enigma2 on the STb7109 cut 3.0 board, also called cocoref MB442, that is part of the sh4 arch family.

Enigma2 is a DVR application that runs on top of Linux and several of the standard Linux subsystems such as the Frame-buffer,  Linux DVB and V4L. It’s similar to applications such as MythTV, but it was designed and developed for running on embedded systems that have  limited resources compared to a Desktop PC.

I discovered that there are two different ways for doing this. The first one is through the use of a Makefile that downloads and compiles everything for you. This seems, of course, the easiest and fastest way for doing it, the only thing is that since it uses OpenEmbedded that takes a lot of time the first time for building the whole project since it downloads several GB of packages; then it compiles everything starting by generating the cross-toolchain; then it compiles all the requirements for enigma2; then it compiles enigma2 and generates a rootfs image ready for download to the target. This is a great procedure that eases your life after the first time, the big issue I had was that the enigma2 source didn’t compile, they gave me several errors.

After waiting several hours for download everything, several GB less on my hard disk and compiling errors, I decided to do it manually: the configure, make, make install way.



The first issue that I found was that enigma2 has a weird proprietary license that forbids you to modify, compile or do anything with the source code that you can download from here.

The only thing you can do is to take the version you download and derive a version  that will be licensed under the GPLv2.

That said, everything I describe in this procedure was done with a  derived version of the official enigma2 source tree.


Download the sources

The official enigma2 source code is obtained through the CVS tree. You can download a snapshot

or a certain release version:

You will end up with a directory called enigma2.

According to the license, you need to derive a version of this directory in order to do whatever you want. I derived a version and start the following procedure.



Enigma2 needs several packages in order to compile, I describe the installation of the packages I needed. Notice that enigma2 needs some other packages that I already had in my rootfs like libpng. I described the installation of some of those packages here.

  • fribidi-0.10.9
  • id3lib-3.8.3
  • libsigc++-1.2.7
  • libdvbsi++-0.3.3
  • libxslt-1.1.16
  • libxmlccwrap-0.0.12


Environment configuration

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

Set the following environment variables that will make our life easier:

Building enigma2 and its requirements



Configure, compile and install:



Configure, compile and install:



Configure, compile and install:



Configure, compile and install:



Edit the configure file:

Before the if() around line 21190:

set the following variables:

Configure, compile and install:




Edit the file xmlccwrap/Makefile

Set the var INCLUDES to the following value:

Set the var LIBS to the following value:

Edit the file testlib/Makefile

Set the var INCLUDES to the following value:

Set the var LIBS to the following value:

Compile and install:


enigma 2

Edit the configure file:

Around line 5339, before the comment

set the following values:

and substitute the var name PYTHON_CPPFLAGS by PYTHON_FLAGS inside the for() block.

Around line 5372, before the comment

set the following values:

and substitute the var name PYTHON_LDFLAGS by PYTHON_FLAGS inside the for() block.

Around line 7710, after the if() block

set the following variable:


If you don’t have the same LCD, you will have to edit the file lib/gdi/lcd.cpp
You can comment must of the code using the NO_LCD define and adding it at the
end of the var DEFS in lib/gdi/Makefile

Edit the main/Makefile:

Add at the end of the var enigma2_LDADD the following values:

Compile and install:

Now you can connect to your target and happily execute it:

That’s it.

29 thoughts on “Compiling enigma2 for the sh4 arch

  1. Ali


    If i use enigma then i dont need the gtk and qt right for GUI.As it will handle it.Can i use Enigma for VOD / DVR and all that stuff.


  2. paguilar

    Hi Ali,

    What you say is correct in theory.
    Unfortunately in practice is not that easy because enigma2 was created for a set of drivers that belong to a particular type of decoder.

    If you compile enigma2 for the sh4 it won’t run as you expect because you will have to modify the source code. I’m doing this at the moment, but I’m not sure when I’ll be avaible to make it work exactly as it works on the Dreambox.


  3. mirai

    hy,interesting blog
    Do you have tested on ipbox9000?
    we want to make enigma2 for ipbox9000 but it’s difficult.Do you have tryed?

  4. paguilar


    I haven’t tried it in the ipbox9000. I have heard that someone was able to run enigma1 on it, but I don’t have the details, sorry.

    IIRC, the ipbox9000hd is based on a STb710x that is the one that I’m using for running enigma2. However, after you compile it as I describe here, you will have to modify it for making it work properly since it tries to access char devices, proc files and the like that don’t exist on the stb710x or, if they exists, they expect different ioctl’s.
    You’ll need a bit of time and effort to make it work.


  5. Joowood

    Hi Paguilar,

    I am interested in your blog and ideas. Is there any chance to get in contact with you for sharing experience? Let me know …



  6. paguilar


    I haven’t written any contact info in this blog, nor expand the ‘about’ page because of lack of time, but I’ll do it during the following weeks.

    Meanwhile you can contact me at:
    paguilar (‘at’) junkerhq (‘dot’) net


  7. Ali

    Hi Paguilar,

    For building libxslt.You have mentioned to edit configure file .I think the line number is 21990 . Do we have to add these statements


    cas i don’t see XML_CONFIG anywhere.

  8. Ali


    I am trying to build libxslt.However i am getting error in make.

    Compiler not able to locate xmlmodule.h

    Can u please help!!!!!!!!1


  9. paguilar

    Hi Ali,

    You should have XML_CONFIG because libxslt needs libxml2. You have to change the values of these variables according to your configuration.

    Check that the version you’re using is the one I used in this post and, more important, the value of LIBXML_src must be the path of the source code of libxml2.
    This last thing could be the cause of the problem in comment #9.

    STLinux comes with a precompiled libxml2 that is the one I’m using for this post (I’m using usr/bin not usr/local/bin), but I had anyway to download and decompress libxml2 so I could set LIBXML_src to the path where I decompress it.

    Hope this helps.

  10. Ali


    I have downloaded the Engima2 source snapshot from provided cvs :

    cvs -z3 co -P enigma2

    But i don’t see a configure file in engima2 folder to make changes suggested in this blog.


  11. paguilar

    Hi Ali,

    If there is no configure file, there should be an When you run this script, it generates the configure file described in the post.

    For some reason I didn’t mention this step that is normally needed when you download a snapshop or an unstable release.


  12. Ali


    Cannot find these
    1) var name PYTHON_CPPFLAGS to be replaced by PYTHON_FLAGS inside the for() block after line 5339.

    2)var name PYTHON_LDFLAGS to be replaced by PYTHON_FLAGS inside the for() block after line 53372 .

    in enigma2 configure file.


  13. Ali


    I am getting this error while i am trying configure .Is it because of the variables that i didn’t find and did not set .As menioned in my last comment no :13 .

    Anyways this is the o/p


  14. Ali


    I am using 26 inch LCD Tv .Which one u used for testing.What
    changes do i have to make.


  15. Ali


    I have sorted out the issues mentioned in 13 and 14.I have not done any changes for lcd . I tried to compile enigma2 by “make” command got whole lot of error .

    I am working on this latest snapshot downloaded form CVS .Is it because of unstable release.Which is the stable release of engima2 that can be tried.


  16. adelide


    I am working on stable source(rel 24.) downloaded from CVS.

    I got error-messages while trying configure.

    what’s a problem?? please help me..

    [root@stlinux-adelide enigma2_rel24]# PYTHON=/usr/bin/python FREETYPE_CFLAGS=-I$PREFIX/usr/include/freetype2 FREETYPE_LIBS=”-L$PREFIX/usr/lib -lfreetype” MAD_CFLAGS=-I$PREFIX/usr/include MAD_LIBS=”-L$PREFIX/usr/lib -lmad” PNG_CFLAGS=-I$PREFIX/usr/include PNG_LIBS=”-L$PREFIX/usr/lib -lpng12″ XML2_CFLAGS=-I$PREFIX/usr/include/libxml2 XML2_LIBS=”-L$PREFIX/usr/lib -lxml2″ FRIBIDI_CFLAGS=-I$PREFIX/usr/local/include FRIBIDI_LIBS=”-L$PREFIX/usr/local/lib -lfribidi” ID3TAG_CFLAGS=-I$PREFIX/usr/local/include ID3TAG_LIBS=”-L$PREFIX/usr/local/lib -lid3″ SIGC_CFLAGS=”-I$PREFIX/usr/local/include/sigc++-1.2
    -I$PREFIX/usr/local/lib/sigc++-1.2/include” SIGC_LIBS=”-L$PREFIX/usr/local/lib -lsigc-1.2″ DVBSI_CFLAGS=-I$PREFIX/usr/local/include DVBSI_LIBS=”-L$PREFIX/usr/local/lib -ldvbsi++” XMLCCWRAP_LIBS=”-L$PREFIX/usr/local/lib -lxmlccwrap” ./configure –build=$BUILD –host=$HOST –prefix=$PREFIX/usr/local –exec_prefix=$PREFIX/usr/local –bindir=$PREFIX/usr/local/bin –sbindir=$PREFIX/usr/local/sbin –libexecdir=$PREFIX/usr/local/libexec –datadir=$PREFIX/usr/local/share –sysconfdir=$PREFIX/local/etc –sharedstatedir=$PREFIX/usr/local/com –localstatedir=$PREFIX/var –libdir=$PREFIX/usr/local/lib –includedir=$PREFIX/usr/local/include –oldincludedir=$PREFIX/usr/local/include –infodir=$PREFIX/usr/local/share/info –mandir=$PREFIX/usr/local/share/man –with-target=native –with-libsdl=no
    checking for a BSD-compatible install… /usr/bin/install -c
    checking whether build environment is sane… yes
    checking for gawk… gawk
    checking whether make sets $(MAKE)… yes
    checking for sh4-linux-strip… sh4-linux-strip
    checking for style of include used by make… GNU
    checking for sh4-linux-gcc… sh4-linux-gcc
    checking for C compiler default output file name… a.out
    checking whether the C compiler works… yes
    checking whether we are cross compiling… yes
    checking for suffix of executables…
    checking for suffix of object files… o
    checking whether we are using the GNU C compiler… yes
    checking whether sh4-linux-gcc accepts -g… yes
    checking for sh4-linux-gcc option to accept ANSI C… none needed
    checking dependency style of sh4-linux-gcc… gcc3
    checking for special C compiler options needed for large files… no
    checking for _FILE_OFFSET_BITS value needed for large files… 64
    checking for _LARGE_FILES value needed for large files… no
    checking target… native
    checking build system type… i386-pc-linux-gnu
    checking host system type… sh4-unknown-linux-gnu
    checking for sh4-linux-gcc… (cached) sh4-linux-gcc
    checking whether we are using the GNU C compiler… (cached) yes
    checking whether sh4-linux-gcc accepts -g… (cached) yes
    checking for sh4-linux-gcc option to accept ANSI C… (cached) none needed
    checking dependency style of sh4-linux-gcc… (cached) gcc3
    checking for sh4-linux-g++… sh4-linux-g++
    checking whether we are using the GNU C++ compiler… yes
    checking whether sh4-linux-g++ accepts -g… yes
    checking dependency style of sh4-linux-g++… gcc3
    checking for sh4-linux-ranlib… sh4-linux-ranlib
    checking for python version… 2.4
    checking for python platform… linux2
    checking for python script directory… ${prefix}/lib/python2.4/site-packages
    checking for python extension module directory… ${exec_prefix}/lib/python2.4/site-packages
    checking for Python include path… /opt/STM/STLinux-2.2/devkit/sh4/target/usr/include/python2.4
    checking for Python library path… /opt/STM/STLinux-2.2/devkit/sh4/target/usr/lib/python2.4/config
    checking how to run the C preprocessor… sh4-linux-gcc -E
    checking for egrep… grep -E
    checking for ANSI C header files… yes
    checking for sys/types.h… yes
    checking for sys/stat.h… yes
    checking for stdlib.h… yes
    checking for string.h… yes
    checking for memory.h… yes
    checking for strings.h… yes
    checking for inttypes.h… yes
    checking for stdint.h… yes
    checking for unistd.h… yes
    checking ost/dmx.h usability… no
    checking ost/dmx.h presence… no
    checking for ost/dmx.h… no
    checking linux/dvb/version.h usability… yes
    checking linux/dvb/version.h presence… yes
    checking for linux/dvb/version.h… yes
    configure: found dvb version 3
    checking for pkg-config… /usr/bin/pkg-config
    checking for freetype2… yes
    checking FREETYPE_CFLAGS… -I/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local/include/freetype2
    checking FREETYPE_LIBS… -L/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local/lib -lfreetype -lz
    checking for fribidi… yes
    checking FRIBIDI_CFLAGS… -I/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local/include/fribidi
    checking FRIBIDI_LIBS… -L/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local/lib -lfribidi
    checking for id3tag… yes
    checking ID3TAG_CFLAGS… -L/usr/include
    checking ID3TAG_LIBS… -lid3tag -lz
    checking for mad… yes
    checking MAD_CFLAGS…
    checking MAD_LIBS… -lmad -lm
    checking for libpng… yes
    checking PNG_CFLAGS… -I/usr/include/libpng12
    checking PNG_LIBS… -lpng12
    checking for sigc++-1.2… yes
    checking SIGC_CFLAGS… -I/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local/include/sigc++-2.0 -I/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local/lib/sigc++-2.0/include
    checking SIGC_LIBS… -L/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local/lib -lsigc-2.0
    checking for libdvbsi++… yes
    checking DVBSI_CFLAGS… -I/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local/include
    checking DVBSI_LIBS… -L/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local/lib -ldvbsi++
    checking for gstreamer… Package gstreamer was not found in the pkg-config search path.
    Perhaps you should add the directory containing gstreamer.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'gstreamer' found
    checking for jpeg_set_defaults in -ljpeg... yes
    checking for DGifOpenFileName in -lungif... yes
    checking for libxml-2.0... yes
    checking XML2_CFLAGS... -I/usr/include/libxml2
    checking XML2_LIBS... -lxml2 -lz -lm
    checking for exit in -lxmlccwrap... no
    ./configure: line 7665: syntax error near unexpected token
    ./configure: line 7665: `AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,’
    [root@stlinux-adelide enigma2_rel24]#

    Best Regards.

  17. paguilar

    Hi adelide,

    You have to comment the lines that contain AM_PATH_PROG_WITH_TEST()
    This func appears 3 times. You should do the same for all of them.

    I’ll add this missing step to the post asap.


  18. paguilar

    Hi Ali,

    Do not use version 2.x of libsigc++ as I mention. Try an older one like the 1.2.7.

    I’ll fix these asap in the post. Sorry.


  19. Ali


    I have replaced the libsigc++ and installed linbsigc++-1.2.7.and tried to compile enigma2 again .Got this new set of error.


  20. Max

    how we can made plugin for e2 on ipbox9000?
    All plugin are in python but in order to write by myself, how i acan do?
    What i need?

    Best regards,

  21. adelide

    please help me.
    what’s wrong?… T.T

    if sh4-linux-g++ -DPACKAGE_NAME=”enigma2″ -DPACKAGE_TARNAME=”enigma2″ -DPACKAGE_VERSION=”2.4″ -DPACKAGE_STRING=”enigma2 2.4″ -DPACKAGE_BUGREPORT=”” -DPACKAGE=”enigma2″ -DVERSION=”2.4″ -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DDEBUG=1 -DCONFIGDIR=”/opt/STM/STLinux-2.2/devkit/sh4/target_full/local/etc” -DDATADIR=”/opt/STM/STLinux-2.2/devkit/sh4/target_full/usr/local/share” -DLOCALEDIR=”/opt/STM/STLinux-2.2/devkit/sh4/target_full/usr/local/share/locale” -DFONTDIR=”/opt/STM/STLinux-2.2/devkit/sh4/target_full/usr/local/share/fonts” -DGAMESDIR=”/opt/STM/STLinux-2.2/devkit/sh4/target_full/var/tuxbox/games” -DLIBDIR=”/opt/STM/STLinux-2.2/devkit/sh4/target_full/usr/local/lib” -DPLUGINDIR=”/opt/STM/STLinux-2.2/devkit/sh4/target_full/usr/local/lib/tuxbox/plugins” -DTUXBOXDATADIR=”/opt/STM/STLinux-2.2/devkit/sh4/target_full/usr/local/share” -DZONEINFODIR=”/opt/STM/STLinux-2.2/devkit/sh4/target_full/usr/local/share/zoneinfo” -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LINUX_DVB_VERSION_H=1 -DHAVE_DVB=1 -DHAVE_DVB_API_VERSION=3 -DHAVE_FREETYPE2=1 -DENABLE_NLS=1 -I. -I. -I../../include -I../../src -I../.. -D_REENTRANT -I/opt/STM/STLinux-2.2/devkit/sh4/target_full/usr/include/python2.4 -I/usr/include/freetype2 -I/opt/STM/STLinux-2.2/devkit/sh4/target_full/usr/local/include/fribidi -L/usr/include -I/usr/include/libpng12 -I/opt/STM/STLinux-2.2/devkit/sh4/target_full/usr/local/lib/sigc++-1.2/include -I/opt/STM/STLinux-2.2/devkit/sh4/target_full/usr/local/include/sigc++-1.2 -I/opt/STM/STLinux-2.2/devkit/sh4/target_full/usr/local/include -g -O2 -fno-rtti -fno-exceptions -Wall -MT python.o -MD -MP -MF “.deps/python.Tpo” -c -o python.o python.cpp;
    then mv -f “.deps/python.Tpo” “.deps/python.Po”; else rm -f “.deps/python.Tpo”; exit 1; fi
    In file included from ../../lib/python/python.h:9,
    from python.cpp:11:
    ../../lib/base/object.h:173:4: warning: #warning use non optimized implementation of refcounting.
    swig -I../../ -c++ -python -O -nortti -nothreads enigma_python.i
    swig error : Unrecognized option -O
    swig error : Unrecognized option -nortti
    swig error : Unrecognized option -nothreads
    Use ‘swig -help’ for available options.
    make[3]: *** [enigma_python_wrap.cxx] Error 1
    make[2]: *** [all-recursive] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all-recursive] Error 1

    best regards.

  22. paguilar


    I’ve never had this error with swig. I would start looking at the swig doc. IIRC, the file enigma_python.i is used for telling swig which C++ funcs will be available from Python. Did you change the sources or Makefiles?
    When you solve this problem I’d appreciate if you let me know what was causing it.


  23. paguilar

    Hi Max,

    You can start by looking at some of the plugins already provided in the source.
    E.g. lib/python/Plugins/DemoPlugins/TestPlugin/

    Since it’s an interpreted language, you can test it by simply putting the source in the directory where Python expects it in the rootfs of the target (ipbox).
    E.g. usr/local/lib/enigma2/python/Plugins/DemoPlugins/


  24. lyoo

    hi paguilar
    after I run creating configure file, it’s just 4651 lines, there is no 5339 line, 5372 line and 7710 line to modify, and no for() block, I use the code tree from, could you help me?

  25. paguilar

    The configure in the TdT sources are from a different snapshot (different date/time), so the line numbering may not be the same.
    In this case you have to search directly the text string like # should allow for checking of python version here…”

    If you cannot find that string nor the line to be modified, you could configure without any modifications and check if it gives you an error. If this is the case, try to modify the line that gives you an error in the same way that this procedure describes.

    Hope this helps.

  26. lyoo

    thanks for you reply
    woo, it’s my careless, my host doesn’t install
    after install them, configure file create correctly, about 8000 lines, then I found the place said above…

    but a litter change:

    >>Around line 5339, before the comment
    >># should allow for checking of python version here…
    >>set the following values:
    >>and substitute the var name PYTHON_CPPFLAGS by >>PYTHON_FLAGS inside the for() block.


    >>Around line 5372, before the comment
    >># Check for Python library path
    >>set the following values:
    >>and substitute the var name PYTHON_LDFLAGS by >>PYTHON_FLAGS inside the for() block.


    other place should be modified

    in /enigma2/lib/base/ioprio.cpp


    #elif defined(__sh__)
    #define __NR_ioprio_set 288
    #define __NR_ioprio_get 289


    #error “Unsupported arch”

    in /enigma2/lib/dvb/frontend.cpp


    //parm_inversion |= (feparm.rolloff << 2); // Hack.. we use bit 2..3 of inversion para
    m for rolloff


    //parm_inversion |= (feparm.pilot << 4); // Hack.. we use bit 4..5 of inversio
    n param for pilot

    but still make failed:

    swig -I../../ -c++ -python -O -nortti -nothreads enigma_python.i
    /bin/bash: swig: command not found
    make[3]: *** [enigma_python_wrap.cxx] Error 127
    make[3]: Leaving directory /home/spark/e2/enigma2/lib/python'
    make[2]: *** [all-recursive] Error 1
    make[2]: Leaving directory
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/spark/e2/enigma2/lib’
    make: *** [all-recursive] Error 1

    obviously, swig package isn’t install.
    should I compile a x86 swig or cross comile a sh4 one?

  27. paguilar


    You need swig in your host for x86. It acts as the glue between C++ and Python. It generates source code that will be compiled later.


  28. adelide

    Finally, I have completed enigma2 for sh4.
    and found the answer of reply(num.22,23)
    It was very simple. just, only I was change the swig. (1.3.21 -> 1.3.39)to latest ver.



Leave a Reply

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