Chinaunix首页 | 论坛 | 博客
  • 博客访问: 311915
  • 博文数量: 75
  • 博客积分: 4010
  • 博客等级: 上校
  • 技术积分: 775
  • 用 户 组: 普通用户
  • 注册时间: 2005-12-18 22:18
文章分类

全部博文(75)

文章存档

2015年(2)

2014年(1)

2007年(8)

2006年(60)

2005年(4)

我的朋友

分类: LINUX

2006-08-12 23:49:10

原文
Compiler Setup
编译环境的建立
Howto setup the cross compiler, the QPE development environment, and create a test application. Table of contents
如何建立交叉器,QPE开发环境,新建测试程序。
目录
1 Setting up the cross compiler
建立交叉编译器
2 Setting up QPE
建立QPE环境
3 Testing the cross compiler
测试交叉编译器
4 Using qvfb
使用qvfb
5 Console Development
文本console程序的开发
6 Zaurus IDE
Zaurus开发平台
[edit]
Setting up the cross compiler
建立交叉编译器
The development PC should have a Linux distribution pre-loaded on it. Preferably one that natively supports RPM packages, such as RedHat, SuSE, Mandrake or Caldera. You can also use distributions such as Slackware and Debian as well, but you may need to use a RPM conversion utility such as "alien" to support the RPM format.
开发用的PC首先要预装一个Linux版本。最好的一个选择是支持RPM包的,例如Redhat,SuSE,Mandrake或者Cldera。即使是像Slackware和Debian这类版本,你也可以工作的很好,但是你可能需要使用一个RPM包的转换工具-alien,来支持RPM包的安装格式。
Note that many of the newer distrobutions now use GCC3.2 or later as their default compiler. This means that when compiling for the desktop it will not be able to link to the sdk files as they were created using GCC 2.95. To fix this problem you need to install 2.95 for your distrobution.
值得注意的是许多新的发行版本现在使用GCC3.2甚至更信的版本作为缺省的编译器。这意味着,你在编译时不能找到sdk文件,因为它们是GCC2.95上建立的。要解决这个问题,你需要从你的发行版本中找出GCC2.95并安装。
Once the target PC is ready, the following packages should be downloaded:
当工作用的PC准备好了以后,下载下面的安装包
gcc-cross-sa1100-2.95.2-0.i386.rpm (gcc compiler for ARM architecture) ARM的gcc编译器

binutils-cross-arm-2.11.2-0.i386.rpm (binary utilities for ARM architecture) ARM的binary工具

glibc-arm-2.2.2-0.i386.rpm] (GNU C libraries for ARM architecture) ARM的GNU C库

