is Qt installed correctly?

通过buildroot配置编译好qtopia后,下载到开发板上,配置好环境变量:

export QWS_DISPLAY="LinuxFb:mmWidth480:mmHeight272:0"
export QWS_SIZE="480x272"
export LD_LIBRARY_PATH=/usr/lib

然后去运行demo程序,出现:

# /usr/demos/chip/chip -qws
QFontDatabase: Cannot find font directory /home/crifan/buildroot/buildroot-2009.08/project_build_arm/uclibc/root/usr/lib/fonts - is Qt installed correctly?
Aborted

【解决过程】

1.由于之前已经折腾了关于qtopia的配置并编译,所以,对于qt的官方的文档中的这部分说明:

http://qt.nokia.com/doc/qtopia4.3/running-qtopia.html

“Environment Settings to Run Qtopia

There are no specific environment variables required to run Qtopia, however there are some that can be set to control Qtopia's features.

If you specified you will need to set LD_LIBRARY_PATH so that the libraries can be found.

Qtopia does not require to be set but third party applications may expect it to include .

You may wish to set some environment variables to configure Qtopia Core. You may also need to set QTOPIA_PHONE_DEVICE. See Qtopia Environment Variables for details on how to set environment variables.

应该还算理解了其意思,说的是,如果你当初编译qtopia的时候,在./configure 中加了-no-rpath,根据说明:

“    -no-rpath .......... Do not use the library install path as a runtime
                         library path.
+ -rpath ............. Link Qt libraries and executables using the library
                         install path as a runtime library path. Equivalent
                         to -R install_libpath

意思就是,不要使用你的安装路径,即-prefix指定的路径,如果没用-prefix指定,那么就是默认的/usr/local/Trolltech/QtEmbedded-4.5.3:
“    -prefix <dir> ...... This will install everything relative to <dir>
                         (default /usr/local/Trolltech/QtEmbedded-4.5.3)”

而我这里当初配置的是-prefix $(TARGET_DIR)/usr,即 -prefix /home/crifan/buildroot/buildroot-2009.08/project_build_arm/uclibc/root/usr意思是将qtopia安装到buildroot中rootfs中的usr下面。

并且,按照其说明,不需要配置其他环境变量了,只是由于编译的时候,加了-no-rpath,所以需要配置一下对应的LD_LIBRARY_PATH,这里由于之前配置成/home/crifan/buildroot/buildroot-2009.08/project_build_arm/uclibc/root/usr,buildroot中make的时候,编译qt并make install到对应的rootfs文件夹的usr下面了,而现在rootfs已经烧写到板子了,已经进了rootfs了,所以要配置成/usr/lib,以便qt程序运行的时候,能找到对应的库文件。

所以,其他参数,应该就没有再需要配置的了,应该就可以工作的了。

而且,关于

http://qt.nokia.com/doc/qtopia4.3/qtopiacore-envvars.html

中,也介绍了,关于qt-core的一些环境变量,主要是QWS_DISPLAY,我这里,也按照网上别人的帖子和官方文档中的说明,去配置了:

export QWS_DISPLAY="LinuxFb:mmWidth480:mmHeight272:0"
export QWS_SIZE="480x272"

export QWS_DISPLAY="LinuxFb:/dev/fb0"
了,但是,还是无法工作,运行测试程序,还是显示错误:

# /usr/demos/mainwindow/mainwindow -qws
QFontDatabase: Cannot find font directory /home/crifan/buildroot/buildroot-2009.08/project_build_arm/uclibc/root/usr/lib/fonts - is Qt installed correctly?

最后,无意间,在网上看到别人的帖子:

http://hi.baidu.com/a263238386/blog/item/6ff055dda933033e5882dd32.html

发现有个关于qt font的环境变量:export QT_QWS_FONTDIR=$QTDIR/lib/fonts

所以,自己就去加了一下:

export QT_QWS_FONTDIR=/usr/lib/fonts

