主题 : 多线程的编译问题。 复制链接 | 浏览器收藏 | 打印
三人行
级别: 侠客
UID: 13052
精华: 0
发帖: 71
金钱: 355 两
威望: 71 点
综合积分: 142 分
注册时间: 2010-01-18
最后登录: 2014-11-16
楼主  发表于: 2010-03-18 11:10

 多线程的编译问题。

牛人版主提到的:

进入qtopia-2.2.0-FriendlyARM/qt2目录,清除之前编译生成的文件然后手动配置qt embedded以支持multi-thread:
$cd qt2
$make clean
$echo yes |./configure -embedded -no-xft -qconfig qpe -depths 16,32 -system-jpeg -gif -thread

注 意configure之后的参数与x86-qtopia或者arm-qtopia目录下的“build“脚本里的”echo yes | ./configure -qte“之后的参数保持一致, 只是在最后加上"-thread"

这个标记处的命令到底应该是什么样子的啊。
我的根据build脚本的内容,写成如下的命令,
echo yes | ./configure -qte '-embedded -no-xft -qconfig qpe -depths 16,32 -system-jpeg -gif' -qpe '-edition pda -displaysize 240x320  -fontfamilies "helvetica fixed micro smallsmooth smoothtimes"' -qt2 '-no-opengl -no-xft' -dqt '-no-xft -thread' -thread

对么?
问题很幼稚,请大家帮忙。
三人行
三人行
级别: 侠客
UID: 13052
精华: 0
发帖: 71
金钱: 355 两
威望: 71 点
综合积分: 142 分
注册时间: 2010-01-18
最后登录: 2014-11-16
1楼  发表于: 2010-03-18 11:29
我按照上面的方法,在当前目录中产生的src-mt.mk文件只有以下内容

all:
    @echo "(not building threaded Qt)"
三人行
三人行
级别: 侠客
UID: 13052
精华: 0
发帖: 71
金钱: 355 两
威望: 71 点
综合积分: 142 分
注册时间: 2010-01-18
最后登录: 2014-11-16
2楼  发表于: 2010-03-18 11:32
提示信息如下

[root@tom qt2]# echo yes | ./configure -qte '-embedded -no-xft -qconfig qpe -depths 16,32 -system-jpeg -gif' -qpe '-edition pda -displaysize 240x320  -fontfamilies "helvetica fixed micro smallsmooth smoothtimes"' -qt2 '-no-opengl -no-xft' -dqt '-no-xft -thread' -thread
-qte: unknown argument
-embedded -no-xft -qconfig qpe -depths 16,32 -system-jpeg -gif: unknown argument
-qpe: unknown argument
-edition pda -displaysize 240x320 -fontfamilies "helvetica fixed micro smallsmooth smoothtimes": unknown argument
-qt2: unknown argument
-dqt: unknown argument

This is the Qt Free Edition.

You are licensed to use this software under the terms of either
the Q Public License (QPL) or the GNU General Public License (GPL).

Type 'Q' to view the Q Public License.
Type 'G' to view the GNU General Public License.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.

Do you accept the terms of the license?

Usage: ./configure [-debug] [-release] [-shared] [-static] [-gif] [-no-gif] \
          [-sm] [-no-sm] [-thread] [-no-thread] [-qt-zlib] [-system-zlib] \
          [-qt-libpng] [-system-libpng] [-no-jpeg] [-system-jpeg] \
          [-no-<module>] [-kde] [-Istring] [-Lstring] [-Rstring] [-lstring]

The defaults (*) are usually acceptable.  Here is a short explanation of
each option:

*  -release ........... Compile and link Qt with debugging turned off.
    -debug ............. Compile and link Qt with debugging turned on.

*  -shared ............ Create and use a shared Qt library (libqt.so)
    -static ............ Create and use a static Qt library (libqt.a)

*  -no-gif ............ Do not compile in GIF reading support.
    -gif ............... Compile in GIF reading support. See src/kernel/qgif.h

*  -no-sm ............. Do not support X Session Management.
    -sm ................ Support X Session Management, links in -lSM -lICE.

*  -no-thread ......... Do not compile with Threading Support
    -thread ............ Compile with Threading Support

