home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.uni-stuttgart.de/pub/systems/acorn/
/
Acorn.tar
/
Acorn
/
acornet
/
dev
/
c
/
gcc
/
gcc-faq.txt
< prev
next >
Wrap
Text File
|
1995-10-23
|
10KB
|
324 lines
RiscOS-GCC FAQ
==============
Last updated: 21.9.95, Jochen Scharrlach (jscharrl@ba-stuttgart.de)
Posting: irregularly, every time when there are major changes. I am not
sure where to put this FAQ at the moment, but I'll make it
available via:
http://www.uni-stuttgart.de/Archive/acorn/
The following FAQ does not try to explain internals of GNU-C nor does it
provide a C/C++ tutorial. It only tries to explain how to handle the Acorn
port of GNU C/C++. It is not a classic selection of questions and answers,
it's more like a brief manual. Unless you are an experienced Acorn-GCC
programmer, this document might be very helpful.
Disclaimer: Acorn, FSF or the GCC porters are not responsible for this FAQ.
Be aware that this FAQ wasn't written by one almighty guru, there were
several people helping me.
The FAQ is for GNU-C version 2.4.5/R2.2. If you have an older version try
to get this one, if you have a newer version please tell me where I can get
it from...
Please help me on stuff marked with "(?)". If you find any mistakes (even
grammar or spelling mistakes) or have any updates or suggestions, drop me
an email.
Contents
--------
1. Availability
1.1 FTP
1.2 CD-ROM
1.3 other
2. Installation
3. Libraries
3.1 C++
3.2 UnixLib
3.3 gststubs
3.4 DeskLib
3.5 OSLib
4. Using GCC
4.1 Memory requirements
4.1.1 Archimedes
4.1.2 RiscPC
4.2 Directories
4.3 Filename translation
4.4 Commandline options
4.5 Compiling C++-sources
4.6 Using <varargs.h>
5. Related Information
5.1 GCC documentation
5.2 Other FAQs
5.3 Interactive help
5.4 Books
5.4.1 C
5.4.2 C++
5.4.3 Object-Oriented Analysis and Design
***************************
---------------
1. Availability
---------------
1.1 FTP
* ftp://ftp.demon.co.uk/pub/archimedes/gnu/gcc/*
* ftp://ftp.uni-stuttgart.de/pub/systems/acorn/riscos/lang/c/gcc/*
* ftp://micros.hensa.ac.uk/micros/arch/riscos/b/b013/*
1.2 CD-ROM
* Acorn User CD
* The Risc Disc Vol. 1 (Uniqueway, RPCD 1)
1.3 other
* C Acorn User Group's software library sends gcc free-of-charge to
anyone who sends them 3 formatted discs (or 2 HD discs) and return
postage. (see "Related information")
(?) - anything else?
---------------
2. Installation
---------------
You will find three archives which you'll have to unpack into the same
directory. Additionally you'll need a linker, e.g. DRLink. Install it into
a directory that is listed in Run$Path, e.g. !GCC.bin. Additionally you'll
have to set in !GCC.!Boot:
Set GCC$Linker DRLink
------------
3. Libraries
------------
The easiest way to use a C-library is to put the path into GCC$Path.
The path must point to the location where the subdirectories "o"
(contains the library itself) and "h" (contains the include files) reside.
C++-libraries have to be listed in GPP$Path. The other method would be to
tell gcc where to find the headers with -I<path> and the library with
-L<path>.
3.1 C++
If you want to compile C++-programs you'll also need the C++-library,
you should be able to get it where you found gcc. To use it, GPP$Path has
to point to the location you installed the lib. The C++ library supplied
with GCC 2.4.5 is mainly the iostream library.
3.2 UnixLib
UnixLib 3.6e works with gcc, it's a bit the standard library. It
provides Unix-style headers which seem to work with gststubs (see
below), but you may run into trouble with it.
3.3 gststubs
This one is a PD-replacement for Acorn's stubs. It's much smaller than
UnixLib, because it uses the SharedCLib, though it comes with no
header files. If you don't have the Acorn-C headers you'll have to try
it with UnixLib's headers, but it is not guaranteed that this will work
correctly.
3.4 DeskLib
Official versions above 2.16 should work fine with gcc. DeskLib provides
many WIMP- and other RiscOS-specific commands, but you'll need to link
with (gst)stubs (try -mstubs). GCC is not able to recompile DeskLib.
3.5 OSLib
Acorn's unofficial PD library. Should work with gcc, but it also needs
(gst)stubs. There are known problems when using C++ (OSLib uses C++
keywords) and you may need to use the "-ansi"-option.
------------
4. Using GCC
------------
4.1 Memory requirements
GCC needs 3.5-8MB to compile C-programs (more than 4MB for C++-progs),
so it is very hard to use it on a 4MB machine without "tricks":
4.1.1 Archimedes
You can use !Virtual (current version 0.37), which gives you up to 24MB
of "virtual memory", i.e. your harddisc will be used to simulate this.
You still need at least 1.5MB of real memory, otherwise compiling will
take ages!
4.1.2 RiscPC
!Virtual doesn't work on a RiscPC, so you'll need to get enough RAM, i.e.
about 6-12MB, though I know of an attempt to implement some kind of VM on
the RiscPC.
Future ports of GCC *may* contain VM for both RiscPC and Archimedes.
4.2 Directories
Because RiscOS doesn't use file extenders, the files are stored in
different subdirectories:
* c C-sourcecode
* cc C++-sourcecode (the way it was supposed to be)
* c++ C++-sourcecode (the way Acorn wanted it to be...)
* s Assembler-source
* o object files
* h header files
4.3 Filename translation
GCC was originally developed for Unix-systems, so GCC expects Unix-style
filenames. These filenames will be translated, so they match RiscOS-files.
If you want to compile the file dir.c.myprog, you can either say:
gcc dir.c.myprog
or:
gcc dir/myprog.c
You should use the Unix-format.
4.4 Commandline options
I don't want to list all possible options, there are sh**loads of them.
The most important are:
* -o <file>
redirect the output into <file>.
* -c
stop after compiling, i.e. no linking.
* -E
stop after preprocessing. If you don't specify an output file, the
output will be sent to stdout.
* -S
stop before assembling, i.e. generates Assembler-output.
* -I<path>
specify an additional path to search for include files.
* -L<path>
specify an additional path to search for libraries.
* -l<lib>
link with the library <lib>. You don't need to specify the path if
you either do this with the "-L"-option or specify it in GCC$Path.
* -O<n>
optimise, <n> is the degree how much should be done. "-O2" is the best
possible optimisation at the moment. "-O1" is the same as "-O", "-O0"
means no optimisation (default).
* -Wall
gives more warnings.
Machine dependant stuff, i.e. don't try this on other platforms:
* -mstubs
compiles to target SharedCLibrary and tells the linker to link with
stubs instead of UnixLib.
* -maof
same as above.
* -mamu
Generate the file !Depend which contains a list of all the source
files that the produced object depend on. This is intended for use
with amu, which edit the makefile to include these after the
'#dynamicdependencies' line.
* -mno-apcs
Do not use APCS-R calling specification
* -mno-function-name
Do not embed function names in object code.
* -mfpa
Object code is intended to run using the floating point accelerator,
rather than fpe, therefore pay attention to scheduling of
instructions. I believe that this has little effect at the moment.
* -mno-stack-check
Do not perform stack checking.
4.5 Compiling C++-sources
GCC compiles C *and* C++-code, you only have to put the source into the
correct subdirectory. To link C++-programs you will have to explicitly
link with the C++-library, e.g.
gcc -o hello hello.cc -lc++
or:
gcc -c hello.cc
gcc -o hello hello.o -lc++
4.6 Using <varargs.h>
The versions of <varargs.h> supplied with Norcroft and UnixLib are not
compatible with GCC, the GNU version has to be used. For the supplied
UnixLib and the -mstubs switch, this is done automatically, but if you
are using other libraries, you need to include the GCC include directory
in the search path, BEFORE the library include path. i.e. -IGCC: -IC:.
This does not apply to <stdargs.h>.
----------------------
5. Related Information
----------------------
5.1 GCC documentation
The original GCC documentation is written in Texinfo, which can either be
printed via TeX and be converted into a hypertext format ("info"). You
can also get a version for !StrongHlp v2:
ftp://ftp.uni-stuttgart.de/pub/systems/acorn/riscos/docs/gnu/gcc-docs.zip
CAUTION: this beast is 2MB (unpacked 7MB) big! Be aware that the given
information belongs to GCC 2.6.3, so not every listed feature will work.
5.2 Other FAQs
* comp.sys.acorn: if you have trouble with your Acorn
* gnu.g++.help (g++-FAQ): GNU-C/C++ questions
* comp.lang.c++: system independent questions about C++
5.3 Interactive help
* e-mail: gcc@callan.demon.co.uk (Simon Callan and soon Nick Burrett)
for any problems with the ARM/RISC OS GCC compiler.
* The "C Acorn User Group" (CAUG) supports C and C++ users on RISC
OS machines. For more information, send an email to caug@accu.org.
Their parent organisation ACCU has web pages at:
http://bach.cis.temple.edu/accu
5.4 Books
5.4.1 C
* Kernighan, B. W. and Ritchie, D. M. (1988), The C Programming Language
(second edition). Prentice-Hall, Englewood Cliffs, NJ, USA.
ISBN 0-13-110362-8. (The original C 'bible'. Written by the designers
of C.)
5.4.2 C++
* Bjarne Stroustrup (1991), The C++ Programming Language (second
edition). At&T Bell Telephone Laboratories, Inc. ISBN 0-201-53992-6
(Written by the 'father' of C++)
* Murray, Robert B. (1993), C++ Strategies and Tactics,
Addison-Wesley, ISBN 0-201-56382-7
* Cargill, Tom (1992), C++ Programming Style, Addison-Wesley, ISBN
0-201-56365-7. This is a good 'second' C++ book showing you why
and how you should be using C++ features.
5.4.3 Object-Oriented Analysis and Design
* Booch, Grady (1994), Object-Oriented Analysis and Design with
Applications (2nd Edition), Benjamin/Cummings, ISBN
0-8053-5340-2. Complete coverage of the well-known Booch method of
OOAD.
* White, Iseult (1994), Using the Booch Method, Benjamin/Cummings,
ISBN 0-8053-0614-5. A practical example of the Booch method. More
accessible but less complete than Booch's book.
(?) - Any other books, FAQs, etc. worth mentioning?