您的位置:首页 > 编程语言 > Qt开发

ubuntu qt-creator-linux-x86-opensource-1.3.0.bin qt4-x11_4.6.2.orig.tar.gz

2012-12-16 23:07 531 查看
最近搭建QT CREATER的环境真是从奔溃到奔溃,但是今天终于成功安装了,以下安装过程与大家分享一下。



参考文献:http://hh8582.blog.163.com/blog/static/140419204201022792824872/

1、系统环境以及软件准备
主机操作系统:Ubuntu 11.11
主机编译器:gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
交叉编译器:arm-linux-gcc 4.3
软件安装包:(软件包事先下载到了主目录下的Qt目录)
qt-everywhere-opensource-src-4.6.2.tar.gz (适合 x11 ,embedded)
2.下载qt-everywhere-opensource-src-4.6.2.tar.gz
下载地址:http://ftp3.ie.freebsd.org/pub/trolltech/pub/qt/source/下载 或者http://blog.csdn.net/samantha_sun/article/details/6451298
下载qt4-x11_4.6.2.orig.tar.gz
3.安装qt4-x11_4.6.2.orig.tar.gz(主要是为了得到assistant ,designer ,qvfb,uic 等工具)
A、编译安装qt4-x11_4.6.2.orig.tar.gz到/usr/local/qt-x86目录
解压:tar xzvf qt4-x11_4.6.2.orig.tar.gz 会生成qt-everywhere-opensource-src-4.6.2文件
进入解压目录: cd qt-everywhere-opensource-src-4.6.2
配置:./configure -prefix /usr/local/qt-x86 -qvfb
编译:make
安装: make install
NOTE: 配置时要加上 -qvfb ,否则后面无法编译生成 qvfb(Qt/Embedded Virtual Framebuffer) 工具
B、编译安装qvfb
进入qvfb源文件目录:cd qt-everywhere-opensource-src-4.6.2/tools/qvfb/
编译:make
安装:sudo make install
然后将
完成后会在/usr/local/qt-x86/bin 里找到 qvfb
4.编译安装qt-embedded
这里要编译qte的两个版本,qte for x86 (主要是生成在x86体系结构(即开发主机上)通过qvfb 运行的工具和库文件),
qte for arm(主要是生成在arm体系结构(即开发板上)直接运行的工具和库文件)
qte for x86 :
A、解压qt-everywhere-opensource-src-4.6.2.tar.gz
解压:tar xzvf qt-everywhere-opensource-src-4.6.2.tar.gz
B,进入刚才解压得到的目录
cd qt-everywhere-opensource-src-4.6.2
C,编译并安装 qte-for x86(在 /usr/local/qte-x86下生成 一些工具和相应的库文件)
配置:./configure -prefix /usr/local/qte-x86 -qvfb -qt3support -debug-and-release -system-zlib -system-libtiff -system-libpng -system-libjpeg -qt-libmng -make libs -nomake examples -nomake demos -nis -no-cups -xplatform qws/linux-x86-g++
-embedded x86 -depths 16,24,32 -qt-gfx-qvfb -no-gfx-linuxfb -no-gfx-transformed -no-gfx-vnc -no-gfx-multiscreen -plugin-sql-sqlite -no-glib -dbus -qt-kbd-qvfb -qt-mouse-qvfb

