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 >
Text File  |  1995-10-23  |  10KB  |  324 lines

  1. RiscOS-GCC FAQ
  2. ==============
  3.  
  4. Last updated: 21.9.95, Jochen Scharrlach (jscharrl@ba-stuttgart.de)
  5.  
  6. Posting: irregularly, every time when there are major changes. I am not 
  7.          sure where to put this FAQ at the moment, but I'll make it 
  8.          available via:
  9.          http://www.uni-stuttgart.de/Archive/acorn/
  10.  
  11. The following FAQ does not try to explain internals of GNU-C nor does it
  12. provide a C/C++ tutorial. It only tries to explain how to handle the Acorn
  13. port of GNU C/C++. It is not a classic selection of questions and answers, 
  14. it's more like a brief manual. Unless you are an experienced Acorn-GCC 
  15. programmer, this document might be very helpful.
  16.  
  17. Disclaimer: Acorn, FSF or the GCC porters are not responsible for this FAQ.
  18.   Be aware that this FAQ wasn't written by one almighty guru, there were
  19.   several people helping me.
  20.  
  21. The FAQ is for GNU-C version 2.4.5/R2.2. If you have an older version try
  22. to get this one, if you have a newer version please tell me where I can get
  23. it from...
  24.  
  25. Please help me on stuff marked with "(?)". If you find any mistakes (even
  26. grammar or spelling mistakes) or have any updates or suggestions, drop me
  27. an email.
  28.  
  29. Contents
  30. --------
  31.  
  32. 1. Availability
  33.  1.1 FTP
  34.  1.2 CD-ROM
  35.  1.3 other
  36. 2. Installation
  37. 3. Libraries
  38.  3.1 C++ 
  39.  3.2 UnixLib
  40.  3.3 gststubs
  41.  3.4 DeskLib
  42.  3.5 OSLib
  43. 4. Using GCC
  44.  4.1 Memory requirements
  45.   4.1.1 Archimedes
  46.   4.1.2 RiscPC
  47.  4.2 Directories
  48.  4.3 Filename translation
  49.  4.4 Commandline options
  50.  4.5 Compiling C++-sources
  51.  4.6 Using <varargs.h>
  52. 5. Related Information
  53.  5.1 GCC documentation
  54.  5.2 Other FAQs
  55.  5.3 Interactive help
  56.  5.4 Books
  57.   5.4.1 C
  58.   5.4.2 C++
  59.   5.4.3 Object-Oriented Analysis and Design
  60.  
  61. ***************************
  62.  
  63. ---------------
  64. 1. Availability
  65. ---------------
  66.  
  67.  1.1 FTP
  68.  
  69.   * ftp://ftp.demon.co.uk/pub/archimedes/gnu/gcc/*
  70.   * ftp://ftp.uni-stuttgart.de/pub/systems/acorn/riscos/lang/c/gcc/*
  71.   * ftp://micros.hensa.ac.uk/micros/arch/riscos/b/b013/*
  72.  
  73.  1.2 CD-ROM
  74.  
  75.   * Acorn User CD
  76.   * The Risc Disc Vol. 1 (Uniqueway, RPCD 1)
  77.  
  78.  1.3 other
  79.  
  80.   * C Acorn User Group's software library sends gcc free-of-charge to
  81.     anyone who sends them 3 formatted discs (or 2 HD discs) and return
  82.     postage. (see "Related information")
  83.  
  84. (?) - anything else?
  85.  
  86. ---------------
  87. 2. Installation
  88. ---------------
  89.  
  90.   You will find three archives which you'll have to unpack into the same
  91.   directory. Additionally you'll need a linker, e.g. DRLink. Install it into
  92.   a directory that is listed in Run$Path, e.g. !GCC.bin. Additionally you'll
  93.   have to set in !GCC.!Boot:
  94.  
  95.    Set GCC$Linker  DRLink
  96.  
  97. ------------
  98. 3. Libraries
  99. ------------
  100.  
  101.   The easiest way to use a C-library is to put the path into GCC$Path. 
  102.   The path must point to the location where the subdirectories "o" 
  103.   (contains the library itself) and "h" (contains the include files) reside. 
  104.   C++-libraries have to be listed in GPP$Path. The other method would be to 
  105.   tell gcc where to find the headers with -I<path> and the library with
  106.   -L<path>.
  107.   
  108.  3.1 C++ 
  109.  
  110.   If you want to compile C++-programs you'll also need the C++-library,
  111.   you should be able to get it where you found gcc. To use it, GPP$Path has
  112.   to point to the location you installed the lib. The C++ library supplied
  113.   with GCC 2.4.5 is mainly the iostream library.
  114.  
  115.  3.2 UnixLib
  116.  
  117.   UnixLib 3.6e works with gcc, it's a bit the standard library. It
  118.   provides Unix-style headers which seem to work with gststubs (see
  119.   below), but you may run into trouble with it.
  120.  
  121.  3.3 gststubs
  122.  
  123.   This one is a PD-replacement for Acorn's stubs. It's much smaller than
  124.   UnixLib, because it uses the SharedCLib, though it comes with no
  125.   header files. If you don't have the Acorn-C headers you'll have to try
  126.   it with UnixLib's headers, but it is not guaranteed that this will work 
  127.   correctly.
  128.  
  129.  3.4 DeskLib
  130.  
  131.   Official versions above 2.16 should work fine with gcc. DeskLib provides 
  132.   many WIMP- and other RiscOS-specific commands, but you'll need to link 
  133.   with (gst)stubs (try -mstubs). GCC is not able to recompile DeskLib.
  134.  
  135.  3.5 OSLib
  136.  
  137.   Acorn's unofficial PD library. Should work with gcc, but it also needs 
  138.   (gst)stubs. There are known problems when using C++ (OSLib uses C++ 
  139.   keywords) and you may need to use the "-ansi"-option.
  140.  
  141. ------------
  142. 4. Using GCC
  143. ------------
  144.  
  145.  4.1 Memory requirements
  146.  
  147.   GCC needs 3.5-8MB to compile C-programs (more than 4MB for C++-progs), 
  148.   so it is very hard to use it on a 4MB machine without "tricks":
  149.   
  150.   4.1.1 Archimedes
  151.  
  152.   You can use !Virtual (current version 0.37), which gives you up to 24MB
  153.   of "virtual memory", i.e. your harddisc will be used to simulate this.
  154.   You still need at least 1.5MB of real memory, otherwise compiling will
  155.   take ages!
  156.   
  157.   4.1.2 RiscPC
  158.   
  159.   !Virtual doesn't work on a RiscPC, so you'll need to get enough RAM, i.e.
  160.   about 6-12MB, though I know of an attempt to implement some kind of VM on
  161.   the RiscPC.
  162.   
  163.   Future ports of GCC *may* contain VM for both RiscPC and Archimedes.
  164.   
  165.  4.2 Directories
  166.  
  167.   Because RiscOS doesn't use file extenders, the files are stored in 
  168.   different subdirectories:
  169.   
  170.   * c    C-sourcecode
  171.   * cc   C++-sourcecode (the way it was supposed to be)
  172.   * c++  C++-sourcecode (the way Acorn wanted it to be...)
  173.   * s    Assembler-source
  174.   * o    object files
  175.   * h    header files
  176.  
  177.  4.3 Filename translation
  178.  
  179.   GCC was originally developed for Unix-systems, so GCC expects Unix-style
  180.   filenames. These filenames will be translated, so they match RiscOS-files.
  181.   If you want to compile the file dir.c.myprog, you can either say:
  182.     gcc dir.c.myprog
  183.   or:
  184.     gcc dir/myprog.c
  185.  
  186.   You should use the Unix-format.
  187.   
  188.  4.4 Commandline options
  189.  
  190.   I don't want to list all possible options, there are sh**loads of them.
  191.   The most important are:
  192.      
  193.   * -o <file> 
  194.    redirect the output into <file>.
  195.   * -c
  196.    stop after compiling, i.e. no linking.
  197.   * -E
  198.    stop after preprocessing. If you don't specify an output file, the
  199.    output will be sent to stdout.
  200.   * -S
  201.    stop before assembling, i.e. generates Assembler-output.
  202.   * -I<path>
  203.    specify an additional path to search for include files.
  204.   * -L<path>
  205.    specify an additional path to search for libraries.
  206.   * -l<lib>
  207.    link with the library <lib>. You don't need to specify the path if
  208.    you either do this with the "-L"-option or specify it in GCC$Path.
  209.   * -O<n>
  210.    optimise, <n> is the degree how much should be done. "-O2" is the best 
  211.    possible optimisation at the moment. "-O1" is the same as "-O", "-O0"
  212.    means no optimisation (default).
  213.   * -Wall
  214.    gives more warnings.
  215.    
  216.   Machine dependant stuff, i.e. don't try this on other platforms:
  217.  
  218.   * -mstubs  
  219.    compiles to target SharedCLibrary and tells the linker to link with 
  220.    stubs instead of UnixLib.
  221.   * -maof
  222.    same as above.
  223.   * -mamu
  224.    Generate the file !Depend which contains a list of all the source
  225.    files that the produced object depend on. This is intended for use
  226.    with amu, which edit the makefile to include these after the
  227.    '#dynamicdependencies' line.
  228.   * -mno-apcs
  229.     Do not use APCS-R calling specification
  230.   * -mno-function-name
  231.     Do not embed function names in object code.
  232.   * -mfpa
  233.     Object code is intended to run using the floating point accelerator,
  234.     rather than fpe, therefore pay attention to scheduling of
  235.     instructions. I believe that this has little effect at the moment.
  236.   * -mno-stack-check
  237.     Do not perform stack checking.
  238.   
  239.  4.5 Compiling C++-sources
  240.  
  241.   GCC compiles C *and* C++-code, you only have to put the source into the
  242.   correct subdirectory. To link C++-programs you will have to explicitly 
  243.   link with the C++-library, e.g.
  244.     gcc -o hello hello.cc -lc++
  245.   or:
  246.     gcc -c hello.cc
  247.     gcc -o hello hello.o -lc++  
  248.   
  249.  4.6 Using <varargs.h>
  250.  
  251.   The versions of <varargs.h> supplied with Norcroft and UnixLib are not
  252.   compatible with GCC, the GNU version has to be used. For the supplied
  253.   UnixLib and the -mstubs switch, this is done automatically, but if you
  254.   are using other libraries, you need to include the GCC include directory
  255.   in the search path, BEFORE the library include path. i.e. -IGCC: -IC:.
  256.   This does not apply to <stdargs.h>.
  257.  
  258. ----------------------
  259. 5. Related Information
  260. ----------------------
  261.  
  262.  5.1 GCC documentation
  263.  
  264.   The original GCC documentation is written in Texinfo, which can either be
  265.   printed via TeX and be converted into a hypertext format ("info"). You
  266.   can also get a version for !StrongHlp v2:
  267.  
  268.   ftp://ftp.uni-stuttgart.de/pub/systems/acorn/riscos/docs/gnu/gcc-docs.zip
  269.   
  270.   CAUTION: this beast is 2MB (unpacked 7MB) big! Be aware that the given 
  271.   information belongs to GCC 2.6.3, so not every listed feature will work.
  272.   
  273.  5.2 Other FAQs
  274.  
  275.   * comp.sys.acorn: if you have trouble with your Acorn
  276.   * gnu.g++.help (g++-FAQ): GNU-C/C++ questions
  277.   * comp.lang.c++: system independent questions about C++
  278.   
  279.  5.3 Interactive help
  280.  
  281.   * e-mail: gcc@callan.demon.co.uk  (Simon Callan and soon Nick Burrett)
  282.     for any problems with the ARM/RISC OS GCC compiler.
  283.      
  284.   * The "C Acorn User Group" (CAUG) supports C and C++ users on RISC
  285.     OS machines. For more information, send an email to caug@accu.org.
  286.     Their parent organisation ACCU has web pages at:
  287.     http://bach.cis.temple.edu/accu
  288.  
  289.  5.4 Books
  290.  
  291.   5.4.1 C
  292.  
  293.   * Kernighan, B. W. and Ritchie, D. M. (1988), The C Programming Language
  294.     (second edition). Prentice-Hall, Englewood Cliffs, NJ, USA.
  295.     ISBN 0-13-110362-8. (The original C 'bible'. Written by the designers 
  296.     of C.)
  297.  
  298.   5.4.2 C++
  299.  
  300.   * Bjarne Stroustrup (1991), The C++ Programming Language (second 
  301.     edition). At&T Bell Telephone Laboratories, Inc. ISBN 0-201-53992-6 
  302.     (Written by the 'father' of C++)
  303.  
  304.   * Murray, Robert B. (1993), C++ Strategies and Tactics,
  305.     Addison-Wesley, ISBN 0-201-56382-7
  306.  
  307.   * Cargill, Tom (1992), C++ Programming Style, Addison-Wesley, ISBN
  308.     0-201-56365-7. This is a good 'second' C++ book showing you why
  309.     and how you should be using C++ features.
  310.  
  311.   5.4.3 Object-Oriented Analysis and Design
  312.  
  313.   * Booch, Grady (1994), Object-Oriented Analysis and Design with
  314.     Applications (2nd Edition), Benjamin/Cummings, ISBN
  315.     0-8053-5340-2. Complete coverage of the well-known Booch method of
  316.     OOAD.
  317.  
  318.   * White, Iseult (1994), Using the Booch Method, Benjamin/Cummings,
  319.     ISBN 0-8053-0614-5. A practical example of the Booch method. More
  320.     accessible but less complete than Booch's book.
  321.  
  322. (?) - Any other books, FAQs, etc. worth mentioning?
  323.  
  324.