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
- LibPNG –> zlib
- LibJPEG
- FreeType –> bzip2
Compiling Zlib:
- Download the latest .tar from here into your “source” folder and untar it( tar -xvzf zlib-1.2.8.tar) .
- Another folder will be created within the same directory named “zlib-1.2.8”, open it.
- now run the following commands line by line.
export PREFIX="path_to_DFB_Install" ./configure --prefix=$PREFIX make make install
Compiling libPNG:
- Download the .tar from here and untar it.
- 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:
- Download .tar from here and untar it.
- Go to the bzip2-1.0.6 folder and run following commands.
make install PREFIX=$PREFIX
Compiling freetype:
- Download .tar from here and untar it.
- 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:
- Download .tar from here and untar it.
- 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
- Download DirectFB .tar from here, untar it.
- 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.