Meego Wiki
Views

SDK/Docs/1.1/在Linux平台开发进行MeeGo SDK开发

From MeeGo wiki
< SDK | Docs | 1.1(Difference between revisions)
Jump to: navigation, search
(On Fedora)
(安装MeeGo目标机交叉编译环境)
 
(5 intermediate revisions not shown)
Line 4: Line 4:
[[Category:application-developer]]
[[Category:application-developer]]
[[Category:linux]]
[[Category:linux]]
-
This page describes how to install and configure the MeeGo 1.1 SDK on your Linux development system.
 
本文介绍如何在Linux系统中安装和配置MeeGo 1.1 SDK。
本文介绍如何在Linux系统中安装和配置MeeGo 1.1 SDK。
Line 16: Line 15:
== 为你的发行版配置软件库安装源 ==
== 为你的发行版配置软件库安装源 ==
-
=== On Ubuntu or Debian ===
+
=== 针对Ubuntu或Debian平台 ===
<!-- Replaced '#' with <li> so that multi-line <pre> statements would appear in a single block -->
<!-- Replaced '#' with <li> so that multi-line <pre> statements would appear in a single block -->
Line 54: Line 53:
</ol>
</ol>
-
=== On MeeGo ===
+
=== 针对MeeGo平台 ===
<ul>
<ul>
  <li>To add the MeeGo SDK repository on a system running MeeGo, run the following command. <br>
  <li>To add the MeeGo SDK repository on a system running MeeGo, run the following command. <br>
Line 61: Line 60:
  </li>
  </li>
</ul>
</ul>
-
=== On openSUSE ===
+
=== 针对openSUSE平台 ===
<ul>
<ul>
  <li>To add the MeeGo repository, run the following command. <br>
  <li>To add the MeeGo repository, run the following command. <br>
