Chinaunix首页 | 论坛 | 博客
  • 博客访问: 210426
  • 博文数量: 145
  • 博客积分: 3000
  • 博客等级: 中校
  • 技术积分: 1720
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-14 18:42
文章分类

全部博文(145)

文章存档

2011年(1)

2009年(144)

我的朋友

分类: LINUX

2009-07-22 19:23:17

by tangke <> 2009-06-03

Qt-embedded 交叉编译mipsel版本,用于在龙芯电脑上面跑
Qt-embedded:4.4.3
交叉编译器:mipsel-linux-gnu-gcc 4.3
操作系统是debian lenny vmware
cp qt-embedded-opensource-4.4.3.tar.gz ~/
tar –zxvf qt-embedded-opensource-4.4.3.tar.gz
cd qt-embedded-opensource-4.4.3
cd mkspecs/qws/Linux-mips-g++
vi qmake.conf
将其中带有mipsel-linux-g??的部分前面改成mipsel-linux-gnu-g??,如果mipsel-linux-gnu-g??的目录没有添加到PATH的话,还需要在前面加上路径。
回到qt-embedded-opensource-4.4.3目录下
运行./configure –no-qvfb –xplatform qws/Linux-mips-g++ -embedded mips -little-endian –release
make
编译完成后运行 make install进行安装,默认安装到/usr/local/Trolltech/QtEmbedded-4.4.3-mips
ps:没有想到新的QT-Embedded库这么大。整个压缩包只有100多M。可以编译完成后竟然占用了1.6G的空间 !编译之前一定要注意,留下足够空间。
编译过程中产生了大量的.o文件。安装完成后make clean一下好了,太占地方了。

2009-05-10

今天在bbs上面看到有人在问编译qt-embedded-4.5.1的问题,好奇,自己也下载了一个通过交叉编译器编译mipsel版本。等到编译完了的时候就把这些编译之后的东西保存起来,不然每次去编译,效率比较低。

下面是编译过程碰到的问题以及解决办法:

target:mipsel[loongson]
host:x86
1.Qt-embedded-sourcecode-src.4.4.3:
./configure -no-stl -no-xmlpatterns -no-phonon -no-phonon-backend -no-svg -no-webkit -no-openssl -no-nis -no-cups -no-iconv -no-pch -nomake examples -no-separate-debug-info -no-libjpeg -no-libmng -no-libpng -no-libtiff -no-gif -no-qt3support -no-accessibility -no-largefile -fast


交叉编译过程:
首先通过X86平台上面gcc编译出rcc,moc,uic等等一些工具,因为在以后的qt程序编译中会用到以上这些工具,当然了编译以上这些工具的时候使用的还是宿主机上面的库。
注1:
因为整个系统编译出来的应该是一些目标机的可执行库,以及一些目标机的二进制代码,但是并没有目标机的编译环境,这一点一定要理解,也就是说,以后这个二进制代码程序需要修改的话,我们还是需要在宿主机上面进行修改,然后编译,然后下载或者烧到目标机里面去。
注2:
在上面的./configure参数中加入-xplatform qws/linux-mips-g++ -embedded mips就进行交叉编译了,但是千万不能使用-arch mips参数,因为这样的话,宿主机就被你定义成了mips了,在后面会显示如下
Building on:   qws/linux-x86-g++
Building for: qws/linux-mips-g++
Architecture: mips
Host architecture: i386
注3:
在编译到src/gui/painting的时候会发现一个错误,就是找不到zlib.h文件,需要修改src/gui/Makefile,在INCPATH 变量中加入-I../3rdparty/zlib/就可以了。
注4:
在mkspecs/qws/linux-mips-g++/目录里面修改qmake-conf文件,将16行的MAKE_CFLAGS         = -pipe -mips32
修改成MAKE_CFLAGS         = -pipe。不然的话在龙芯上面跑不起来
注5:
为了缩短编译时间,很多库都没有编译进去,比如png引擎,所以在里面demos中显示不出png图像。具体需要哪些库可以根据configure来设定。
2.Qtopia-opensource-4.3.2
mkdir build
cd build
../qtopia-opensource-4.3.2/configure -xplatform linux-mips-g++ -no-strict-warnings -no-ssl -no-sxe -no-bluetooth -no-infrared -no-dbus -no-drm -no-v4l2 -no-telephony -no-modem -no-qtopiamedia -no-libamr -force-quicklaunch -no-clean
分成两部分,一部分是Host,一部分是Target
Host:
*******************************************************************************
Configuring Qt (host)
configure -platform linux-g++ -no-stl -no-exceptions -fast -D
QTOPIA_NO_ICONV_OPEN_ERRORS -confirm-license -no-sql-ibase -no-sql-mysql
-no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -qt-sql-sqlite
-no-qdbus -no-openssl -prefix /home/tangk/build/qtopiacore/host -release
-qt-gif -no-separate-debug-info
*******************************************************************************

