------------
Home page  | Downloading  | QL & compatible computers  | QDOS & compatible OS  | Forum
------------

qdos-gcc howto


 

o What is qdos-gcc ?

This is (currently) a gcc cross-compiler for Linux (should work under other UNICES as well) which is able to generate QDOS/SMS executables. Only the cc front-end (gcc), the pre-processor (cpp) and the compiler phase (cc1) are actually gcc-specific. Some C68 utilities (as68, ld and slb) are still used by qdos-gcc so to generate the final QDOS/SMS binaries. The libraries that qdos-gcc may use are all the existing (unmodified) C68 libraries, but the main library (libc_a) had to be adapted slightly so that its (excellent and fast) math routines could be used by qdos-gcc.

The qdos-gcc project is currently maintained by:

In fact this project arose from the many messages exchanged through the ql-users mailing list. Richard and I both agreed (this is so rare we agree on something that this must indeed be noticed ;-) that QDOS/SMS was lacking a C/C++ compiler able to generate really fast code; this point of view was warmly seconded by a few other well known QLers. A few weeks after the messages were exchanged, Richard sent us the first gcc patch: qdos-gcc was born !

o Why should I use qdos-gcc ?

The QDOS/SMS systems already have an excellent C compiler: C68. This compiler is small (c68, the compiler phase, is less than 140Kb), ANSI C compliant, fast, and generates small and reasonably fast code.

On the other hand, most of the other operating systems have got gcc which is big (cc1, the compiler phase, is over 1.5Mb) but generates much faster code and can deal with C++, Objective C and Java as well (qdos-gcc is not yet ready to deal with these languages though).

Another thing to consider is that qdos-gcc being (so far) a cross-compiler, you can take benefit of all UNIX utilities (such as GNU make, autogen, autoconf and automake which are used in most major projects) that have not (yet) been ported to QDOS/SMS. Porting a C-written software to QDOS/SMS is therefore made easier (no more manual generation/editing of the makefile/config.h/etc... files !).

The last argument in favour of a cross-compiler is the compiling speed benefit for those who are running this cross-compiler on a hardware which is faster than their QL-compatible computer/QL emulator (compiling the whole libc.a library on a 400MHz K6-III takes less than 1'30"...).

o And what speed gain over c68 compiled software can I expect ?

This is of course dependant on the compiled software and on the plateform you run it on... Here are some results of tests I made on a QXL (with a full blown 68040):

o OK, you convinced me !  Now how to install qdos-gcc ?

The prerequisit is to have a running Linux (or UNIX) system with a shell account, GNU make, sh (bash2 preferred), tar (bzip2 aware), bzip2, and a native gcc compiler with associated utilities (as, ld, etc..., usualy known as "binutils") and development libraries.

  1. First you will need the following files (the next instructions expect to find them into your HOME directory):

    (*) Your Linux distribution may well already include the gcc v2.95.2 full sources either in a tarball (Slackware), in a .deb package (Debian), or in a RPM file (Redhat, Suse, Mandrake, many others). As for RPM, you may install the gcc sources (rpm -ivh gcc-2.95.2.src.rpm) and move the tarball from /usr/src/{redhat,packages, RPM}/SOURCES to your home directory.

  2. Next you can untar everything in a safe place, say /usr/src/qdos, from a shell prompt type:
              $ mkdir /usr/src/qdos
              $ cd /usr/src/qdos
              $ tar xyvf ~/gcc-core-2.95.2.tar.bz2
              $ tar xyvf ~/qdos-gcc-utils.tar.bz2
              $ tar xyvf ~/libc-4.24.5.tar.bz2
    

    Note: depending on your (g)tar, either xyvf or xIvf may be required...

  3. Don't forget to patch the gcc-core sources:
              $ cd gcc-2.95.2
              $ bzcat ~/qdos-gcc-diff-091000.bz2 | patch -p1 -s
              $ cd ..
    
  4. Now you must compile and install the qdos-gcc utilities:
              $ cd qdos-gcc-utils
              $ make
              $ make install
              $ cd ..
    
  5. You will also need the C68 include files IOT compile qdos-gcc, so install them:
              $ cd libc-4.24.5
              $ make install-includes
              $ cd ..
    
  6. It's time to compile the qdos-gcc cross-compiler:
              $ mkdir build-qdos-gcc
              $ cd build-qdos-gcc
              $ ../gcc-2.95.2/configure --target=qdos
              $ make                                   (1)
              $ make install                           (2)
              $ cd ..
    
    Note: if you installed the full gcc v2.95 sources from a RPM package or another distribution source, then you will have to type the following:
    1.      $ make "LANGUAGES=C"
    2.      $ make install "LANGUAGES=C"
  7. Some adjustments have to be made (else libgcc.a may not link properly), this is dealt with thanks to a script in qdos-gcc-utils (the script will also tidy-up some useless files and add some useful soft links):
              $ qdos-gcc-utils/scripts/post-gcc-install
    
  8. Now we can build and install the libc.a v4.24.5 library:
              $ cd libc-4.24.5
              $ make install
              $ cd ..
    
That's it !  qdos-gcc is installed and ready... You will find qdos-gcc utilities and scripts into /usr/local/qdos/bin, while the C68 include files reside in /usr/local/qdos/include and the C68 libraries into /usr/local/qdos/lib. The qdos-gcc compiler itself resides in /usr/local/lib/gcc-lib/qdos/2.95.2 and some useful soft links are setup into /usr/local/bin (which should be part of your shell PATH variable). Note that when compiling programs using qdos-gcc, you must add a -lgcc option to the ld parameter list.

o Known bugs and incompatibilities:

o To do:

^ Top of page.


 Since 9th April 1996, you are the   th visitor (counter by Webcounter)

(c) 2000, Thierry Godefroy. No warranty or whatsoever is given regarding the accuracy of the information contained in these Web pages.
<-  Back to home page.