Line 108: Line 107:
</ul>
</ul>
-
== Install MeeGo Target ==
+
== 安装MeeGo目标机交叉编译环境(Target) ==
-
A ''Target'' is used to build programs using the MeeGo toolchain and libraries (sysroot). It is downloaded as a large (~250MB) .bz2 file using the commands below. MADDE (MeeGo Application Develop and Debug Environment ([http://wiki.maemo.org/MADDE background])) is a tool that assists in the download and installation of the Target.  "mad-admin" is the MADDE command-line tool. You can install multiple Targets and switch easily between them in Qt Creator (described later).
+
所谓 ''目标机交叉编译环境''是用于编译MeeGo程序所需要的交叉编译工具和开发库(sysroot). 下载下来后是一个很大的(大约250MB).bz2格式的文件. MADDE (MeeGo应用开发和调试环境的缩写,([http://wiki.maemo.org/MADDE background])) 是一个用于帮助下载和安装目标交叉编译环境的工具集。"mad-admin"是MADDE的一个命令行工具. 你可以安装多个目标机交叉编译环境(比如针对arm的和针对x86的)并在Qt Creator中切换它们(会在后头介绍).
<ol>
<ol>
-
  <li>Create a MeeGo target using MADDE <br>
+
  <li>使用MADDE创建一个 MeeGo 目标机交叉编译环境(target) <br>
-
Run the command belowReplace <target> with one of
+
执行下面的命令<target> 替换为一下之一:
-
* '''meego-core-armv7l-1.1.2''':  Build applications for ARM handheld devices (such as N900)
+
* '''meego-core-armv7l-1.1.2''':  用来创建 ARM平台 手持设备的应用 (比如 N900)
-
* '''meego-handset-ia32-1.1.2''':  Build applications for x86 handheld devices (such as Aava)
+
* '''meego-handset-ia32-1.1.2''': 用来创建 x86平台 手持设备的应用 (比如 Aava)
-
* '''meego-netbook-ia32-1.1.2''': Build applications for x86 netbooks.
+
* '''meego-netbook-ia32-1.1.2''': 用来创建 x86平台 上网本的应用.
-
Note that the <code>-f</code> flag instructs MADDE to download the Target tarball (bz2) first.
+
注意 <code>-f</code> 标识 是用来告知 MADDE 首先下载目标机交叉编译环境(Target)的 tarball (bz2)文件 .
  <pre>$ sudo mad-admin create -f <target> </pre>
  <pre>$ sudo mad-admin create -f <target> </pre>
-
If you encounter problems, check the [http://wiki.meego.com/MeeGo_SDK_Troubleshooting#General_SDK_Errors Troubleshooting page]
+
如果你遇到了麻烦, 查看如下链接 [http://wiki.meego.com/MeeGo_SDK_Troubleshooting#General_SDK_Errors Troubleshooting page]
  </li>
  </li>
-
  <li>To check that the target has been installed correctly, run the following. <br>
+
  <li>如果要检查你的目标机交叉编译环境是否已经正确安装, 运行如下命令. <br>
-
Replace <target> with one of the values described in the previous step
+
替换 <target> 为上一步你所安装的目标机交叉编译环境的名称。
  <pre>$ mad -t <target> pscreate -t qt-simple qthello
  <pre>$ mad -t <target> pscreate -t qt-simple qthello
$ cd qthello
$ cd qthello
Line 128: Line 127:
$ mad -t <target> make
$ mad -t <target> make
</pre>
</pre>
-
Note: Running qmake will print "-unix is deprecated"  This is not an error with the compilationYou can safely ignore this for now.
+
注意: 运行 qmake 会显示 "-unix is deprecated"  这并非是编译错误目前你可以忽略它.
  </li>
  </li>
-
  <li>To check that the qt-simple application is created for the correct target, run:
+
  <li>如果要检查你的 qt-simple 是否已经为目标机交叉编译环境正确地创建, 运行:
  <pre>$ file build/qthello</pre>
  <pre>$ file build/qthello</pre>
  </li>
  </li>
</ol>
</ol>
-
== Install MeeGo Runtime ==
+
== 安装MeeGo运行时环境 ==
-
A ''Runtime'' is the MeeGo OS image that is run with QEMU when debugging applications on your host system. It is not required if you develop against real hardware running MeeGo.  It is downloaded as a large (~650MB) .bz2 file using MADDE.  The Runtime is not needed until you have finished configuring Qt Creator.  However, as this step may take some time, it is recommended to start it now so that it can proceed in the background while you continue following the steps on this page.
+
''运行时环境''指的是在主机系统上调试应用时运行在QEMU中的MeeGo操作系统映像.如果你是在硬件设备上直接调试你的应用,那么你无需安装MeeGo运行时环境。它是一个可通过MADDE下载的.bz文件,大小约为650MB 。在你开始配置Qt Creator之前,运行时环境不会被用到。然而,鉴于下载这个文件得多花点时间,所以还是建议你在开始下面的步骤之前就开始在后台下载安装运行时环境。
-
See [http://wiki.meego.com/SDK/Docs/1.1/Configuring_QEMU_runtimes Downloading a Runtime and Using QEMU]
+
可参考 [http://wiki.meego.com/SDK/Docs/1.1/Configuring_QEMU_runtimes 下载运行时环境和使用QEMU]
== Configuring Qt Creator to use the MeeGo toolchain(s) ==
== Configuring Qt Creator to use the MeeGo toolchain(s) ==
Line 166: Line 165:
  $ sudo apt-get install g++
  $ sudo apt-get install g++
-
== Developing with the SDK ==
+
== 使用SDK进行开发 ==
-
To start developing with the MeeGo SDK, the [[SDK/Docs/1.1/Creating_Hello_World|hello world tutorial]] is a good starting point.
+
如果你刚刚接触MeeGo SDK,那么[[SDK/Docs/1.1/Creating_Hello_World|hello world 开发指南]] 是一个不错的起步教程.
-
This tutorial covers how to start a project, package it, and deploy it to a device (either a real device, or a QEMU runtime set up through MADDE).
+
该指南涵盖了如何创建一个工程,并进行打包和部署到设备上的各个方面的知识。(这里提到的设备包括真实的设备或者是QEMU运行环境中的一个虚拟设备).
-
== Removing components ==
+
== 删除/卸载 ==
-
=== On Ubuntu ===
+
觉得MeeGo SDK没什么好玩的,你可以按如下方法删除或卸载安装的内容。
-
To remove installed components, run:
+
=== 针对Ubuntu平台 ===
 +
 
 +
要删除已安装的软件包,请运行:
  $ sudo apt-get remove --purge meego-sdk-qtcreator madde qt-tools arm-2009q1 qemu-arm qemu-gl meego-sdk-i586-toolchain meego-qemu meego-sdk-qt
  $ sudo apt-get remove --purge meego-sdk-qtcreator madde qt-tools arm-2009q1 qemu-arm qemu-gl meego-sdk-i586-toolchain meego-qemu meego-sdk-qt
-
To remove dependencies related to installed components, run:
+
要删除安装这些包时安装的依赖包,请运行:
  $ sudo apt-get autoremove
  $ sudo apt-get autoremove
-
To remove MADDE directory (it is not automatically removed when "madde" package is uninstalled):
+
要删除整个MADDE目录(在卸载"madde"包的时候,该目录不会被完全删除),请运行:
  $ sudo rm -rf /usr/lib/madde
  $ sudo rm -rf /usr/lib/madde
Line 188: Line 189:
  $ sudo apt-get clean
  $ sudo apt-get clean
-
=== On Fedora ===
+
=== 针对Fedora平台 ===
-
To remove installed components, run:
+
要删除已安装的软件包,请运行:
  $ sudo yum remove meego-sdk-qt-creator madde qt-tools arm-2009q1 qemu-arm qemu-gl meego-sdk-i586-toolchain meego-qemu
  $ sudo yum remove meego-sdk-qt-creator madde qt-tools arm-2009q1 qemu-arm qemu-gl meego-sdk-i586-toolchain meego-qemu
-
To remove MADDE directory:
+
要删除整个MADDE目录:
  $ sudo rm -rf /usr/lib/madde
  $ sudo rm -rf /usr/lib/madde
-
=== On openSUSE ===
+
=== 针对openSUSE平台 ===
-
To remove installed components, run:
+
要删除已安装的软件包,请运行:
  $ sudo zypper remove -u meego-sdk-qt-creator madde qt-tools arm-2009q1 qemu-arm qemu-gl meego-sdk-i586-toolchain meego-qemu
  $ sudo zypper remove -u meego-sdk-qt-creator madde qt-tools arm-2009q1 qemu-arm qemu-gl meego-sdk-i586-toolchain meego-qemu
-
To remove MADDE directory:
+
要删除整个MADDE目录:
  $ sudo rm -rf /usr/lib/madde
  $ sudo rm -rf /usr/lib/madde

Latest revision as of 01:23, 27 March 2011

本文介绍如何在Linux系统中安装和配置MeeGo 1.1 SDK。

Contents

准备/约定

  • 硬件: 任一较新款的处理器, 比如32位的Intel Atom 或者 Intel Core 2 CPU. 为使用QEMU 需要将MeeGo运行在虚拟机中,为此你的系统必须支持虚化技术 (术语Virtualization Technology,或者说VT). 清参考图形加速获取更多信息.
  • 软件: MeeGo 1.1 SDK 已经在32位Fedora 12, [Fedora 13, Ubuntu 9.10, 和 Ubuntu 10.04 LTS进行验证. 对于其它主机操作系统的支持情况请访问this page.
  • Root 权限: 安装 SDK 需要你具备root权限. 在执行需要root权限的命令时,通常都会在命令前冠以"sudo"的前缀. 为了方便, 最好为你的登录用户增加可以执行"sudo"命令的权限,这样可以方便的在root权限和普通用户权限之间进行切换,(可参考 sudo的帮助页.)
  • 命令: 本文给出的命令例子都会以"$"指示."$"不是命令的一部分,在终端输入命令时请不要输入字符"$".

为你的发行版配置软件库安装源

针对Ubuntu或Debian平台

  1. 将下面文本行加入到/etc/apt/sources.list.d/meego-sdk.list中.
    根据你的操作系统和版本,将${distribution}/${version}替换成以下字串: "debian/5.0", "ubuntu/09.10", "ubuntu/10.04" or "ubuntu/10.10".
    deb http://repo.meego.com/MeeGo/sdk/host/repos/${distribution}/${version}/ / 
  2. 为软件仓库增加公钥:
    $ gpg --keyserver pgpkeys.mit.edu --recv 0BC7BEC479FC1F8A
    $ gpg --export --armor 0BC7BEC479FC1F8A | sudo apt-key add -
  3. 更新软件源:
    $ sudo apt-get update
  4. 如想测试软件源是否正确被添加, 请运行以下命令测试. 正常的情况会在屏幕上打印出MADDE包的详细信息.
    $ apt-cache policy madde

针对Fedora平台

  1. 进入yum软件源配置目录:
    $ cd /etc/yum.repos.d/ 
  2. 增加MeeGo SDK的yum软件源.
    根据你的Fedora版本将下面命令中的${distribution}/${version}替换成相应的: "fedora/12" 或 "fedora/13".
    $ sudo wget http://repo.meego.com/MeeGo/sdk/host/repos/${distribution}/${version}/meego-sdk.repo
  3. 安装签名公钥:
    $ sudo rpm --import http://repo.meego.com/MeeGo/sdk/host/repos/${distribution}/${version}/repodata/repomd.xml.key 
  4. 更新软件包数据库:
    $ sudo yum update

针对MeeGo平台

  • To add the MeeGo SDK repository on a system running MeeGo, run the following command.
    Replace ${distribution}/${version} with one of the following values: "meego/1.1" or "meego/trunk".
    $ sudo zypper addrepo -f http://repo.meego.com/MeeGo/sdk/host/repos/${distribution}/${version}/meego-sdk.repo

针对openSUSE平台

  • To add the MeeGo repository, run the following command.
    Replace ${distribution}/${version} with one of the following values: "opensuse/11.2" or "opensuse/11.3".
    $ sudo zypper addrepo -f http://repo.meego.com/MeeGo/sdk/host/repos/${distribution}/${version}/meego-sdk.repo

安装 MeeGo SDK

  • Debian / Ubuntu
    $ sudo apt-get install meego-sdk
  • Fedora
    $ sudo yum install meego-sdk
  • OpenSUSE / MeeGo
    $ sudo zypper install meego-sdk

只装ARM版本的:

  • Debian / Ubuntu
    $ sudo apt-get install meego-sdk-armv7l
  • Fedora
    $ sudo yum install meego-sdk-armv7l
  • OpenSUSE / MeeGo
    $ sudo zypper install meego-sdk-armv7l

只装IA32版本的:http://wiki.meego.com/SDK/Docs/1.1/Configuring_QEMU_runtimes

  • Debian / Ubuntu
    $ sudo apt-get install meego-sdk-ia32
  • Fedora
    $ sudo yum install meego-sdk-ia32
  • OpenSUSE / MeeGo
    $ sudo zypper install meego-sdk-ia32

安装MeeGo目标机交叉编译环境(Target)

所谓 目标机交叉编译环境是用于编译MeeGo程序所需要的交叉编译工具和开发库(sysroot). 下载下来后是一个很大的(大约250MB).bz2格式的文件. MADDE (MeeGo应用开发和调试环境的缩写,(background)) 是一个用于帮助下载和安装目标交叉编译环境的工具集。"mad-admin"是MADDE的一个命令行工具. 你可以安装多个目标机交叉编译环境(比如针对arm的和针对x86的)并在Qt Creator中切换它们(会在后头介绍).

  1. 使用MADDE创建一个 MeeGo 目标机交叉编译环境(target)
    执行下面的命令. 把 <target> 替换为一下之一:
    • meego-core-armv7l-1.1.2: 用来创建 ARM平台 手持设备的应用 (比如 N900)
    • meego-handset-ia32-1.1.2: 用来创建 x86平台 手持设备的应用 (比如 Aava)
    • meego-netbook-ia32-1.1.2: 用来创建 x86平台 上网本的应用.
    注意 -f 标识 是用来告知 MADDE 首先下载目标机交叉编译环境(Target)的 tarball (bz2)文件 .
    $ sudo mad-admin create -f <target> 

    如果你遇到了麻烦, 查看如下链接 Troubleshooting page

  2. 如果要检查你的目标机交叉编译环境是否已经正确安装, 运行如下命令.
    替换 <target> 为上一步你所安装的目标机交叉编译环境的名称。
    $ mad -t <target> pscreate -t qt-simple qthello
    $ cd qthello
    $ mad -t <target> qmake
    $ mad -t <target> make
    

    注意: 运行 qmake 会显示 "-unix is deprecated" 这并非是编译错误. 目前你可以忽略它.

  3. 如果要检查你的 qt-simple 是否已经为目标机交叉编译环境正确地创建, 运行:
    $ file build/qthello

安装MeeGo运行时环境

运行时环境指的是在主机系统上调试应用时运行在QEMU中的MeeGo操作系统映像.如果你是在硬件设备上直接调试你的应用,那么你无需安装MeeGo运行时环境。它是一个可通过MADDE下载的.bz文件,大小约为650MB 。在你开始配置Qt Creator之前,运行时环境不会被用到。然而,鉴于下载这个文件得多花点时间,所以还是建议你在开始下面的步骤之前就开始在后台下载安装运行时环境。

可参考 下载运行时环境和使用QEMU

Configuring Qt Creator to use the MeeGo toolchain(s)

Start Qt Creator by selecting Applications > Programming > Qt Creator.

Configure Qt Creator to use the MeeGo toolchain(s):

  1. Go to Tools > Options > Qt4 > Qt Versions.
  2. On the right side of the Qt Versions view, click on the plus sign button to add a new version.
    A blank, new version appears in the Qt Versions view.
  3. On the Version Name line, specify a name for the new version.
  4. On the qmake location line, specify a qmake location for the new version. The toolchain installs by default to usr/lib/madde/linux-i686/targets/<target>/bin/qmake.
  5. Click Rebuild, Apply and OK.
Adding the MeeGo toolchain(s) in Qt Creator

Using the MeeGo SDK Qt version

It is also possible to use Qt Creator without a MeeGo toolchain. This option can be useful if you don't need to cross-compile your software: for example, if you are doing QML development with no use of C++.

The steps are the same as above, but the qmake location is set to the qmake installed with the meego-sdk-qt libraries. The usual location for this on Linux is:

/opt/meego/meego-sdk-qt/bin/qmake

Note: On Ubuntu 10.10, you may need to install g++ in order for this step to work. If necessary, do this:

$ sudo apt-get install g++

使用SDK进行开发

如果你刚刚接触MeeGo SDK,那么hello world 开发指南 是一个不错的起步教程.

该指南涵盖了如何创建一个工程,并进行打包和部署到设备上的各个方面的知识。(这里提到的设备包括真实的设备或者是QEMU运行环境中的一个虚拟设备).

删除/卸载

觉得MeeGo SDK没什么好玩的,你可以按如下方法删除或卸载安装的内容。

针对Ubuntu平台

要删除已安装的软件包,请运行:

$ sudo apt-get remove --purge meego-sdk-qtcreator madde qt-tools arm-2009q1 qemu-arm qemu-gl meego-sdk-i586-toolchain meego-qemu meego-sdk-qt

要删除安装这些包时安装的依赖包,请运行:

$ sudo apt-get autoremove

要删除整个MADDE目录(在卸载"madde"包的时候,该目录不会被完全删除),请运行:

$ sudo rm -rf /usr/lib/madde

To remove the packages from your local repository (/var/cache/apt/archives/), run:

$ sudo apt-get clean

针对Fedora平台

要删除已安装的软件包,请运行:

$ sudo yum remove meego-sdk-qt-creator madde qt-tools arm-2009q1 qemu-arm qemu-gl meego-sdk-i586-toolchain meego-qemu

要删除整个MADDE目录:

$ sudo rm -rf /usr/lib/madde


针对openSUSE平台

要删除已安装的软件包,请运行:

$ sudo zypper remove -u meego-sdk-qt-creator madde qt-tools arm-2009q1 qemu-arm qemu-gl meego-sdk-i586-toolchain meego-qemu

要删除整个MADDE目录:

$ sudo rm -rf /usr/lib/madde

本文的其它语言版本

Personal tools