linux-headers-arm-sa1100-2.4.6-3.i386.rpm] (linux header files for ARM architecture) ARM的Linux头文件
For RedHat 9 On CD #1 or in the archives, find and install:
在Redhat 9中,从第一张CD中找出以下软件包并安装:
compat-gcc-c++-7.3-2.96.118
compat-libstdc++-devel-7.3-2.96.118
compat-libstdc++-7.3-2.96.118
compat-gcc-7.3-2.96.118
Then copy [tmake.conf | ] to /opt/Qtopia/tmake/lib/qws/linux-x86-g++/tmake.conf after installing the RedHat SDK rpms. (*Note, install the qtopia-free rpm first. There will already be a file named tmake.conf. This new file only changes the compiler names, to gcc296 so it doesn't conflict with your system compiler)
For SuSE 8.x also download and install:
Each of the RPM files need to be installed from a command line prompt using the following command:
rpm -Uvh filename.rpm
For example, to install the arm gcc compiler, this should be run:
rpm -Uvh gcc-cross-sa1100-2.95.2-0.i386.rpm
By default, RPM installs the ARM toolchain in the /opt/Embedix/ folder.
[edit]
Setting up QPE
Native development for the Zaurus is done using C++ and Qt by !TrollTech. QPE comes with a virtual frame buffer (qvfb) so that you can test applications under X11 without having to have a Zaurus. To run applications on the Zaurus (and the qvfb) you need to link against QPE rather then Qt. See section 4 for more details about qvfb.
To start development you need to obtain the QPE SDK from Trolltech (Either the GPL or Commercial edition) Mirrored locally here is the Qtopia-free version. (Qtopia is the name for the qpe libraries and the desktop environment build on it for the Zaurus.) If you are doing commercial development you need to obtain the commercial sdk.
qtopia-free-1.5.0-1.i386.rpm
Install the rpm in the same manner as to how the cross compiler was installed.
By default, RPM installs the Qtopia SDK in the /opt/Qtopia/ directory.
After the toolchain and the SDK are installed, you should download the two batch files in your home directory. One sets up the environment variables for compiling x86 versions of Zaurus applications (using the qvfb) and the other for setting the environment variables for doing native ARM crosscompiling for the Zaurus.
Batch file #1, [dev-x86-qpe.sh] Batch file #2, [dev-arm-qpe.sh]
For SuSE 8.x add "/opt/gcc295/bin:" to the start of the PATH variable in [dev-x86-qpe.sh].
When you want to compile and test x86 applications run source dev-x86-qpe.sh from your home directory. Conversely, run source dev-arm-qpe.sh when you want to cross compile to run on the Zaurus.
[edit]
Testing the cross compiler
To test the compiler, you will want to build the example application in the /opt/Qtopia/example/ directory.
First, run the x86 environment script in your home directory from a shell session. source dev-x86-qpe.sh
2. Next, from within the same session in the /opt/Qtopia/example/ directory, run tmake -o Makefile example.pro. This creates the Makefile. (!RedHat 9 - copy the /opt/Qtopia/example/ directory to your home directory and in it, run tmake -o Makefile example.pro. This creates the example Makefile.)
To actually build the application, run make within that same directory.
Start qvfb at the command line qvfb & and then start the example application. example -qws.
Alternatively, to build an ARM version to run on the Zaurus do the following steps.
First, run the arm environment script in your home directory from a shell session. source dev-arm-qpe.sh
If there is a Makefile you need to remove it from the example directory. rm Makefile (It is essential that you do this!)
Run make clean from within /opt/Qtopia/example to clean out the old temporary files from the x86 configuration.
Run tmake example.pro > Makefile again to create the Makefiles for arm compiling.
To build the arm binary, run make from within that directory. Once its built to run it, it will need to be copied over to the Zaurus and execute it from the console.
For further information about Qt, !QtDeigner (Qt's gui design tool), how to make application .pro files, qmake, tmake, and most Qt related questions see !TrollTech's site at: and the sk documentation.
Qtopia's SDK (including qpe) documentation is located on your pc (it came with the sdk) in /opt/Qtopia/doc/index.html, and is available on for the online updated version.
[edit]
Using qvfb
Applications can be tested and run in x11 using qvfb.
Run ./qvfb & to launch the simulated Zaurus display. Any Qt/Embedded applications compiled for x86 you launch will now display in this window.
Next, run ./example -qws to run the example app in server mode. Alternatively, you could run the qpe application from /opt/Qtopia/bin to simulate an actual Qtopia environment and then run the example app in non-server mode.
[edit]
Console Development
Depending on an application's build system, changing it to compile for arm could be as simply as setting the environment variable CC, but consult your distribution and build system documention.
Utilizing the easy of use of Qmake & Tmake can be done without having QT linked into the application by adding the following option to the .pro file.
CONFIG -= qt # removes the qt linking
Note:
When building libraries, make sure arm-linux-ranlib gets called.
For more information about cross compiling you can visit .
[edit]
Zaurus IDE
If you want to use a graphical IDE for developing Zaurus applications, then you can use the unstable version of KDevelop, codenamed Gideon (which is actually quite stable). See the following link for a full howto for using KDevelop to develop Qtopia apps: http://www.kdevelop.org/doc/tutorial_qtopia/
_________________
SL-C1000,newbie
阅读(1504) | 评论(0) | 转发(0) |
0

上一篇: Mehdi

下一篇:nand nor

给主人留下些什么吧!~~