*  -qt-zlib ........... Use the zlib bundled with Qt.
    -system-zlib ....... Use a zlib from the operating system
                         http://www.info-zip.org/pub/infozip/zlib

*  -qt-libpng ......... Use the libpng bundled with Qt.
    -system-libpng ..... Use a libpng from the operating system.
                         See http://www.libpng.org/pub/png

*  -no-mng ............ Do not compile in MNG I/O support.
    -system-libmng ..... Use libmng from the operating system.
                         See http://www.libmng.com

*  -no-jpeg ........... Do not compile in JPEG I/O support.
    -system-jpeg ....... Use jpeglib from the operating system.
                         See http://www.ijg.org

*  -no-nas-sound ...... Do not compile in NAS sound support.
    -system-nas-sound .. Use NAS libaudio from the operating system.
                         See http://radscan.com/nas.html

    -no-<module> ....... Disables a module, where module can
                         can be one of: opengl table network canvas

    -kde ............... Builds the Qt Designer with KDE 2 support, so that
                         KDE 2 widgets can be used directly in
                         the Qt Designer. $KDEDIR must be
                         set to point to a KDE 2 installation.
                         See http://www.kde.org

    -tslib ............. Enable TSlib (touchscreen library) mouse handler.
                         See http://arm.linux.org.uk            

    -no-g++-exceptions . Disable exceptions on platforms using the GNU C++
                         compiler by using the -fno-exceptions flag.

    -no-xft ............ Disable support for Anti-Aliased fonts through the
                         Xft extension library (XFree86 4.0.2 and newer).
    -xft ............... Enable support for Anti-Aliased fonts.

                         Xft support is auto-detected, but you may use these
                         flags to explicitly enable/disable support.

    -platform target ... The platform you are building on (linux-g++)
    -xplatform target .. The platform when cross-compiling.

                         See the PLATFORMS file for a list of supported
                         operating systems and compilers.

    -Istring ........... Add an explicit include path.
    -Lstring ........... Add an explicit library path.
    -Rstring ........... Add an explicit dynamic library runtime search path.
    -lstring ........... Add an explicit library.


Qt/Embedded only:

    -embedded .......... Enable building of Qt/Embedded.

    -qconfig local ..... Use src/tools/qconfig-local.h rather than the
                         default (qconfig.h).

    -depths list ....... Comma-separated list of supported bit-per-pixel
                         depths, from:  v, 4, 8, 16, 18, 24, and 32.  'v' is VGA16.

    -accel-snap ........ Enable SciTech SNAP Graphics acceleration.
    -accel-voodoo3 ..... Enable Voodoo3 acceleration.
    -accel-mach64 ...... Enable Mach64 acceleration.
    -accel-matrox ...... Enable Matrox MGA acceleration.
    -qvfb .............. Enable X11-based Qt Virtual Frame Buffer.
    -vnc ............... Enable VNC server (requires network module).
    -keypad-mode ....... Enable keypad widget navigation.
    -keypad-input ...... Include keypad keys.
三人行
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2010-03-18 12:14

 回 楼主(xinlan_al) 的帖子

我的意思是,你可以根据原来build里的
echo yes | ./configure -qte '-embedded -no-xft -qconfig qpe -depths 16,32 -system-jpeg -gif' -qpe '-edition pda -displaysize 240x320  -fontfamilies "helvetica fixed micro smallsmooth smoothtimes"' -qt2 '-no-opengl -no-xft' -dqt '-no-xft -thread'

在qt2目录下用
echo yes | ./configure -embedded -no-xft -qconfig qpe -depths 16,32 -system-jpeg -gif -thread

事实上,build脚本里的-qte 'XXX', XXX就是传递给qt2/configure的参数,只是我们现在需要给qt2/configure多传一个"-thread".至于为什么,看

*  -no-thread ......... Do not compile with Threading Support
    -thread ............ Compile with Threading Support

就知道了。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
Eddy Lau (Sun Boy)
级别: 圣骑士
UID: 11202
精华: 1
发帖: 364
金钱: 1885 两
威望: 380 点
综合积分: 748 分
注册时间: 2009-11-30
最后登录: 2010-04-12
4楼  发表于: 2010-03-18 12:17

 回 2楼(xinlan_al) 的帖子

