Chinaunix首页 | 论坛 | 博客
  • 博客访问: 341862
  • 博文数量: 69
  • 博客积分: 3077
  • 博客等级: 中校
  • 技术积分: 602
  • 用 户 组: 普通用户
  • 注册时间: 2009-06-11 09:40
个人简介

或以为孤权重,妄相忖度

文章分类

全部博文(69)

文章存档

2012年(1)

2011年(10)

2010年(39)

2009年(19)

我的朋友

分类: 嵌入式

2010-07-18 12:19:11

参考1:http://blog.csdn.net/zzf0707/archive/2010/02/24/5320094.aspx

参考2 :http://blog.chinaunix.net/u1/33412/showart_273400.html
参考3:http://blog.chinaunix.net/u3/94449/showart_2070501.html
参考4:
还有。。。

1、系统环境以及软件准备
主机操作系统:Ubuntu 9.04
主机编译器:gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
交叉编译器:arm-linux-gcc 3.4.1
软件安装包:(软件包事先下载到了主目录下的Qt目录)
qt-everywhere-opensource-src-4.6.2.tar.gz   (适合 x11 ,embedded)

2.下载qt-everywhere-opensource-src-4.6.2.tar.gz
下载地址:下载

3.安装qt-x11(主要是为了得到assistant ,designer ,qvfb,uic 等工具)

A、编译安装qt-x11到/usr/local/qt-x86目录
解压:tar xzvf  qt-everywhere-opensource-src-4.6.2.tar.gz
进入解压目录: 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 
(原先编译了 examples, demos 的,但一直出现错误,才有了后面列的几个错误,最后遇到一个错误解决不了了,就去掉了那两个模块,但现在qvfb还是有问题,有两个鼠标,一个一直飘,)
相关参数可以 用 ./configure -help 查看,感觉Qt3 和Qt4 的配置参数还是有点区别的,第一次我加了 -qt-mouse-usb  报告说 不识别这个参数。

编译: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 -qt-mouse-tslib -I/home/arm/tslib/include -L/home/arm/tslib/lib -D__ARM_ARCH_5TEJ__

精简配置:

../4.6.3/configure -qt-kbd-tty -qt-gfx-linuxfb -no-gfx-transformed -no-gfx-multiscreen -qt-mouse-pc -no-gfx-qvfb -no-gfx-vnc -qt-kbd-tty -qt-gfx-linuxfb -no-gfx-qvfb -no-gfx-vnc -qt-mouse-tslib -no-glib -prefix /usr/local/Trolltech/qte4.6.3-arm -embedded arm -release -shared -fast -no-largefile -qt-sql-sqlite -no-qt3support -no-xmlpatterns -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-webkit -qt-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -make libs -nomake tools -nomake examples -nomake docs -nomake demo -no-nis -no-cups -no-iconv -no-dbus -no-openssl -xplatform qws/linux-arm-g++ -little-endian -qt-freetype -depths 16,18 -I/home/arm/tslib/include -L/home/arm/tslib/lib -v -D__ARM_ARCH_5TEJ__


