在Linux上开发Qt for Symbian

对于诺基亚不提供在Linux环境下的Symbian SDK这件事情,我已经忍了很久了。现在它终于迈出了一小步。

Qt Labs终于在几天前推出了如何在Linux开发Qt for Symbian应用的一篇博客,需要自己从源代码编译Qt for Symbian的版本。实话说,还不是很方便。如果你不着急用,还是静待官方推出编译好的安装包吧,那时候跟编普通Qt for Linux应用没什么区别了,执行qmake;make就能搞定。如果你和我一样有编译狂躁症,或者build控,那么一起上路吧:)

老外文章得贝得贝说一大通,感觉步骤很多似的,其实没那么多。

预备条件:因为目前的Symbian SDK并非为Linux专用,而是直接借用了Windows版本的,所以为了保证SDK中的那些工具能够在Linux下使用,你需要先把Wine(Linux下的windows 模拟器)装上。

下载Symbian SDK

需要下载两个安装包,这里使用S60 5th版本,另外Qt需要open c & cpp的插件。下载地址分别为
S60第五版SDK下载
S60_Open_C插件下载

GNUPOC工具下载

gnupoc有点陌生,也是在Linux上开发symbian应用的核心组件。可以将gnupoc拆开成gnu-poc来理解,就是gnu下的epoc环境。利用该工具可以将我们从windows下下载的symbian sdk安装包解压安装到Linux环境中,GNUPOC下载地址为http://www.martin.st/symbian,选版本1.15即可。

Symbian SDK 安装配置

将上面下载的GNUPOC解压后,执行以下三条命令

cd gnupoc-package-1.15/sdk
./install_gnupoc_s60_50 ~/S60_5th_Edition_SDK_v1_0_en.zip ~/symbiansdk
./install_openc_16_s60 ~/work/s60_open_c_cpp_plug_in_v1_6_en.zip ~/symbiansdk

下载一个Symbian SDK的补丁文件,然后利用下面命令打上补丁

cd ~/symbiansdk
gunzip symbiansdk-gcce.gz
patch -p0 < symbiansdk-gcce

下载arm编译器

没有特别好说的,请下载arm-symbian编译器,然后解压

配置环境变量

将前面的安装好的SDK以及编译器中的一些工具,设置到个人用户的.bashrc中

export EPOCROOT=$HOME/symbian-sdk/
QTDIR=$HOME/build/qt
gcceDir= full/path/to/arm-2009q3/bin
export PATH=$QTDIR/bin:$EPOCROOT/epoc32/tools:$gcceDir:$PATH

开始编译吧

Qt源码需要用到即将发布的Qt-4.7-beta版,我是直接使用http://qt.gitorious.org/qt/qt代码仓库里的版本,然后在QTDIR目录下执行如下编译命令

$HOME/qt/configure -platform linux-g++ -xplatform symbian/linux-gcce -arch symbian -no-webkit -little-endian
make
cd src
make sis

===================我遇到的问题之分割线========================
1. configure时提示无法判断littel-endian还是big-endian
解决办法:在configure命令参数中加入-little-endian选项

2. 在调用rcomp生成symbian资源文件时提示”can’t write UIDs to s60main.rsc”
原因: 因为rcomp调用了另外一个应用uidcrc.exe,wine无法找到它(Shiroki@CuteQt有功于此)
解决方法: 将symbiansdk//epoc32/tools/uidcrc.exe拷贝.wine/drive_c/windows/system32目录下

3.编译的时候有两个文件提示TDesC等symbian标识符不认识
解决方法:给src/gui/kernel/qsoftkeymanager_s60_p.h和src/gui/kernel/qkeymapper_s60.cpp文件头部的地方,加入下面两行

#include <private/qcore_symbian_p.h>
#include <private/qt_s60_p.h>

Tags: , ,
This entry was posted on Tuesday, April 27th, 2010 at 4:24 PM and is filed under Linux技术, Qt技术, s60. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

