Linux 下编译、安装、配置 QT
Linux 下编译、安装、配置 QT
打算做嵌入式图像处理,计划方案嵌入式Linux+OpenCV+QT,昨天简单入门OpenCV今天看看QT,QT就先弄Linux下面的,回家之前争取把基本的摸通,然后能在板子上跑起来。
Qt 的详细介绍:请点这里
Qt 的下载地址:请点这里
推荐阅读:
Ubuntu 环境下Gtk与QT编译环境安装与配置
Linux系统下QT环境搭建
Ubuntu下QT控制台程序无法运行的解决方案以及XTerm的配置方法
Ubuntu 10.04下QT4.7.4移植详解
Linux下为刚安装好的Qt Creator 创建桌面启动图标
Ubuntu 11.04安装QT Creator 2.5.0
Qt creator for PlayBook安装过程
软件环境
Linux:Ubuntu 12.04 X86
QT:4.8.4
关于QT安装
QT的早期版本和现在版本有点变化,提供的文件也不尽相同,最新的版本为5.0,我这里用的是4.8.4,一个完整的QT应该包括QT库、IDE也就是QT creator,在Linux下的安装中,目前看到的主要有三种方法:
1、.bin文件直接安装,文件名为qt-sdk-……,一个./bin直接包括了所有相关工具,安装起来最为简单方便,但是目前的4.8.4在几个网站上已经找不到总的sdk的bin文件了,老版本的还是可以的。
2、Ubuntu下使用atp-get安装,方法如下(未验证)
sudo apt-get install qt4-dev-tools #开发包 sudo apt-get install qtcreator #IDE sudo apt-get install qt4-doc #开发帮助文档 sudo apt-get install qt4-qtconfig #配置工具 sudo apt-get install qt4-demos #DEMO源码 QT
3、这就是本文用的方法,就是下载源码包,自己编译安装,最为麻烦,但是本来就是学习的,况且现在只能下载到源码包,那就先学习这种方法把。
软件下载
QT有好几个下载网站,这里汇总介绍,自从诺基亚公司放弃Meego、遣散Qt开发团队以后,Qt商业版本的网站移到了qt.digia.com,而开源版本则放到了qt-project.org :
1、首先是诺基亚的官方网站http://qt.digia.com/ 这个是不太方便的,想快速下载的接着看后面的。
此网站需要填写用户名和邮箱地址,下载地址会发送到邮件里,我就把我收到的地址贴出来吧。下面是邮件中的地址汇总。这里面的linux源码是commercial版本。
Qt 4.8.4 for embedded Linux
http://dist.qt.digia.com/developer/download/qt-everywhere-commercial-src-4.8.4.tar.gz
Installing Qt for embedded Linux
http://qt-project.org/doc/qt-4.8/qt-embedded-install.html
Qt Commercial Charts 1.1.0
http://dist.qt.digia.com/developer/download_charts/qt-commercial-charts-src-1.1.0.tar.gz
Qt 5.0.0 Sources
http://dist.qt.digia.com/developer/download_50/qt-everywhere-commercial-src-5.0.0.tar.gz
Qt 4.8.4 for Windows (Src and VS2008 32bit Binary)
http://dist.qt.digia.com/developer/download/qt-win-commercial-4.8.4-vs2008.exe
Qt Visual Studio Addin 1.1.11 for Qt4 (Binary)
http://dist.qt.digia.com/developer/download/qt-vs-addin-1.1.11.exe
Qt 4.8.4 for Windows (Src and VS2010 32bit Binary)
http://dist.qt.digia.com/developer/download/qt-win-commercial-4.8.4-vs2010.exe
Qt 4.8.4 for Windows (Src and MinGW 32bit Binary)
http://dist.qt.digia.com/developer/download/qt-win-commercial-4.8.4-mingw.exe
Qt Creator 2.6.1 for Windows (32bit Binary)
http://dist.qt.digia.com/developer/download_creator/qt-creator-win-commercial-2.6.1.exe
Qt 4.8.4 for Windows (Src and VS2010 64bit Binary)
http://dist.qt.digia.com/developer/download/qt-win-commercial-4.8.4-vs2010-64bit.exe
Qt Commercial Charts 1.1.0
http://dist.qt.digia.com/developer/download_charts/qt-commercial-charts-src-1.1.0.zip
Qt 5.0.0 Sources
http://dist.qt.digia.com/developer/download_50/qt-everywhere-commercial-src-5.0.0.zip
Qt 5.0.0 Offline SDK for Windows (32-bit Binary)
http://dist.qt.digia.com/developer/download_50/qt-windows-commercial-5.0.0-msvc2010_32-x86-offline.exe
Qt Visual Studio Addin 1.2.0 for Qt5 (Binary)
http://dist.qt.digia.com/developer/download_50/qt-vs-addin-1.2.0.exe
2、QT-project网站下载 http://qt-project.org/downloads
这个网站就直接而且清晰多了,分类很清楚,如下图所示。
需要说明的是Qt libraries 4.8.4 for embedded Linux (236 MB) 下载链接和Qt libraries 4.8.4 for Linux/X11 (225 MB) 其实下载的是一个东西,反正我看到的链接地址都是一样的,这也就是Linux下我们需要用的。另外从这个页面再下载开发所用的IDE QT Creator,这是一个bin文件,可以直接安装。
QT的编译与安装
1、拷贝文件到自己想要的文件夹,解压:
tar zxvf qt-everywhere-opensource-src-4.8.4.tar.gz
2、进入解压后文件目录,执行配置
root@emouse:~/study# cd qt-everywhere-opensource-src-4.8.4/
root@emouse:~/study/qt-everywhere-opensource-src-4.8.4# ./configure
此处也可以加上配置前缀.
/configure
-prefix
/opt/qt-4
.8.4-x11
这样的话再后面编译过程中的文件会复制到
/opt/qt-4
.8.4-x11 这个目录下(目录不存在会自动创建),好处是源码便于管理,
关于这部分前缀配置可以我在config文件中找到这部分代码,可以参考,可以从这段代码中看出相应的配置以及没有配置的情况下默认安装目录,代码位于3594行,如下:
#-------------------------------------------------------------------------------
# post process QT_INSTALL_* variables
#-------------------------------------------------------------------------------
#prefix
if [ -z "$QT_INSTALL_PREFIX" ]; then
if [ "$CFG_DEV" = "yes" ]; then
QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default
elif [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
if [ "$PLATFORM_QPA" = "yes" ]; then
QT_INSTALL_PREFIX="/usr/local/Trolltech/QtLighthouse-${QT_VERSION}"
else
QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}"
fi
if [ "$PLATFORM" != "$XPLATFORM" ]; then
QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}"
fi
elif [ -d "$EPOCROOT" ] && [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
QT_INSTALL_PREFIX="$EPOCROOT/epoc32/"
QT_INSTALL_LIBS="$EPOCROOT/epoc32/release/armv5/lib/"
fi
else
QT_INSTALL_PREFIX="/usr/local/Trolltech/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Trolltech/Qt-$QT_VERSION
|
评论暂时关闭