感谢支持
我们一直在努力

在Linux上进行Symbian开发的实验性包

之前我们写过一篇如何 在Linux上进行Symbian开发的文章。但是,过程有些复杂并且需要大量的手工设置。现在我们根据相同的方法更进一步,这里我们提供了预打包的环境,完整地包含了编译器、库以及您开始开发所需要的所有东西!
在这里我有义务向您报告我们的免责声明:Nokia 完全不支持这些包。它们只是基于“最好地努力”而提供的,并且不能保证在您的系统中可以正常工作!另外请注意这里并不保证之后我们会对这些包进行更新,并且以后我们也许会切换到另外一种发布格式,例如通过Qt SDK。
另外,目前您还不能使用如下方式在N8上进行开发,因为在N8上现在还不能安装Qt 4.7.1。当N8收到它的第一个手机更新的时候,它将会被升级到Qt 4.7.1,然后您就可以把您的应用发布到它上面了。
现在,把上述事情放在一边,让我们来享受乐趣吧!
我自己作为一个Gentoo  Linux用户,很自然地就从构建ebuild(Gentoo中的一种包描述文件)开始。对于不太熟悉Gentoo的朋友,它并不是真正的包,而只是一些如何安装包的配方。在这种方法下绝大部分包都是从源代码编译而得到的,但这并不是严格必需的,因为您的配方也可以包含一些指向已经预编译好的二进制的参考。这样做对于我的好处是通过创建这些构建包的配方,我可以使用同样的配方创建Debian包,因此我只付出了一份的代价就得到了两种包!
所以换句话说,这里提供的包类型有Gentoo的ebuild和Debian的.deb包。RPM用户应该可以通过 alien使用.deb包。
更新:  一位Troll同事很友好地提供了基于Fedora的RPM包,所以RPM用户就不再需要使用alien了! (译者注:在原Trolltech或者现在Qt,Nokia开发Qt的开发人员一般自称Troll。)
对于Debian(和Ubuntu)用户:下载并且安装下列包(仅提供32位版本):


  • gcce-4.4.172-r1.deb
  • s60-sdk-5.0.deb
  • runonphone-4.7.1.deb
  • qt-symbian-libs-4.7.1-r1.deb (旧版本:qt-symbian-libs-4.7.1.deb)
对于RPM(Fedora)用户:下载并且安装下列包(仅提供32位版本):


  • gcce-4.4.172-1.fc13.i686.rpm
  • s60-sdk-5.0-1.fc13.i686.rpm
  • runonphone-4.7.1-1.fc13.i686.rpm
  • qt-symbian-libs-4.7.1-1.fc13.i686.rpm
对于Gentoo用户:


  • 如果您还没有安装layman,那么请安装它,使用 emerge -av layman
  • layman -o http://qt.gitorious.org/qt-labs/ … er/repositories.xml -L (首先我们需要列出安装仓库让layman知道哪些是可用的)
  • layman -o http://qt.gitorious.org/qt-labs/ … er/repositories.xml -A qt-symbian-overlay
  • 为了说明您要接受哪种协议,请把 ACCEPT_LICENSE=”nokia-eula sourcery-g++” 添加到 /etc/make.conf
  • emerge -av qt-symbian-libs
对于所有用户:
在安装完之后,请重新打开您的控制台或者(重新启动)来包含由这些包所导致的环境变化。
还有一些软件是手机本身所需要的,很不走运,没有任何方法来自动化这一过程。您需要检查的第一件事情是您是否有App TRK;一些手机已经内置了,但绝大多数手机没有。通过如下方式可以很简单地检查:


  • 通过USB线把您的手机和计算机连接起来。
  • 如果出现了带有“Debug Services are available”的文字,那么App TRK已经内置在您的手机中了。
  • 如果不是上述情况,那么请根据Qt文档:App TRK的指示安装它。
另外,还有一些库需要安装。


  • 您可以进入“Application Manager”(程序管理器)查看您的手机是否包含所需的软件。对于大多数手机来说它在主菜单的“Settings”(设置)或者主菜单的“Applications”(应用程序)中。
  • 请查找“PIPS Installer”和“Standard C++ library Common”。如果它们都至少是1.06版本的,那么就不用再安装了。
  • 否则,您需要从这里下载并且安装它们:http://pepper.troll.no/s60prereleases/OpenC-1.7-sis-files.zip。您可以使用刚刚安装的runonphone工具通过 runonphone -s <sis-file> 来安装它们。
  • 最后,我们需要把Qt自己安装到手机上,您可以通过如下命令来做到:


    • runonphone -s /usr/share/qt4/qt-symbian/lib/Qt.sis
    • runonphone -s /usr/share/qt4/qt-symbian/lib/QtWebKit.sis
当然您的应用程序的用户不需要做这些。为了使针对用户的发布更容易,请参考 Symbian发布指导,特别是Smart Installer那一部分。
就是这些!您现在已经准备好进行开发了!当使用这些包进行Symbian开发的时候,唯一要注意的问题是,您必须使用qmake-symbian,而不是qmake。通过使用它,您应该可以通过如下命令试试您的第一个Hello World应用程序:


  • cd <my-hello-world-app>
  • qmake-symbian
  • make runonphone
一些已知问题:


  • 有时在运行rcomp工具的时候,Wine会报错,“Failed to write UIDs”。这应该是安装程序在安装的时候考虑的,很不走运的是目前除了手动修改没有其它可以适合每一个用户的永久方案。解决办法很简单,就是运行这条命令:cp /usr/s60-sdk/epoc32/tools/uidcrc.exe `find ~/.wine/ -ipath ‘*windows/system32’`
  • 让gcce的ebuild正常工作还是有点麻烦。有的时候它会无原因的停在那里;如果发生这种情况,请您重试一下,也许第二次它就会正常工作,但是如果它不工作,您也别太惊奇。如果您很不幸遇到了这种情况,请您通过运行sh /usr/portage/distfiles/symbian-adt-4.4-172-arm-none-symbianelf.bin手动安装它。然后您可以把sys-devel/gcce-4.4.172添加到/etc/portage/profile/package.provided来欺骗Portage您已经安装了。
  • 除了上述之外,runonphone会在您插入手机之后自动检测USB端口的时候失败。如果出现这种情况,请阅读Qt文档中关于如何配置USB串口驱动的一节。在运行runonphone的时候,您也许可以通过为-p指定如/dev/ttyUSB1或者/dev/ttyACM1的参数来解决这一问题,详细描述在这里。

Symbian development using 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.
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.
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.


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.
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


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


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; 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


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


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/s60installs
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.

QShare(this)

赞(0) 打赏
转载请注明出处:服务器评测 » 在Linux上进行Symbian开发的实验性包
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