Setting up the include directory for Qt (host). Please wait...


Preparing build tree...
You are licensed to use this software under the terms of either
the Q Public License (QPL) or the GNU General Public License (GPL)
versions 2 or 3


Creating qmake. Please wait...

Build type:   linux-g++
Architecture: i386


*******************************************************************************
Qt (host) is configured
*******************************************************************************
Target:
*******************************************************************************
Configuring Qtopia Core (target)
configure -embedded mips -platform linux-g++ -xplatform qws/linux-mips-g++
-DQTOPIA_NO_ICONV_OPEN_ERRORS -prefix /home/tangk/build/qtopiacore/target -make
src -make tools -no-stl -no-exceptions -no-qt3support -no-glib -no-cups
-no-qdbus -no-accessibility -DQT_QWS_DISABLE_FLUSHCLIPPING -confirm-license
-depths 8,16,18,24,32 -qconfig qpe -DQT_NO_PLUGIN_CHECK
-DQT_EXTERNAL_SOUND_SERVER -DQT_QWS_KEYEVENT_SINGLECLIENT -no-sql-ibase
-no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2
-qt-sql-sqlite -release -no-gfx-qvfb -no-mouse-qvfb -no-kbd-qvfb -qt-gif
-no-separate-debug-info -no-openssl -DQT_KEYPAD_NAVIGATION -little-endian
*******************************************************************************

Setting up the include directory for Qtopia Core (target). Please wait...


Preparing build tree...
You are licensed to use this software under the terms of
the GNU General Public License (GPL) versions 2 or 3.


Creating qmake. Please wait...

The system floating point format could not be detected.
This may cause data to be generated in a wrong format
Turn on verbose messaging (-v) to see the final report.

Building on:   linux-g++
Building for: qws/linux-mips-g++
Architecture: mips
*******************************************************************************
Qtopia Core (target) is configured
*******************************************************************************

