首页 > 技术文章 > DirectFB环境搭建

dixonyy 2014-10-29 11:07 原文

一、下载安装包

http://www.directfb.org/index.php?path=Main%2FDownloads

git clone git://git.directfb.org/git/directfb/core/DirectFB.git

二、编译(ubuntu 32bits)

1、安装自动配置需要的文件

sudo apt-get install autoconf
sudo apt-get install libtool

2、编译

进入DirecFB目录执行

./configure

发现缺乏一些配置库,apt-cache search查找相应的包,安装apt-get install

sduo apt-get install libpng12-dev

sudo apt-get install libjpeg62-dev

sudo apt-get install libfreetype6-dev

再次执行./configure

make

make install

三、运行示例

1、下载示例

http://www.directfb.org/index.php?path=Main%2FDownloads&page=1

2、编译安装

 cd ~/DirectFB-examples-1.6.0
 autoreconf
 ./configure--enable-debug
 make 
 sudo make install 

3、运行

./df_andi

出现企鹅动态界面代表安装成功

四、编译自己的程序

首先找到directfb的头文件和动态链接库的安装位置,/usr/local/include/directfb /usr/local/lib

将/usr/local/lib加入到动态链接库的编译查找范围中,将/usr/local/lib写入到/etc/ld.so.conf.d/libc.conf中,然后更新/sbin/ldconfig -v

编译命令:gcc xxx.c -I/usr/local/include/directfb -ldirectfb(我的ubuntu中.c文件必须紧跟着gcc命令才能链接动态链接库)

推荐阅读