Installing QTopia today

 

If you have GCC 2.95.x installed

You can just follow the instruction from this how-to, and all will be good.

If you have a newer version

If for example you actually do C++ development, you can't use a GCC before 3.1, as it would lack some fundamental components (stingstream, just to say one) and have several quite big bugs.

Here lies the problem: the packages suggested by the afore-mentioned how-to are compiled using GCC 2.95.2, and since the ABI has changed radically, programs compiled with GCC 3.x will not link against those qt-embedded libraries.

So we just install GCC 2.95.2, right? Wrong! GCC 2.95.2 has a bug in the libio library (basis for C++ streams) which makes it impossible to compile it against glibc 2.2 (and since you have an up-to-date GCC, I'm sure you'll have an up-to-date glibc, too) (the type for file offsets has changed: from int to a struct containing two int, to allow for 64 bit file positions). We need to use GCC 2.95.3, which contains a fix for this problem (as far as I could see from the diff, it shouldn't support files larger than 4GB, but since we are going to use to test programs intended for a Zaurus, it's not such a limitation) (the ABI of .3 is the same as the .2 one)

Now we don't want 2.95 to overwrite our 3: we want to install it in a separate directory. This is accomplished passing the --prefix option to the configure script.

Step-by-step instructions

Ready-made packages

Download:

Install all of them (using rpm, as root). Two directories will be created: /opt/Embedix with the arm toolchain, and /opt/Qtopia with libraries and programs to compile both for x86 and arm.

GCC

Download gcc-core-2.95.3.tar.gz and gcc-g++-2.95.3.tar.gz from a GNU mirror.

To compile (I assume you put the GCC tarballs in /tmp):

  • cd /tmp
  • tar zxvf gcc-core-2.95.3.tar.gz;tar zxvf gcc-g++-2.95.3.tar.gz
  • mkdir gcc-obj;cd gcc-obj
  • ../gcc-2.95.3/configure --prefix=/opt/Embedix/native --enable-shared
  • make bootstrap
  • make install (this should be done as root, unless you gave your normal user write permissions on /opt/Embedix)

It might be a bit strange to put a native compiler under /opt/Embedix, but it looked convenient, to make it clear in which context it is used.

Some script

A couple of scripts are very usefule to set up enviornment variables in the two cases: native compilation (during development) and cross-compilation (at the end, to deploy the program for the Zaurus).

Get them from Sharp: dev-x86-qpe and dev-arm-qpe.

In dev-x86-qpe change the lines setting PATH and LD_LIBRARY_PATH with the following:

PATH=$QTDIR/bin:$QPEDIR/bin:/opt/Embedix/tools/bin:/opt/Embedix/native/bin:${ORG_PATH}
LD_LIBRARY_PATH=$QTDIR/lib:/opt/Embedix/native/lib:${ORG_LD_LIBRARY_PATH}
In this way you'll get the GCC 2.95.3 we just compiled.