(最后的参数  -D__ARM_ARCH_5TEJ__ 是出现了后面的第七个错误 #error "Not supported ARM architecture" 后又重新回来加上的,加上后指明了适合的平台就没这个错误了)

参数  -qt-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  (注意点后面有个空格)

6.依旧存在的问题:

A.下面所列第5个错误没有解决,哎,没有坚持下去,就转不编译 例子和演示了。

B.编译出来的qvfb 里有2个鼠标,一个飘忽不定。还没找到解决方法, http://blog.chinaunix.net/u3/94449/showart_2070501.html     可能会有点帮助 ,现在还没试过,因为我以前用的是qt-3.3.8的版本,那个版本下生成的qvfb 没有这个问题

C.qt3和qt4 的兼容性还是有问题,虽然我编译了 qt3support ,也利用qt3to4 加以转换,但编译时还是有很多问题,这是我接下来要做的主要事情,我在qt3.3.8下本来用得很好的,但做的一个程序在开发板上跑步起来,就是绿屏和一个鼠标,但串口输出的调试信息是正确的,且在qvfb上可以正常运行,这个问题至今一直困惑着我(哦还有很多其他人),望高手能指教,QQ:378063426,后来 在网上看到一个帖子跟我0有同样的问题(见http://blog.chinaunix.net/u2/61322/showart_1859655.html)。


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'

解决:参考守望者的临时解决方案:
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

解决:参考回帖
转引如下:
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. 

==========================================================================

Antony

PS:你一定会发现这么多版本的qmake引用起来非常不方便,其实只要做个简单的一个命令就可以让这种烦恼不再!

[root@localhost /]# cd /usr/local/Trolltech/qte4.6.3-arm/bin

[root@localhost bin]# ln -s qmake qmake-qte

[root@localhost bin]# qmake-qte -v

QMake version 2.01a

Using Qt version 4.6.3 in /usr/local/Trolltech/qte4.6.3-arm/lib

[root@localhost bin]# 

将路径/usr/local/Trolltech/qte4.6.3-arm/bin添加到.bashrc中,手动生成Makefile时就可以直接使用qmake-qte了。其他类似。

 

 

 

2010-11-20 重新编译如下:

首先进入/opt/4.6.3/mkspecs/qws/linux-arm-g++修改qmake.conf,根据各人的情况配置交叉编译器!

我的编译器版本:4.3.2。

(后来又用4.3.3版本编译了一遍,得到以下错误:

error: 'sbrk' was not declared in this scope)

(编译busybox时,用4.3.2编译的,结果提示Kernel panic - not syncing: Attempted to kill init!见使用arm-linux-gcc 4.3.2编译必须启用内核中的Use the ARM EABI选项)

以下是我自己的qmake.conf文件:

#

# qmake configuration for building with arm-none-linux-gnueabi-g++

#

include(../../common/g++.conf)

include(../../common/linux.conf)

include(../../common/qws.conf)

# modifications to g++.conf

QMAKE_CC                = arm-none-linux-gnueabi-gcc

QMAKE_CXX               = arm-none-linux-gnueabi-g++

QMAKE_LINK              = arm-none-linux-gnueabi-g++

QMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++

# modifications to linux.conf

QMAKE_AR                = arm-none-linux-gnueabi-ar cqs

QMAKE_OBJCOPY           = arm-none-linux-gnueabi-objcopy

QMAKE_STRIP             = arm-none-linux-gnueabi-strip

load(qt_config)

[root@localhost /]# cd /opt

[root@localhost opt]# rm -rf build/

[root@localhost opt]# mkdir build/

[root@localhost opt]# cd build/

[root@localhost build]# 

配置一:

../4.6.3/configure -qt-kbd-tty -qt-gfx-linuxfb -no-gfx-transformed -no-gfx-multiscreen -qt-mouse-pc -no-gfx-qvfb -no-gfx-vnc -qt-kbd-tty -qt-gfx-linuxfb -no-gfx-qvfb -no-gfx-vnc -qt-mouse-tslib -no-glib -prefix /opt/qtopia -embedded arm -release -shared -fast -no-largefile -qt-sql-sqlite -no-qt3support -no-xmlpatterns -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-webkit -qt-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -make libs -nomake tools -nomake examples -nomake docs -nomake demo -no-nis -no-cups -no-iconv -no-dbus -no-openssl -xplatform qws/linux-arm-g++ -little-endian -qt-freetype -depths 16,18 -I/usr/local/tslib/include -L/usr/local/tslib/lib -v -D__ARM_ARCH_5TEJ__

配置二:

../4.6.3/configure -qt-kbd-tty -qt-gfx-linuxfb -no-gfx-transformed -no-gfx-multiscreen -qt-mouse-pc -no-gfx-qvfb -no-gfx-vnc -qt-kbd-tty -qt-gfx-linuxfb -no-gfx-qvfb -no-gfx-vnc -qt-mouse-tslib -no-glib -prefix /opt/qtopia -embedded arm -release -shared -fast -no-largefile -qt-sql-sqlite -no-qt3support -no-xmlpatterns -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-webkit -qt-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -make libs -nomake tools -nomake examples -nomake docs -nomake demo -no-nis -no-cups -no-iconv -no-dbus -no-openssl -xplatform qws/linux-arm-g++ -little-endian -qt-freetype -depths 16,18 -I/usr/local/tslib/include -L/usr/local/tslib/lib -v -D__ARM_ARCH_5TEJ__

指定交叉编译器后,没有提示任何错误!

阅读(3499) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-10-10 16:29:53

你好 我也遇到和你一样的问题 第5个问题你解决了吗 能不能告诉我解决办法啊 非常感谢你的帮助

chinaunix网友2010-08-02 10:18:04

非常感谢