16 Responses to “在Linux上开发Qt for Symbian”

  1. shiroki says:

    你遇到的问题1和2是同样的问题。 没有判断出endian也是因为test的过程中rsc文件没创建出来。
    第3个问题我没有遇到

  2. ttylikl says:

    cuteqt剥壳变漂亮了哦。。。

  3. Liang Qi says:

    1,2,3问题都没遇到,你好像有一步没做
    To make the buildsystem work smoothly we copy 3 utils into the ‘windows’ directory to make sure its always in the path; the make.exe, mifconv.exe and the uidcrc.exe files that are stored in the ~/symbian-sdk/epoc32/tools/ should be copied to ~/.wine/drive_c/windows/ dir.

    另外我这里运行analogclock不灵,configure时加上-nokia-developer就可以了,可能和DEF有关。

  4. shiroki says:

    嘿,这一步我做了,ms这个windows目录不知道为啥没在wine的path里,死活还是找不到那个udicrc.exe
    bug你试验的结果怎么样。

  5. Prout says:

    #include
    #include

    系统里没有这两个文件
    In file included from mediaplayer/s60mediaplayerservice.cpp:48:
    mediaplayer/s60videoplayersession.h:51: fatal error: AudioOutput.h: No such file or directory
    compilation terminated.
    make[3]: *** [.obj/debug-shared/s60mediaplayerservice.o] Error 1
    make[3]: Leaving directory `/home/prout/Qt-4.7.0/src/plugins/mediaservices/symbian’
    make[2]: *** [sub-symbian-make_default] Error 2
    make[2]: Leaving directory `/home/prout/Qt-4.7.0/src/plugins/mediaservices’
    make[1]: *** [sub-mediaservices-make_default] Error 2
    make[1]: Leaving directory `/home/prout/Qt-4.7.0/src/plugins’
    make: *** [sub-plugins-make_default-ordered] Error 2

  6. Prout says:

    也就是说缺少第五版的sdk plugin。但是官网上现在又下载不动了。你们怎么编译过的?

  7. Prout says:

    global/qglobal.cpp: In function ‘void qDebug(const char*, …)’:
    global/qglobal.cpp:2340: error: invalid initialization of reference of type ‘__va_list&’ from expression of type ‘void*’
    :0: error: in passing argument 1 of ‘void __builtin_va_start(__va_list&, …)’
    global/qglobal.cpp:2342: error: invalid initialization of reference of type ‘__va_list&’ from expression of type ‘void*’
    :0: error: in passing argument 1 of ‘void __builtin_va_end(__va_list&)’
    global/qglobal.cpp: In function ‘void qWarning(const char*, …)’:
    global/qglobal.cpp:2380: error: invalid initialization of reference of type ‘__va_list&’ from expression of type ‘void*’
    :0: error: in passing argument 1 of ‘void __builtin_va_start(__va_list&, …)’
    global/qglobal.cpp:2382: error: invalid initialization of reference of type ‘__va_list&’ from expression of type ‘void*’
    :0: error: in passing argument 1 of ‘void __builtin_va_end(__va_list&)’
    global/qglobal.cpp: In function ‘void qCritical(const char*, …)’:
    global/qglobal.cpp:2416: error: invalid initialization of reference of type ‘__va_list&’ from expression of type ‘void*’
    :0: error: in passing argument 1 of ‘void __builtin_va_start(__va_list&, …)’
    global/qglobal.cpp:2418: error: invalid initialization of reference of type ‘__va_list&’ from expression of type ‘void*’
    :0: error: in passing argument 1 of ‘void __builtin_va_end(__va_list&)’
    global/qglobal.cpp: In function ‘void qErrnoWarning(const char*, …)’:
    global/qglobal.cpp:2432: error: invalid initialization of reference of type ‘__va_list&’ from expression of type ‘void*’
    :0: error: in passing argument 1 of ‘void __builtin_va_start(__va_list&, …)’
    global/qglobal.cpp:2435: error: invalid initialization of reference of type ‘__va_list&’ from expression of type ‘void*’
    :0: error: in passing argument 1 of ‘void __builtin_va_end(__va_list&)’
    global/qglobal.cpp: In function ‘void qErrnoWarning(int, const char*, …)’:
    global/qglobal.cpp:2446: error: invalid initialization of reference of type ‘__va_list&’ from expression of type ‘void*’
    :0: error: in passing argument 1 of ‘void __builtin_va_start(__va_list&, …)’
    global/qglobal.cpp:2449: error: invalid initialization of reference of type ‘__va_list&’ from expression of type ‘void*’
    :0: error: in passing argument 1 of ‘void __builtin_va_end(__va_list&)’
    global/qglobal.cpp: In function ‘void qFatal(const char*, …)’:
    global/qglobal.cpp:2481: error: invalid initialization of reference of type ‘__va_list&’ from expression of type ‘void*’
    :0: error: in passing argument 1 of ‘void __builtin_va_start(__va_list&, …)’
    global/qglobal.cpp:2483: error: invalid initialization of reference of type ‘__va_list&’ from expression of type ‘void*’
    :0: error: in passing argument 1 of ‘void __builtin_va_end(__va_list&)’
    make[1]: *** [.obj/release-shared/qglobal.o] Error 1
    make[1]: Leaving directory `/home/prout/NokiaQtSDK/QtSources/4.7.0/src/corelib’
    make: *** [sub-corelib-make_default-ordered] Error 2

    一直提示这个错误,什么个情况?

    • 臭虫 says:

      没碰到这个错误啊,是不是得重编?

      • Prout says:

        我也很纳闷,这个错误是
        void qDebug(const char *msg, …)
        {
        va_list ap;
        va_start(ap, msg); // use variable arg list
        qt_message(QtDebugMsg, msg, ap);
        va_end(ap);
        }
        这出现的错误,但是这个类型转换是很标准的转换阿,我自己新建个工程测试了一下参数列表的用法也是能顺利编译通过的,但是当编译QT库的时候就提示出错了。

      • Prout says:

        你能把你的环境变量发一下么。我怀疑我改到系统的环境变量了。。

      • Prout says:

        PATH=/usr/lib/mpi/gcc/openmpi/bin:/sbin:/usr/sbin:/usr/local/sbin:/opt/kde3/sbin:/home/prout/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin;/home/prout/NokiaQtSDK/QtSources/4.7.0/include:/home/prout/NokiaQtSDK/QtSources/4.7.0/lib:/home/prout/NokiaQtSDK/QtSources/4.7.0/bin:/home/prout/symbiansdk/epoc32/tools:/home/prout/NokiaQtSDK/arm-2009q3/bin

        这个是我的

      • Prout says:

        我重新安装了一遍symbiansdk,原来的错误居然就过了。实在不知道是什么情况。但是现在编译过程中总是会出现e32def.h e32std.h not found等错误,我把源文件中的include 改成绝对路径又能编译过了,但在编译过程中又出现了其他地方的not found,所以这个问题不能通过单纯的修改源文件解决,在makefile文件配置里的路径也是正确的,文件也确实存在,但是当编译的时候它就not found 不知道各位达人根据以前的经验有没有什么好的解决方法。我在这个地方头疼好多次了,以前在windows下的时候也是这个问题,忘记怎么解决的了突然就好了。望有人能指点一二,在此谢过了!

  8. Prout says:

    export EPOCROOT=$HOME/symbian-sdk/

    最后一个斜杠惹的祸阿!!!生成makefile的时候居然不会自己添加斜杆。。郁闷!

  9. Prout says:

    executing elf2e32.exe
    Elf2e32: Warning: New Symbol _ZTI15QAccessibleDial found, export(s) not yet Frozen
    Elf2e32: Warning: New Symbol _ZTI15QAccessibleMenu found, export(s) not yet Frozen
    Elf2e32: Warning: New Symbol _ZTI17AccessibleFactory found, export(s) not yet Frozen
    Elf2e32: Warning: New Symbol _ZTI17QAccessibleButton found, export(s) not yet Frozen
    Elf2e32: Warning: New Symbol _ZTI17QAccessibleHeader found, export(s) not yet Frozen
    Elf2e32: Warning: New Symbol _ZTI17QAccessibleSlider found, export(s) not yet Frozen
    Elf2e32: Warning: New Symbol _ZTI17QAccessibleTabBar found, export(s) not yet Frozen
    Elf2e32: Warning: New Symbol _ZTI18QAccessibleDisplay found, export(s) not yet Frozen
    Elf2e32: Warning: New Symbol _ZTI18QAccessibleItemRow found, export(s) not yet Frozen

    现在显示的是编译完成了,但是有很多东西看起来都没有编译阿?

    还有在make sis 的时候 QT/src 目录下没有生成pkg,在s60install下生成pkg了

    这有问题吧?

Leave a Reply