嵌入式环境下需要使用directfb做后端,自己一步一步的摸索。这里记录下踩坑过程
我选择现在虚拟机里面来个直观感受,故而在ubuntu1604下进行编译测试,首先是编译directfb的开源库了,此处选择的是1.4版本了,编译安装脚本如下:
./autogen.sh
./configure --prefix=/home/skyhigh/WORK/install --enable-static --disable-x11 --enable-fbdev --with-gfxdrivers=vmware
make
make install
使用的脚本如下:
./configure \
-prefix /opt/qt5.5.1_dfb \
-v \
-opensource \
-confirm-license \
-nomake examples \
-nomake tests \
-no-xcb-xlib \
-no-xcb \
-no-xkbcommon-evdev \
-no-xinput2 \
-qpa directfb \
-directfb \
-L/opt/directfb_1_4/lib \
-I/opt/directfb_1_4/include
配置过程中directfb作为qpa后端始终显示如下:
QPA backends:
DirectFB … no # 没有成功
EGLFS … yes
EGLFS i.MX6… . no
EGLFS KMS … no
EGLFS Mali … no
EGLFS Raspberry Pi . no
EGLFS X11 … yes
LinuxFB … yes
XCB … no
反复查看配置,均没有问题,故而查看,最后只能看configure的源码,一路追踪,最后找到出问题的地方:
if [ "$CFG_DIRECTFB" != "no" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists directfb 2>/dev/null; then
QMAKE_CFLAGS_DIRECTFB=`$PKG_CONFIG --cflags directfb 2>/dev/null`
QMAKE_LIBS_DIRECTFB=`$PKG_CONFIG --libs directfb 2>/dev/null`
if compileTest qpa/directfb "DirectFB" $QMAKE_CFLAGS_DIRECTFB $QMAKE_LIBS_DIRECTFB; then
CFG_DIRECTFB=yes
elif [ "$CFG_DIRECTFB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo " DirectFB support cannot be enabled due to functionality tests!"
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
echo " Turn on verbose messaging (-v) to $0 to see the final report."
echo " If you believe this message is in error you may use the continue"
echo " switch (-continue) to $0 to continue."
exit 101
else
CFG_DIRECTFB=no
fi
else
CFG_DIRECTFB=no
fi
fi
pkg-config 会搜索是否存在对应的*.pc配置文件,找不到就会设置CFG_DIRECTFB = no
, 知道原因就好办了,我的安装路径是directfb安装路径:/opt/directfb_1_4
根据pkg-config的2种查找路径:
执行以下脚本:
PKG_CONFIG_PATH=/opt/directfb_1_4/lib:${PKG_CONFIG_PATH}
重新运行qt的配置脚本即可。
此处参考:https://www.cnblogs.com/rainsoul/p/10567390.html
在编译一个qt最基本的2Ddemo后,运行中会报如下错误:
Directfb/core/vt: unable to disallocate vt
-->Device or resource busy
dmesg查看系统log 有如下显示:
[ 812.141294] [drm:vmw_fb_setcolreg [vmwgfx]] *ERROR* Bad regno 16.
解决办法:暂未找到,还需继续
以下不靠谱
Try to disable vt switching by adding this to your directfbrc:
no-vt-switch