安装Linux/x11版Qt-4.8.4

在官方网站下载Qt libraries 4.8.4 for Linux/X11 (225 MB)(实际是:qt-everywhere-opensource-src-4.8.4.tar.gz)。
完成之后在ubuntu宿主机解压:
zhuzhaoqi@zhuzhaoqi-desktop:~/Qt-4.8.4/Qt-4.8.4$ tarzxvf qt-everywhere-opensource-src-4.8.4.tar.gz
在装有gold linker的系统里,编译脚本会加入-fuse-ld=gold选项,但这个选项gcc是不支持的。解决办法是移除该选项,找到文件src/3rdparty/webkit/Source/common.pri,屏蔽QMAKE_LFLAGS+=-fuse-ld=gold。
linux-g++ {
isEmpty($$(SBOX_DPKG_INST_ARCH)):exists(/usr/bin/ld.gold){
   message(Using gold linker)
#    QMAKE_LFLAGS+=-fuse-ld=gold
}
}
配置安装路径:
zhuzhaoqi@zhuzhaoqi-desktop:~/Qt-4.8.4/Qt-4.8.4/qt-everywhere-opensource-src-4.8.4$./configure --prefix=/usr/local/qt-4.8.4-x11
……
Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.
c是商业,o是开源,选择o
……
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.
选择yes
……
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/qt-4.8.4-x11
To reconfigure, run 'make confclean' and 'configure'.
zhuzhaoqi@zhuzhaoqi-desktop:~/Qt-4.8.4/Qt-4.8.4/qt-everywhere-opensource-src-4.8.4$
Qt输出信息提示我们进行make编译:
zhuzhaoqi@zhuzhaoqi-desktop:~/Qt-4.8.4/Qt-4.8.4/qt-everywhere-opensource-src-4.8.4$make
这个编译过程比较久,依每个人的电脑配置而定,大概需要1~3个小时。
zhuzhaoqi@zhuzhaoqi-desktop:~/Qt-4.8.4/Qt-4.8.4/qt-everywhere-opensource-src-4.8.4$make install
安装好之后,在/usr/local目录下面有:
zhuzhaoqi@zhuzhaoqi-desktop:/usr/local$ ls
arm  etc    include lib  qt-4.8.4-arm  qwt-6.0.2     sbin   src
bin  games  info    man  qt-4.8.4-x11  qwt-6.0.2-arm  tslib-1.0
1.1.2   安装embeddedQt-4.8.4
Embedded版Qt4.8.4源码和Linux/x11版Qt4.8.4是一样的,将下载的源码解压在另一个文件夹,配置embedded版配置:
zhuzhaoqi@zhuzhaoqi-desktop:~/Qt-4.8.4/Qt-4.8.4/arm/qt-everywhere-opensource-src-4.8.4$./configure -prefix /usr/local/qt-4.8.4-arm/-shared -no-fast -no-largefile -no-exceptions -qt-sql-sqlite -qt3support-no-xmlpatterns -multimedia -no-svg -no-mmx -no-3dnow -no-sse -no-sse2 -qt-zlib-no-webkit -qt-libtiff -qt-libpng -qt-libjpeg -make libs -nomake examples-nomake docs -nomake demo -no-optimized-qmake -no-nis -no-cups -no-iconv-no-dbus -no-separate-debug-info -no-openssl -xplatform qws/linux-arm-g++-embedded arm -little-endian -no-freetype -depths 4,8,16,32 -qt-gfx-linuxfb-no-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb -qt-kbd-linuxinput -no-kbd-tty-no-glib -armfpa -no-mouse-qvfb -qt-mouse-pc -qt-mouse-tslib -I/usr/local/tslib-1.0/include-L/usr/local/tslib-1.0/lib
执行make进行编译:
zhuzhaoqi@zhuzhaoqi-desktop:~/Qt-4.8.4/Qt-4.8.4/arm/qt-everywhere-opensource-src-4.8.4$make
执行makeinstall进行安装:
zhuzhaoqi@zhuzhaoqi-desktop:~/Qt-4.8.4/Qt-4.8.4/arm/qt-everywhere-opensource-src-4.8.4$make install
安装好之后,在/usr/local目录下面有:
zhuzhaoqi@zhuzhaoqi-desktop:/usr/local$ ls
arm  etc    include lib  qt-4.8.4-arm  qwt-6.0.2     sbin   src
bin  games  info    man  qt-4.8.4-x11  qwt-6.0.2-arm  tslib-1.0
在qt-4.8.4-arm目录下有如下目录:
zhuzhaoqi@zhuzhaoqi-desktop:/usr/local/qt-4.8.4-arm$ls
bin imports  include  lib mkspecs  plugins
在文件系统/opt/目录下新建Qt-4.8.4目录,如下所示:
zhuzhaoqi@zhuzhaoqi-desktop:~/rootfs/opt$ sudo mkdirQt-4.8.4/
将imports、lib、mkspecs、plugins拷贝至/opt/Qt-4.8.4/。
zhuzhaoqi@zhuzhaoqi-desktop:/usr/local/qt-4.8.3-arm$sudo cp -r importslibmkspecsplugins /home/zhuzhaoqi/rootfs/opt/Qt-4.8.4/
在开发板的文件系统/usr/目录下新建/qt/目录,将/qt-4.8.4-arm/lib/目录下的所有文件拷贝到/usr/qt/目录中。
zhuzhaoqi@zhuzhaoqi-desktop:~/rootfs/usr$ sudo mkdirqt
zhuzhaoqi@zhuzhaoqi-desktop:/usr/local/qt-4.8.4-arm/lib$sudo cp -r * /home/zhuzhaoqi/rootfs/usr/qt/
为OK6410开发平台添加Qt启动环境参数,在/etc/profile中添加:
export QTDIR=/usr/qt
export QPEDIR=$QTDIR
export QT_PLUGIN_PATH=/usr/qt
export T_ROOT=/usr/local/tslib
export PATH=$QTDIR/:$PATH
export QWS_MOUSE_PROTO=Tslib:/dev/event0
export LD_LIBRARY_PATH=$T_ROOT/lib:$QTDIR
export QT_QWS_FONTDIR=/usr/qt
至此,Qt移植就完成。
注:本节配套视频位于光盘中“嵌入式Linux实用教程视频”目录下第五章02课(安装Linux和embedded版本Qt-4.8.4)。
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页