export LD_LIBRARY_PATH=/usr/lib
或者

export QTDIR=/usr
export LD_LIBRARY_PATH=$QTDIR/lib
export QT_QWS_FONTDIR=$QTDIR/lib/fonts

结果,qt的demo程序就可以运行了,呵呵。

实际结果表明,这些相关的qt的环境变量,是必须的,要指定好对应的位置,让qt能找到qt的lib和font等必须的资源,才可以运行qt的demo和example的。

其他的参数,好像这个,可有可无的:

export QT_PLUGIN_PATH=$QTDIR/plugins/

如果用到鼠标和键盘,那估计

http://qt.nokia.com/doc/qtopia4.3/qtopiacore-envvars.html

中的QWS_MOUSE_PROTO和QWS_KEYBOARD 也要配置好的。有空再去试试。

【提示】

1.关于-prefix参数,为何不用qt默认的配置的/usr 而去自己修改为$(TARGET_DIR)/usr:

因为默认的qt.mk中原先配置的是 -prefix /usr,会去讲qtopia安装到我buildroot所在Linux的/usr下面,很弱智的,这样,你buildroot中去make,最后的qtopia的make install会去将生成的qt的东西,用于arm板子的qt的东西,会安装到你当前X86的PC上的Linux下的/usr中,这不扯淡的吗。。

所以,才会去在buildroot中package/qt.mk中,配置成QT_CONFIGURE += -prefix $(TARGET_DIR)/usr

【引用】

1。Online Reference Documentation

http://qt.nokia.com/doc/qtopia4.3/index.html

2.Qtopia Developer Resources

http://qt.nokia.com/doc/qtopia4.3/index.html

3.Running Qtopia
http://qt.nokia.com/doc/qtopia4.3/running-qtopia.html

4.Qtopia Core Environment Variables
http://qt.nokia.com/doc/qtopia4.3/qtopiacore-envvars.html

5.QT 4.5.2 嵌入式开发平台的搭建

http://hi.baidu.com/a263238386/blog/item/6ff055dda933033e5882dd32.html

6.环境变量QWS_DISPLAY

http://fanzhichao.blog.hexun.com/23669000_d.html


另外一个:

编译通过后
在/work/check/check/bin下就会有可执行的二进制check文件。[应用程序bin]

将它拷贝到/opt/FriendlyARM/mini2440/root_nfs/下qtopia目录里,同时将Qtopia Core 

OpenSource 4.3.3的库lib拷贝到/opt/FriendlyARM/mini2440/root_nfs/的qt目录

里。/opt/FriendlyARM/mini2440/root_nfs/是开发板要挂载的目录,然后将pc机上

的/opt/FriendlyARM/mini2440/root_nfs/目录挂载到开发板的/mnt/nfs/目录下,然后在开发板里

输入:

#export QTDIR=/mnt/nfs/qt
#export QTEDIR=$QTDIR
#export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
#cd /mnt/nfs/qtopia
#./check -qws

出现:QFontDatabase: Cannot find font directory /usr/local/Trolltech/QtopiaCore-4.3.3-arm/lib/fonts - is Qt installed correctly?

方法1:那你需要做的就是将/mnt/nfs/qt/lib/fonts里的文件拷贝到开发板/usr/local/Trolltech/QtopiaCore-4.3.3-arm/lib/fonts。

方法2:非常感谢半碗蛋炒饭的方法:

在开发板上输入:export QT_QWS_FONTDIR=/mnt/nfs/qt/lib/fonts     [我的是:export set QT_QWS_FONTDIR=$QTDIR/lib/fonts/ ]

再次运行#./check -qws

这时,开发板上就会出现,咱们最开始的那幅图片,输入密码试一试,验证一下。

建议用方法2 ,但不彻底,
本质上:在/etc/profile 中添加   export set QT_QWS_FONTDIR=$QTDIR/lib/fonts/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值