Cross Compiling DirectFB for ARM

 cross compiling DirectFB

DirectFB is a thin library that provides hardware graphics acceleration, input device handling and abstraction, integrated windowing system with support for translucent windows and multiple display layers, not only on top of the Linux Framebuffer Device. For Cross-compiling first what we need is a Toolchain.

Install ARM toolchain using following steps:

    • Download the toolchain from this link – ARM TOOLCHAIN
    • Extract the .tar file
      tar -xvzf cross-2.95.3.tar.bz2
      
      cd 2.95.3/

      Now set your PATH variable to access ARM cross compiler tool chain

      export PATH=/path_to_download/2.95.3/bin:$PATH

      To check if your PATH is set correctly type:

      which arm-linux-gcc

      If this path is correct your ARM cross compiler toolchain is ready to use.

To compile any library first we need to compile all its dependencies, so here is the list of dependencies of DirectFB

  1. LibPNG –> zlib
  2. LibJPEG
  3. FreeType –> bzip2
LibPNG also need zLIB as its dependency, so we start with zlib.
So before compiling create a directory where the .tar will be downloaded (say “source”) and another directory where the libraries are to be installed after cross-compiling (say “DFB_Install”)
  • Compiling Zlib:

    1. Download the latest .tar from here into your “source” folder and untar it( tar -xvzf zlib-1.2.8.tar) .
    2. Another folder will be created within the same directory named “zlib-1.2.8”, open it.
    3. now run the following commands line by line.
export PREFIX="path_to_DFB_Install"
./configure --prefix=$PREFIX
make
make install

 

  • Compiling libPNG:

    1. Download the .tar from here and untar it.
    2. Open the new folder created after untar and run following commands.
LDFLAGS=-L"/path_to_DFB_Install/lib" -lz
CPPFLAGS=-I"/path_to_DFB_install/include"
./configure --host=arm-none-linux-gnueabi --prefix=$PREFIX
make
make install

 

NOTE: If you do not provide LDFLAGS and CPPFLAGS an error will be generated (zlib headers not found) while configuring.

Now we need to compile bzip2 as a dependency for FREETYPE

  • Compiling bzip2:

    1. Download .tar from here and untar it.
    2. Go to the bzip2-1.0.6 folder and run following commands.
make install PREFIX=$PREFIX

 

  • Compiling freetype:

    1. Download .tar from here and untar it.
    2. Goto the freetype folder and run following commands.
LDFLAGS=-L"/path_to_DFB_Install/lib"
CPPFLAGS=-I"/path_to_DFB_install/include"
./configure --host=arm-none-linux-gnueabi --prefix=$PREFIX
make
make install

 

  • Compiling libJPEG:

    1. Download .tar from here and untar it.
    2. Go to jpeg folder and type the same commands.
LDFLAGS=-L"/path_to_DFB_Install/lib" -lz
CPPFLAGS=-I"/path_to_DFB_install/include"
./configure --host=arm-none-linux-gnueabi --prefix=$PREFIX
make
make install

 

 Now finally we are compiling DirectFB

    1. Download DirectFB .tar from here, untar it.
    2. Now run following commands to set path and compile DirectFB
export LDFLAGS=-L/path_to_DFB_Install/lib
export CPPFLAGS=-I"path_to_DFB_Install/include
export BZIP2_CFLAGS=-I/DirectFBInstall/include/
export BZIP2_LIBS=-L/DirectFBInstall/lib/
export LIBPNG_CFLAGS=-I/DirectFBInstall/include/
export LIBPNG_LIBS="-LDirectFBInstall/lib -lpng12"
export FREETYPE_CFLAGS="-I../DirectFBInstall/include/" "-I../DirectFBInstall/include/freetype2"
export FREETYPE_LIBS="-L../DirectFBInstall/lib" -lfreetype

./configure --enable-jpeg=yes --enable-png=yes --enable-gif=no  --enable-fbdev=yes  --enable-freetype=yes --prefix=$PREFIX --enable-devmem=yes  --enable-shared=yes  --enable-debug=yes --enable-trace=yes --enable-multicore=yes

make
make install

Just change the paths to where ever your files are. Now you have your cross compiled libraries for ARM in DFB_Install Folder.

Comment for any query.

Leave a Comment