Compiler Setup

From OESF

(Difference between revisions)
Jump to: navigation, search
Current revision (03:35, 20 November 2009) (edit) (undo)
 

(8 intermediate revisions not shown.)

Line 19:

Line 19:

**compat-libstdc++-7.3-2.96.118
**compat-libstdc++-7.3-2.96.118
**compat-gcc-7.3-2.96.118
**compat-gcc-7.3-2.96.118
-
Then copy [tmake.conf | http://downloads.zaurususergroup.com/downloads/docs/downloads/tmake.conf] to /opt/Qtopia/tmake/lib/qws/linux-x86-g++/tmake.conf after installing the RedHat SDK rpms.
+
Then copy [tmake.conf | http://www.oesf.org/howto/downloads/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:
*For SuSE 8.x also download and install:
-
** ftp://ftp.suse.com/pub/suse/i386/8.1/suse/i586/gcc_old-2.95.3-7.i586.rpm
+
** ftp://ftp.suse.com/pub/suse/i386/8.1/suse/i586/gcc_old-2.95.3-7.i586.rpm (dead link, http://ivan.kartik.sk/oracle/install_ora9_suse.html has a newer version of this package, installs into /opt).
Each of the RPM files need to be installed from a command line prompt using the following command:
Each of the RPM files need to be installed from a command line prompt using the following command:

Line 32:

Line 32:

By default, RPM installs the ARM toolchain in the /opt/Embedix/ folder.
By default, RPM installs the ARM toolchain in the /opt/Embedix/ folder.
-
==2) Setting up QPE==
+
==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.
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.

Line 40:

Line 40:

[http://www.oesf.org/howto/downloads/qtopia-free-1.5.0-1.i386.rpm qtopia-free-1.5.0-1.i386.rpm]
[http://www.oesf.org/howto/downloads/qtopia-free-1.5.0-1.i386.rpm qtopia-free-1.5.0-1.i386.rpm]
-
Install the rpm in the same manor as to how the cross compiler was installed.
+
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.
By default, RPM installs the Qtopia SDK in the ''/opt/Qtopia/'' directory.

Line 51:

Line 51:

For SuSE 8.x add "/opt/gcc295/bin:" to the start of the PATH variable in [[http://www.oesf.org/howto/downloads/dev-x86-qpe.sh dev-x86-qpe.sh]].
For SuSE 8.x add "/opt/gcc295/bin:" to the start of the PATH variable in [[http://www.oesf.org/howto/downloads/dev-x86-qpe.sh 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.
+
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.
-
==3) Testing the cross compiler==
+
==Testing the cross compiler==
To test the compiler, you will want to build the example application in the ''/opt/Qtopia/example/'' directory.
To test the compiler, you will want to build the example application in the ''/opt/Qtopia/example/'' directory.

Line 81:

Line 81:

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 http://doc.trolltech.com for the online updated version.
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 http://doc.trolltech.com for the online updated version.
-
==4) Using qvfb==
+
==Using qvfb==
Applications can be tested and run in x11 using qvfb.
Applications can be tested and run in x11 using qvfb.

Line 89:

Line 89:

# 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.
# 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.
-
==5) Console Development==
+
==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.
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.

Line 101:

Line 101:

For more information about cross compiling you can visit http://www.arm.linux.org.uk/.
For more information about cross compiling you can visit http://www.arm.linux.org.uk/.
-
==6) Zaurus IDE==
+
==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/
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/
 +
[[Category:Development]]

Current revision

Howto setup the cross compiler, the QPE development environment, and create a test application.

Contents

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.

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.

Once the target PC is ready, the following packages should be downloaded:

[gcc-cross-sa1100-2.95.2-0.i386.rpm (gcc compiler for ARM architecture)
[binutils-cross-arm-2.11.2-0.i386.rpm (binary utilities for ARM architecture)
[glibc-arm-2.2.2-0.i386.rpm] (GNU C libraries for ARM architecture)
[linux-headers-arm-sa1100-2.4.6-3.i386.rpm] (linux header files for ARM architecture)

  • For RedHat 9 On CD #1 or in the archives, find and install:
    • 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 | http://www.oesf.org/howto/downloads/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)

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.

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.

Testing the cross compiler

To test the compiler, you will want to build the example application in the /opt/Qtopia/example/ directory.

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

  1. To actually build the application, run make within that same directory.
  1. 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.

  1. First, run the arm environment script in your home directory from a shell session. source dev-arm-qpe.sh
  1. If there is a Makefile you need to remove it from the example directory. rm Makefile (It is essential that you do this!)
  1. Run make clean from within /opt/Qtopia/example to clean out the old temporary files from the x86 configuration.
  1. Run tmake example.pro > Makefile again to create the Makefiles for arm compiling.
  1. 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: http://doc.trolltech.com 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 http://doc.trolltech.com for the online updated version.

Using qvfb

Applications can be tested and run in x11 using qvfb.

  1. Run ./qvfb & to launch the simulated Zaurus display. Any Qt/Embedded applications compiled for x86 you launch will now display in this window.
  1. 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.

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 http://www.arm.linux.org.uk/.

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/

Personal tools