Start Make:
make
make install
这个地方前期不能直接make install,因为content_installer程序还没有编译完成。
注1:
/home/tangk/qtopia-opensource-4.3.2/qtopiacore/qt/src/corelib/arch/mips/qatomic32.s:9: Error: opcode not supported on this processor: mips1 (mips1) `ll $8,0($4)'
/home/tangk/qtopia-opensource-4.3.2/qtopiacore/qt/src/corelib/arch/mips/qatomic32.s:12: Error: opcode not supported on this processor: mips1 (mips1) `sc $2,0($4)'
/home/tangk/qtopia-opensource-4.3.2/qtopiacore/qt/src/corelib/arch/mips/qatomic32.s:24: Error: opcode not supported on this processor: mips1 (mips1) `ll $8,0($4)'
/home/tangk/qtopia-opensource-4.3.2/qtopiacore/qt/src/corelib/arch/mips/qatomic32.s:27: Error: opcode not supported on this processor: mips1 (mips1) `sc $2,0($4)'
/home/tangk/qtopia-opensource-4.3.2/qtopiacore/qt/src/corelib/arch/mips/qatomic32.s:32: Error: opcode not supported on this processor: mips1 (mips1) `sync'
/home/tangk/qtopia-opensource-4.3.2/qtopiacore/qt/src/corelib/arch/mips/qatomic32.s:40: Error: opcode not supported on this processor: mips1 (mips1) `sync'
/home/tangk/qtopia-opensource-4.3.2/qtopiacore/qt/src/corelib/arch/mips/qatomic32.s:41: Error: opcode not supported on this processor: mips1 (mips1) `ll $8,0($4)'
以上问题在交叉编译基于mips指令集的龙芯cpu的时候会出现错误。
修改如下:
打开qatomic32.s文件,在文件前面加上
.set mips3
注2:
/home/tangk/qtopia-opensource-4.3.2/qtopiacore/qt/src/gui/painting/qdrawhelper.cpp:5910: error: explicit template specialization cannot have a storage class
/home/tangk/qtopia-opensource-4.3.2/qtopiacore/qt/src/gui/painting/qdrawhelper.cpp:5934: error: explicit template specialization cannot have a storage class
该问题主要是因为交叉编译器版本过高而导致的问题,具体修改办法可以看下面的gcc官方说明。
注3:
在编译到/home/tangk/build/src/server的时候出现如下问题
/usr/mipsel-linux-gnu/include/c++/4.3.1/bits/locale_classes.tcc:102: error: ‘dynamic_cast_not_allowed’ was not declared in this scope
修改办法:
Vi /home/tangk/build/src/server/Makefile.target的DEFINES里面删除以下信息-Ddynamic_cast=dynamic_cast_not_allowed
该问题详细解决办法见下面的”Building Qtopia on Debian”
Building Qtopia on Debian
On Tuesday 12 August 2008, Bill KING wrote: > Okay, dynamic_cast is a core piece of the c++ language, so unless > your compiler is massively broken, then it shouldn't stumble there. The compiler (gcc 4.3.1) is fine... > Maybe some copypasta of the error messages, and we can possibly get a > wee bit more insight? and it's not the compiler itself causing the problem, but rather a define in all the Makefile.target files that causes this option -Ddynamic_cast=dynamic_cast_not_allowed
to be passed to the compiler. Presumably this is intentional and the compiler predicably bails out when it does run into a dynamic_cast. I don't remember the precise files, something related to encodings or localization, I think, but there's a difference between gcc/g++ 4.3 and 4.2 in that 4.3 uses a dynamic_cast whereas 4.2 does not. Besides, there are several easily repaired problems where 4.3 complains about storage classes (static) for template specializations. So, I'm hopeful that I can get Qtopia compiled with g++ 4.2 or some still older version, if only I can find out how to tell the build system to use a specific version. Michael -- Michael Schuerig mailto:michael at schuerig.de
Gcc 官方说明
Explicit template specialization cannot have a storage class
Specializations of templates cannot explicitly specify a storage class, and have the same storage as the primary template. This is a change from previous behavior, based on the feedback and commentary as part of the ISO C++ Core Defect Report 605.
template   static void foo(); template<>   static void foo();   Gives:
error: explicit template specialization cannot have a storage class This also happens with the externspecifier. Fixing this is easy: just remove any storage specifier on the specialization. Like so:
template   static void foo(); template<>   void foo();
3.嵌入式Qt版本说明
  在Qt/Embedded版本4之前,Qt/Embedded和Qtopia是两套不同的程序,Qt/Embedded是基础类库,Qtopia是构建于 Qt/Embedded之上的一系列应用程序。但从版本4开始,Trolltech将Qt/Embedded并入了Qtopia,并推出了新的 Qtopia4。在该版中,原来的Qt/Embedded被称为Qtopia Core,作为嵌入式版本的核心,既可以与Qtopia配合,也可以独立使用。原来的Qtopia则被分成几层,核心的应用框架和插件系统被称为 Qtopia Platform,上层的应用程序则按照不同的目标用户分为不同的包,如Qtopai PDA,Qtopia Phone等。
  现在在网络上下载的Qtopia core 就等于Qt-embedded。

4.Qtopia如何使用
export QWS_SIZE=480x640
阅读(2458) | 评论(0) | 转发(0) |
0

上一篇:linux thread program

下一篇:normal:x11vnc debug

给主人留下些什么吧!~~