5. 编译 DirectFB 库
# cd ~/DirectFB/DirectFB
# ./autogen.sh \
--prefix=/usr/local \
--disable-osx \
--enable-x11 \
--disable-fbdev \
--disable-sdl \
--disable-vnc \
--with-gfxdrivers=none \
--with-inputdrivers=linuxinput \
--enable-multi \
--enable-debug
# make
# sudo make install
* 我一般将这些命令写到一个shell脚本里面。如(build-for-pc.sh)
6. 编译错误处理
编译 DirectFB 的时候,提示一下错误:
# make
../../../lib/fusion/types.h:42:2: error: #error Major version of Fusion Kernel Module too low! Upgrade your kernel.
这是因为:
--- /usr/include/linux/fusion.h 文件---
#define FUSION_API_MAJOR 8 /* Increased if backward compatibility is dropped. */
#define FUSION_API_MINOR 0 /* Increased if new features are added. */
#define FUSION_API_MICRO 3 /* Micro release. Bugfixes. */
--- DirectFB/lib/fusion/types.h ---
#define FUSION_API_MAJOR_REQUIRED 8
#define FUSION_API_MINOR_REQUIRED 0
#if FUSION_API_MAJOR_REQUIRED > FUSION_API_MAJOR_PROVIDED
#error Major version of Fusion Kernel Module too low! Upgrade your kernel.
#else
...
#endif
可以看出, FUSION_API_MAJOR_PROVIDED 没有在 /usr/include/linux/fusion.h 定义,所以 只需要将 DirectFB/lib/fusion/types.h 中 FUSION_API_MAJOR_PROVIDED 的改成 FUSION_API_MAJOR 即可。修改完之后是:
# git diff lib/fusion/types.h
---------------------------------------------------------------------------
diff --git a/lib/fusion/types.h b/lib/fusion/types.h
index 1b862a4..3776e93 100644
--- a/lib/fusion/types.h
+++ b/lib/fusion/types.h
@@ -38,11 +38,11 @@
#define FUSION_API_MAJOR_REQUIRED 8
#define FUSION_API_MINOR_REQUIRED 0
-#if FUSION_API_MAJOR_REQUIRED > FUSION_API_MAJOR_PROVIDED
+#if FUSION_API_MAJOR_REQUIRED > FUSION_API_MAJOR
#error Major version of Fusion Kernel Module too low! Upgrade your kernel.
#else
-#if FUSION_API_MAJOR_REQUIRED == FUSION_API_MAJOR_PROVIDED
-#if FUSION_API_MINOR_REQUIRED > FUSION_API_MINOR_PROVIDED
+#if FUSION_API_MAJOR_REQUIRED == FUSION_API_MAJOR
+#if FUSION_API_MINOR_REQUIRED > FUSION_API_MINOR
#error Minor version of Fusion Kernel Module too low! Upgrade your kernel.
#endif
#endif
---------------------------------------------------------------------------
再编译,OK。DirectFB 将被安装到 prefix 指定的地方(/usr/local/lib/)。
7. 添加 /usr/local/lib/ 路径
为了是使用DirectFB,需要将DirectFB库所在的路径添加到 系统搜索路径。否则:
1) pkg-config 找不到 DirectFB
2) ld 命令也找不到 DirectFB 库
所以:
# sudo vi /etc/ld.so.conf.d/qt-i386.conf
添加一行: /usr/local/lib
# sudo ldconfig