Qt for symbian环境搭建(Linux)

Programming your application or library based on Qt has always had the promise that you can deploy your application on many different platforms. Development of those applications can, likewise, happen on many different platforms. QtCreator runs on Windows, Mac & Linux among others.

Qt很简单,易用,跨平台特性尤其吸引人。


Since Qt4.6 Symbian is also one of those platforms to deploy on, your Qt apps can run on one of the many many Symbian based phones already out there.

Qt4.6之后,Qt程序可以运行在多种基于Symbian设备上。


For developers to be able to deploy to Symbian there was one problem, you’d have to use Windows as your development platform. Here in Qt Development Frameworks we recognize that a large amount of development is done on Linux. Especially open source developers have made the point that developing Symbian applications should work on Linux.

以前只能在Windows上开发,现在许多开发者把它移植到了Linux上,你可以在Linux上进行Qt for Symbian开发了。

 

So, today, I’m happy to announce that developing Qt applications for the Symbian platform is possible on Linux with the upcoming Qt4.7. This will be experimental for now. Please give feedback on how well it works for you!

What this means is that developers using a Linux system can use a freely available cross-compiler and the also freely available Symbian tools to create applications for a Symbian based phone.
Developers that are working on Qt itself will now be able to do so on Linux too.

今天就来介绍下这方面的内容。

 

Preparing with a Qt compile
Symbian has a bad reputation of ease of development, you would be excused if you think ‘preparing’ means something along the lines of including some soul-searching and prayer. That’s all to change, I’m convinced, with Qt entering this arena.

Symbian难开发,Qt则改变了这一切。


The preparations here are essentially the download of the required tools.

 

First you need to compile Qt for Symbian. This is a step you would be able to avoid after the final 4.7 is out and you can just download a binary. You can either use the upcoming Qt47-beta or clone the git repository; http://qt.gitorious.org/qt/qt

第一,编译Qt for Symbian。

 

 

Second we need a compiler that can cross compile to the arm instruction set which is what phones use; there are two compilers that are known to work, the rvct-2.2 compiler and gcce. As rvct is not freely available I’ll focus purely on gcce here. Gcce can be found at http://www.codesourcery.com the “Sourcery G++ Lite Edition” is what you are looking for. Direct link

第二,我们需要一个编译器,RVCT不免费,我们使用GCCE。

 

Since we are going to compile for a Symbian platform, we need to download the headers and libraries etc to link to. The things we need are included in the “S60 5th Edition SDK for Symbian OS
Apologies for the requirement to register there.

From the same site we need s60_open_c_cpp_plug_in_v1_6_en.zip

These downloads were created for Windows users and as such we need to massage it a bit to be useful for Linux use. We do NOT use the setup.exe included in there, instead the way to do this is to use the gnupoc package;

现在,我们需要S60 SDK等头文件和库,但是我们不使用.exe安装,而使用gnupoc来安装它。

 

http://www.martin.st/symbian/ version 1.15 worked for me.
After making sure the Linux command ‘patch’ is available on your system and unpacking the gnupoc archive you can
cd gnupoc-package-1.15/sdk
./install_gnupoc_s60_50 ~/S60_5th_Edition_SDK_v1_0_en.zip ~/symbian-sdk

and
./install_openc_16_s60 ~/work/s60_open_c_cpp_plug_in_v1_6_en.zip ~/symbian-sdk

确定自己的系统中patch命令可用,解压gnupoc包,运行上面两个命令。

 

Last step is to download this symbiansdk-gcce.diff.gz and after unzipping apply it to your new ~/symbian-sdk directory using;
cd ~/symbian-sdk
patch -p0 < symbiansdk-gcce.diff

最后,下载symbiansdk-gcce.diff.gz包,解压到~/symbian-sdk目录,执行上面的命令。

 

 

 

The next step is to install ‘wine’ to run some of the tools. Your Linux distro likely has it, so use your distro package manager to install it.
Check with ‘wine ~/symbian-sdk/epoc32/tools/unzip.exe‘ to see if it works. You should get the help message from ‘unzip’ after calling the above command.

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.
The running of ‘unzip.exe’ above should have taken care of creating the ‘windows’ dir.

Setup environment
we need to export some variables; you likely want to add these lines to your $HOME/.bashrc or similar.
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

Compile Qt; call configure and ‘make’.
It is strongly suggested to do out-of-source building. Also called ’shadowbuilds’. This leaves the source tree free from any auto-generated files. So we do that here.
In the first step you downloaded the Qt sources, probably in a directory like $HOME/qt Go ahead and create a new directory called $HOME/build/qt, then cd into that newly created directory and run;
$HOME/qt/configure -platform linux-g++ -xplatform symbian/linux-gcce -arch Symbian -no-webkit
make
cd src
make sis

When all this went well you should have a Qt.sis in your build/qt/lib/ dir. Read on for what that gives you.

What next?
a file with extension .sis or .sisx are essentially installer packages that Symbian devices take. You can use a usb cable or other means to get a sis file onto your device and then click on the file in a filebrowser to install it.
Qt has some dependencies that you may want to install first, if you skip this part your apps likely just crash at startup. Be warned :)
The follwing sis files are present in the symbian-sdk you downloaded before, so you can copy them to the device and should install them all.
nokia_plugin/openc/s60opencsis/openc_ssl_s60_1_6_ss.sis
nokia_plugin/openc/s60opencsis/pips_s60_1_6_ss.sis
nokia_plugin/opencpp/s60opencppsis/stdcpp_s60_1_6_ss.sis

On top of that you might want to install these for debugging purposes;
nokia_plugin/openc/s60opencsis/stdioserver_s60_1_6_ss.sis

If we really want to actually see some results, go to an example and install that one too;
cd ~/build/qt/examples/widgets/wiggly
make sis

and then install the wiggly.sis on your device like above. You should find a new folder with “QtExamples” where it can be started from.

Extra targets and Qt docs
As noted above; the Symbian based qmake generates a Mkefile that has an extra target called ’sis’. More commands will likely be added later, but this is the essential one for now.
More info about Qt at; http://doc.trolltech.com/4.7-snapshot/how-to-learn-qt.html

What’s still missing
This is not finished in the way that we’ll stop working on this, there are too many steps still in the above instructions. This has to get easier still, we’ll keep working on that. If you hit any issues that took longer than needed to figure out, please tell us in a comment :)

One known issue is that Symbian has a different way of doing binary compatibility; one that is not implemented in this buildsystem yet. In other words; you need to build any application against the exact same build of Qt as you have on the device.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值