设置交叉编译器的环境变量
gedit .bashrc
export PATH=$PATH:/usr/local/arm/arm-2010q1/bin
(1)编译tslib
tar -xvf tslib-1.0.tar.gz
cd tslib-1.0/
make clean
./autogen.sh
./configure --prefix=/home/nation/tslib-arm --host=arm-none-linux-gnueabi ac_cv_func_malloc_0_nonnull=yes
make
make install
export TSLIB=/home/nation/tslib-arm
echo "\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<make tslib-1.0 end>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n\n"
cd ../
(2)编译zlib(注:应该先编译,因为libpng编译时用到该库)
tar xvf zlib-1.2.5.tar.bz2
cd zlib-1.2.5/
make clean
export CC=arm-none-linux-gnueabi-gcc(//zlib的arm编译需要如此声明,而不是单纯的./configuer --host=arm-linux)
./configure -shared --prefix=/home/nation/zlib-arm
make
make install
export ZLIB=/home/nation/zlib-arm/
echo "\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<make zlib-1.2.5 end>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n\n"
cd ../
(3)编译jpeg库
tar xvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
make clean
./configure --host=arm-none-linux-gnueabi --prefix=/home/nation/libjpeg-arm --enable-shared
make
make install
export LIBJPEG=/home/nation/libjpeg-arm/
echo "\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<make jpeg-8c end>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n\n"
cd ../
(4)编译libpng
tar xvf libpng-1.2.44.tar.gz
cd libpng-1.2.44/
make clean
export ZLIB=/home/nation/zlib-arm/
export LDFLAGS="-L$ZLIB/lib"
export CPPFLAGS="-I$ZLIB/include"
./configure --host=arm-none-linux-gnueabi --prefix=/home/nation/libpng-arm ac_cv_func_malloc_0_nonnull=yes
make
make install
export LIBPNG=/home/nation/libpng-arm/
echo "\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<make libpng-1.2.46 end>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n\n"
cd ../
这里加上了ac_cv_func_malloc_0_nonnull=yes用来去掉config.h中的rp_malloc,防止在编译dfb的时候报错。
(5) 编译freetype-2.4.4
tar xvf freetype-2.4.4.tar.gz
cd freetype-2.4.4/
make clean
./configure --host=arm-none-linux-gnueabi --prefix=/home/nation/freetype-arm
make
make install
export FREETYPE=/home/nation/freetype-arm
echo "\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<make freetype-2.4.2 end>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n\n"
cd ../
unset LDFLAGS
unset CFLAGS
export LDFLAGS="$LDFLAGS -L$TSLIB/lib -L$LIBJPEG/lib -L$LIBPNG/lib -L$FREETYPE/lib -L$ZLIB/lib"
export CFLAGS="$CFLAGS -I$TSLIB/iclude -I$LIBJPEG/include -I$LIBPNG/include -I$FREETYPE/include -I$ZLIB/include"
(6)编译DirectFB-1.4.5
tar xvf DirectFB-1.4.5.tar.gz
cd DirectFB-1.4.5
make clean
./configure --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi --prefix=/home/nation/directFB-arm --with-gfxdrivers=none --with-inputdrivers=all --enable-png --enable-jpeg --enable-zlib --enable-sdl=no --enable-gif=no --enable-debug --sysconfdir=/etc --enable-fbdev --disable-x11
make
make install
export DIRECTFB=/home/nation/directFB-arm
echo "\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<make DirectFB-1.4.5 end>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n\n"
cd ../
注意:可能会有出错提示
/opt/gcc-3.4.6/bin/../lib/gcc/mipsel-linux/3.4.6/../../../../mipsel-linux/b in/ld: warning: libz.so.1, needed by /usr/directfb/lib/libpng12.so, not found (try using -rpath or -rpath-link)
/usr/directfb/lib/libpng12.so: undefined reference to `deflate'
/usr/directfb/lib/libpng12.so: undefined reference to `inflate'
/usr/directfb/lib/libpng12.so: undefined reference to `inflateInit_'
/usr/directfb/lib/libpng12.so: undefined reference to `crc32'
/usr/directfb/lib/libpng12.so: undefined reference to `deflateInit2_'
/usr/directfb/lib/libpng12.so: undefined reference to `inflateReset'
/usr/directfb/lib/libpng12.so: undefined reference to `deflateReset'
/usr/directfb/lib/libpng12.so: undefined reference to `inflateEnd'
/usr/directfb/lib/libpng12.so: undefined reference to `deflateEnd'
collect2: ld returned 1 exit status
make[2]: *** [directfb-csource] 错误 1
make[2]:正在离开目录 `/******/DirectFB-1.3.0/tools'
参考解决办法:
$cp /usr/directfb-gtk/lib/lib* /opt/gcc-3.4.6/mipsel-linux/lib/
——主要是用第五步的libpng-1.2.40所编译出来的库文件
来更新交叉编译工具链的动态库文件libpng12.so
(7)编译DirectFB-examples-1.2.0
unset LDFLAGS
unset CFLAGS
export LDFLAGS="$LDFLAGS -L$TSLIB/lib -L$LIBJPEG/lib -L$LIBPNG/lib -L$FREETYPE/lib -L$ZLIB/lib -L$DIRECTFB/lib"
export CFLAGS="$CFLAGS -I$TSLIB/iclude -I$LIBJPEG/include -I$LIBJPEG/include -I$FREETYPE/include -I$ZLIB/include -L$DIRECTFB/include"
tar xvf DirectFB-examples-1.2.0.tar
cd DirectFB-examples-1.2.0
./configure --host=arm-none-linux-gnueabi --prefix=/home/nation/directFB-example-arm
make
make install
echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<make all are end>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
(8)创建/etc/directfbrc
system=fbdev
fbdev=/dev/fd0
wm=default
mode=640x480
depth=32
pixelformat=RGB32
(9)启动参数:
export TSLIB=/home/nation/tslib-arm/
export LIBJPEG=/home/nation/libjpeg-arm/
export LIBPNG=/home/nation/libpng-arm/
export ZLIB=/home/nation/zlib-arm/
export FREETYPE=/home/nation/freetype-arm
export DIRECTFB=/home/nation/directFB-arm/
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_PLUGINDIR=$T_ROOT/lib/ts
export TSLIB_CONFFILE=$T_ROOT/etc/ts.conf
export TSLIB_CALIBFILE=/etc/pointercal
export LD_LIBRARY_PATH=$TSLIB/lib:$LIBJPEG/lib:$LIBPNG/lib:$FREETYPE/lib:$ZLIB/lib:$DIRECTFB/lib
以下为本人在移植过程中遇到的错误及其解决方法:
(1)libpng在configuer时的错误
./configure --host=arm-none-linux-gnueabi --prefix=/home/nation/libpng-arm
后产生以下错误:
configure: error: zlib not installed
解决方法:
export ZLIB=/home/nation/zlib-arm/
export LDFLAGS="-L$ZLIB/lib"
export CPPFLAGS="-I$ZLIB/include"
()2DirectFB1.3.0编译过程的错误及解决
./configure --host=arm-linux --prefix=/home/nation/directFB-arm --with-gfxdrivers=none --with-
inputdrivers=all --enable-png --enable-jpeg --enable-zlib --enable-sdl=no --enable-gif=no --enable-debug
--sysconfdir=/etc --enable-fbdev 后出错如下所示:
hecking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
解决方法:ubuntu系统中安装支持包
sudo apt-get install gcc libc6-dev
(3)出现找不到png.h时的解决方法:
将gedit interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c 中的include "png.h"改为libpng编译
安装后的路径如本人的是include "/home/nation/libpng-arm/include/png.h"
(4)编译directFB或DirectFB-examples-1.2.0时有以下类似的错误
../src/.libs/libdirectfb.so: undefined reference to `gzdopen'
../src/.libs/libdirectfb.so: undefined reference to `gzclose'
../src/.libs/libdirectfb.so: undefined reference to `gzwrite'
collect2: ld returned 1 exit status
make[2]: *** [dfbdump] Error 1
make[2]: Leaving directory `/home/dorke/work/DirectFB-1.2.9/tools'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dorke/work/DirectFB-1.2.9'
make: *** [all] Error 2
类似的错误用类似的解决办法: 加上-lm -lz
vi tools/Makefile
LDFLAGS = -L/forlinx/build/tslib/lib -L/forlinx/build/libjpeg/lib -L/forlinx/build/libpng/lib -
L/forlinx/build/freetype/lib -L/forlinx/build/zlib/lib -lm -lz
DirectFB-examples-1.2.0中./configuer时
configure: error: No package 'directfb' found
原来在移植软件包的时候,在所要用的软件包,在每个(??)的lib/pkgconfig目录下都有个*.pc文件,
在./configure就是靠这个文件进行配置的,比如:DIRECTFB/LIB/PKGCONFIG/directfb.pc,我./configure出错的原因
就是没有找到这个文件,所以说DIRECTFB没有这个包。解决办法是设置PKG_CONFIG_PATH变量,
checking for DIRECTFB... no
configure: error: No package 'directfb' found
*** DirectFB 1.2.0 or newer is required. The latest version
*** of DirectFB is available from http://www.directfb.org/.
解决方法
export PKG_CONFIG_PATH=/home/nation/directFB-arm/lib/pkgconfig
DirectFB运行例子是出错:
./df_andi
(#) DirectFBError [dfb->CreateFont( dfb, FONT, &desc, &font )]: No (suit
able) implementation found!