这里会有个问题-dbus 库找不到问题(参考:/article/1652241.html)如果你暂时不需要该功能就不要-dbus这个参数,在接下来会出现很多问题,请参考本文下面的错误。
编译:make
安装:make install
(安装完成后就会在 /usr/local/qte-x86下生成 一些工具和相应的库文件,当然可以改 -prefix yourDIR 不加 这个参数会默认安装在 /usr/local/Trolltech/***)
qte for arm:
可以把刚才解压的目录改名或者删除(如果没有足够空间的话)
A、解压qt-everywhere-opensource-src-4.6.2.tar.gz
解压:tar xzvf qt-everywhere-opensource-src-4.6.2.tar.gz
B,进入刚才解压得到的目录
cd qt-everywhere-opensource-src-4.6.2
C,编译并安装 qte-for arm(在 /usr/local/qte-arm下生成 一些工具和相应的库文件)
配置:./configure -prefix /usr/local/qte-arm -debug-and-release -qt3support -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -make libs -nomake examples -nomake demos -nomake docs -no-cups -iconv -xplatform qws/linux-arm-g++ -embedded
arm -little-endian -qt-freetype -depths 8,16,24,32 -qt-gfx-linuxfb -no-gfx-transformed -no-gfx-qvfb -no-gfx-vnc -no-gfx-multiscreen -no-dbus -qt-sql-sqlite -qt-kbd-qvfb -qt-kbd-tty -qt-mouse-pc -no-glib -plugin-mouse-tslib
-I/arm2410s/tslib1.4-install/include -L/arm2410s/tslib1.4-install/lib -D__ARM_ARCH_5TEJ__
红色部分根据自己的tslib生成库放到的位置不同而不同。
(最后的参数 -D__ARM_ARCH_5TEJ__ 是出现了后面的第七个错误 #error "Not supported ARM architecture" 后又重新回来加上的,加上后指明了适合的平台就没这个错误了)
参数 -plugin-mouse-tslib -I/arm2410s/buildTSlib/include -L/arm2410s/buildTSlib/lib 是说我用的是tslib,后面的-I ,-L 分别指明了要包含的头文件和库文件, /arm2410s/buildTSlib/是我编译tslib-1.0是生成文件的目录,详细编译tslib可以参见一武大女生的博客:http://blog.chinaunix.net/u1/33412/showart_273400.html
编译:make
安装:make install
5.设置环境变量
A:针对 qte for x86的
cd /usr/local/
vi setenv-x86
编辑完后的内容如下:
export QT4DIR=/usr/local/qt-x86
export QTEDIR=/usr/local/qte-x86
export PATH=$QTEDIR/bin:$QT4DIR/bin:$PATH
export LD_LIBRARY_PATH=$QT4DIR/lib:$QTEDIR/lib:$LD_LIBRARY_PATH
保存退出
B:针对 qte for arm的
vi setenv-arm
编辑完后的内容如下:
export QT4DIR=/usr/local/qt-x86
export QTEDIR=/usr/local/qte-arm
export PATH=$QTEDIR/bin:$QT4DIR/bin:$PATH
export LD_LIBRARY_PATH=$QT4DIR/lib:$QTEDIR/lib:$LD_LIBRARY_PATH
保存并退出
要运行哪个版本就设置相应的环境,如要在主机上用qvfb ,就用 运行:. setenv-x86 (注意点后面有个空
7.编译过程中可能出现的错误和部分解决办法
1:error
/usr/bin/ld: cannot find -lXtst
collect2: ld returned 1 exit status
make: *** [../../bin/qvfb] Error 1
解决:
sudo apt-get install libxtst-dev http://blog.csdn.net/babyfacer/archive/2009/01/05/3711988.aspx 2:error
qtiffhandler.cpp:48:20: error: tiffio.h: No such file or directory
解决:cp /usr/local/qt4.6-x86/src/3rdparty/libtiff/libtiff/tiffio.h /usr/local/qt4.6-x86/src/plugins/imageformats/tiff
3:error
In file included from qtiffhandler.cpp:48:
tiffio.h:33:18: error: tiff.h: No such file or directory
解决:cp /usr/local/qt4.6-x86/src/3rdparty/libtiff/libtiff/tiff.h /usr/local/qt4.6-x86/src/plugins/imageformats/tiff
4:error
/usr/bin/ld: cannot find -ltiff
解决:apt-get install libtiff4-dev
5:error
/usr/bin/ld: cannot find -lQtUiTools
collect2: ld returned 1 exit status
悬而未决
6:error
QFontEngineFT::init(QFontEngine::FaceId, bool, QFontEngineFT::GlyphFormat)':
text/qfontengine_ft.cpp:696: warning: initialization to `int' from `qreal'
text/qfontengine_ft.cpp:696: warning: argument to `int' from `qreal'
{standard input}: Assembler messages:
{standard input}:1587: Error: register or shift expression expected -- `orr r3,r2,lsl#16'
{standard input}:1597: Error: register or shift expression expected -- `orr r2,r3,lsl#16'
{standard input}:3206: Error: register or shift expression expected -- `orr r3,r1,lsl#16'
{standard input}:3219: Error: register or shift expression expected -- `orr r3,ip,lsl#16'
解决:参考http://www.qtcn.org/bbs/read.php?tid=24692&fpage=0&toread=&page=1 守望者的临时解决方案:
To fix this issue patch /src/3rdparty/freetype/include/freetype/config/ftconfig.h Line 330.
(原来的为) "orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
(修改后为) "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
7:error
In file included from ./config.h:26,
from ../JavaScriptCore/pcre/pcre_compile.cpp:44:
../JavaScriptCore/wtf/Platform.h:338:6: #error "Not supported ARM architecture"
make[1]: *** [obj/release/pcre_compile.o] Error 1
make[1]: Leaving directory `/usr/local/qte4.6-arm/src/3rdparty/webkit/WebCore'
make: *** [sub-webkit-make_default-ordered] Error 2
解决:参考http://www.qtcentre.org/threads/26712-error-error-Not-supported-ARM-architecture 回帖
转引如下:
Maybe it's late for a reply but I have a detailed solution to the problem.
Like what people have mentioned in the replies,
you have to specify the target architecture.
Check /3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h
You will find the defintions for the architectures there.
such as , "__ARM_ARCH_5TEJ__" (this is for ARMv5)
add a line in your ./configure parameters, such as "-D__ARM_ARCH_5TEJ__" , or whichever architecture definition that suits the platform.
The compile problems to do with javascriptcore should go away.
It happened to work for me, at least for qt 4.5.1 and 4.6.2, for ARMv5 architecture.
Hope this helps.
问题1.

/usr/local/arm/4.1.2/bin/../lib/gcc/arm-angstrom-linux-gnueabi/4.1.2/../../../../arm-angstrom-linux-gnueabi/bin/ld:warning:libts-0.0.so.0,neededby/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so,notfound(tryusing-rpathor-rpath-link)

/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so:undefinedreferenceto`ts_read_raw'

/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so:undefinedreferenceto`ts_open'

/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so:undefinedreferenceto`ts_fd'

/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so:undefinedreferenceto`ts_config'

/home/still招聘嵌入式linux应用water/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so:undefinedreferenceto`ts_close'

/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so:undefinedreferenceto`ts_read'

collect2:ldreturned1exitstatus

make:***Error1

make:Leavingdirectory`/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/demos/deform'

make:***Error2

make:Leavin嵌入式培训farsightgdirectory`/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/demos'

make:***Error2

解决办法:

修改qt-everywhere-opensource-src-4.6.0/mkspecs/qws/linux-arm-g++/qmake.conf文件(添加lts参数):

QMAKE_CC =arm-linux-gcc -lts

QMAKE_CXX =arm-linux-g++ -lts

QMAKE_LINK =arm-linux-g++ -lts

QMAKE_LINK_SHLIB =arm-linux-g++ -lts


以下实例图
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: