1. 准备
本人采用的版本是DirectFB-1.5.3.tar.gz
2. 安装
1. 安装PNG、JPEG、FreeType2 support
#apt-get install libpng-devel
#apt-get install libjpeg-devel
#apt-get install freetype-devel
1. 解压
tar -xvf DirectFB-1.2.8.tar.gz
tar -xvf DirectFB-examples-1.2.0.tar.gz
2. 编译DFB
#cd DirectFB-1.5.3
#./configure
#make
#make instal
注:DFB(./configure)的提示:
PNG support is missing - many applications won't work correctly!
JPEG support is missing - many applications won't work correctly!
FreeType2 support is missing - many applications won't work correctly!
解决的方法可以参考:
(1)输入命令:
apt-cache search libpng
apt-cache search libjpeg
apt-cache search libfreetype
或 aptitude search libfreetype
(2) 根据提示安装
3. 配置环境变量
如果不更新环境变量,可能无法正常编译下面的例子
# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
建议最好将将以上环境变量添加到自己的 bash profile 中,例如 root 用户可以修改 /root/.bash_profile加入:
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
指定directfb的库目录,如果不做这一步骤,无法正常运行,在/etc/ld.so.conf最后一行加入以下代码:/usr/local/lib,然后执行ldconfig。
或者是设置环境变量:export LD_LIBRARY_PATH=/usr/local/lib
4. 示例检查
#cd ..
#cd DirectFB-examples-1.2.0
#./configure
#make
#make install
运行例子
#./df_window
注:
/usr/include/x86_64-linux-gnu/sys/param.h:76:0: note: this is the location of the previous definition
df_dok.c:311:13: error: conflicting types for ‘shutdown’
/usr/include/x86_64-linux-gnu/sys/socket.h:232:12: note: previous declaration of ‘shutdown’ was here
make[2]: *** [df_dok.o] Error 1
解决方法:
改名字