如果不想自寻烦恼, 有一简单方法可在Qt内调用多线程.

详情可参阅以下帖子第21楼至27楼小弟与381762390网友的对话:
http://www.aiothome.net/read.php?tid-4027-fpage-0-toread--page-3.html
  
為什麼生世間上 此間許多哀與傷 為什麼爭鬥不絕 歡欣不永享 
問為何人存隔膜 顏面無真相 問那天可找得到 理想中的烏托幫 
三人行
级别: 侠客
UID: 13052
精华: 0
发帖: 71
金钱: 355 两
威望: 71 点
综合积分: 142 分
注册时间: 2010-01-18
最后登录: 2014-11-16
5楼  发表于: 2010-03-18 14:28

 回 4楼(eddylau) 的帖子

eddylau版主,我按照你的方法,x86程序,仍然无法编译通过,不过arm程序可以编译通过这是怎么回事?
x86编译时,提示下面的问题:
g++  -o template .obj/release-shared/template.o .obj/release-shared/main.o .obj/release-shared/template_base.o .obj/release-shared/moc_template.o .obj/release-shared/moc_template_base.o   -lqtopia2 -lqtopia -lqpe -L/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/lib -L/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/lib -lqte-mt -lpthread
/usr/bin/ld: cannot find -lqte-mt
collect2: ld returned 1 exit status
make: *** [template] Error 1

同时我也将/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia /mkspecs/qws/linux-arm-g++/qmake.conf这个档案内的:QMAKE_LIBS_QT_THREAD= -lqte-mt
改为:QMAKE_LIBS_QT_THREAD=

也不起作用。在x86下应该如何实现呢。
三人行
Eddy Lau (Sun Boy)
级别: 圣骑士
UID: 11202
精华: 1
发帖: 364
金钱: 1885 两
威望: 380 点
综合积分: 748 分
注册时间: 2009-11-30
最后登录: 2010-04-12
6楼  发表于: 2010-03-18 15:42

 Re:回 4楼(eddylau) 的帖子

引用第5楼xinlan_al于2010-03-18 14:28发表的 回 4楼(eddylau) 的帖子 :
同时我也将/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia /mkspecs/qws/linux-arm-g++/qmake.conf这个档案内的:QMAKE_LIBS_QT_THREAD= -lqte-mt
改为:QMAKE_LIBS_QT_THREAD=

也不起作用。在x86下应该如何实现呢。

既然是要编译x86, 为何要用linux-arm-g++呢?

请更改linux-generic-g++的qmake.conf档案.

/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia /mkspecs/qws/linux-generic-g++/qmake.conf这个档案内的:QMAKE_LIBS_QT_THREAD= -lqte-mt
改为:QMAKE_LIBS_QT_THREAD=

学习一定要能触类旁通, 硬套用是不行的!
為什麼生世間上 此間許多哀與傷 為什麼爭鬥不絕 歡欣不永享 
問為何人存隔膜 顏面無真相 問那天可找得到 理想中的烏托幫 
三人行
级别: 侠客
UID: 13052
精华: 0
发帖: 71
金钱: 355 两
威望: 71 点
综合积分: 142 分
注册时间: 2010-01-18
最后登录: 2014-11-16
7楼  发表于: 2010-03-18 18:09

 Re:Re:回 4楼(eddylau) 的帖子

引用第6楼eddylau于2010-03-18 15:42发表的 Re:回 4楼(eddylau) 的帖子 :

既然是要编译x86, 为何要用linux-arm-g++呢?

请更改linux-generic-g++的qmake.conf档案.

.......

谢谢eddylau版主指导。非常感谢。
三人行
三人行
级别: 侠客
UID: 13052
精华: 0
发帖: 71
金钱: 355 两
威望: 71 点
综合积分: 142 分
注册时间: 2010-01-18
最后登录: 2014-11-16
8楼  发表于: 2010-03-19 15:52

 回 6楼(eddylau) 的帖子

eddylau版主。 再次感谢您一下。真是非常非常感激啊。
无法用语言形容的感激啊。
三人行