home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / gcc-2.6.0-src.lha / GNU / src / amiga / gcc-2.6.0 / gcc.info-5 < prev    next >
Encoding:
GNU Info File  |  1994-07-15  |  21.5 KB  |  470 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.  
  4.    This file documents the use and the internals of the GNU compiler.
  5.  
  6.    Published by the Free Software Foundation 675 Massachusetts Avenue
  7. Cambridge, MA 02139 USA
  8.  
  9.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  10.  
  11.    Permission is granted to make and distribute verbatim copies of this
  12. manual provided the copyright notice and this permission notice are
  13. preserved on all copies.
  14.  
  15.    Permission is granted to copy and distribute modified versions of
  16. this manual under the conditions for verbatim copying, provided also
  17. that the sections entitled "GNU General Public License" and "Protect
  18. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  19. original, and provided that the entire resulting derived work is
  20. distributed under the terms of a permission notice identical to this
  21. one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that the sections entitled "GNU General Public
  26. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  27. permission notice, may be included in translations approved by the Free
  28. Software Foundation instead of in the original English.
  29.  
  30. 
  31. File: gcc.info,  Node: Installation,  Next: C Extensions,  Prev: Invoking GCC,  Up: Top
  32.  
  33. Installing GNU CC
  34. *****************
  35.  
  36. * Menu:
  37.  
  38. * Configurations::    Configurations Supported by GNU CC.
  39. * Other Dir::     Compiling in a separate directory (not where the source is).
  40. * Cross-Compiler::   Building and installing a cross-compiler.
  41. * Sun Install::   See below for installation on the Sun.
  42. * VMS Install::   See below for installation on VMS.
  43. * Collect2::      How `collect2' works; how it finds `ld'.
  44. * Header Dirs::   Understanding the standard header file directories.
  45.  
  46.    Here is the procedure for installing GNU CC on a Unix system.  See
  47. *Note VMS Install::, for VMS systems.  In this section we assume you
  48. compile in the same directory that contains the source files; see *Note
  49. Other Dir::, to find out how to compile in a separate directory on Unix
  50. systems.
  51.  
  52.    You cannot install GNU C by itself on MSDOS; it will not compile
  53. under any MSDOS compiler except itself.  You need to get the complete
  54. compilation package DJGPP, which includes binaries as well as sources,
  55. and includes all the necessary compilation tools and libraries.
  56.  
  57.   1. If you have built GNU CC previously in the same directory for a
  58.      different target machine, do `make distclean' to delete all files
  59.      that might be invalid.  One of the files this deletes is
  60.      `Makefile'; if `make distclean' complains that `Makefile' does not
  61.      exist, it probably means that the directory is already suitably
  62.      clean.
  63.  
  64.   2. On a System V release 4 system, make sure `/usr/bin' precedes
  65.      `/usr/ucb' in `PATH'.  The `cc' command in `/usr/ucb' uses
  66.      libraries which have bugs.
  67.  
  68.   3. Specify the host and target machine configurations.  You do this by
  69.      running the file `configure' with appropriate arguments.
  70.  
  71.      The `configure' script searches subdirectories of the source
  72.      directory for other compilers that are to be integrated into GNU
  73.      CC.  The GNU compiler for C++, called G++ is in a subdirectory
  74.      named `cp'.  `configure' inserts rules into `Makefile' to build
  75.      all of those compilers.
  76.  
  77.      If you are building a compiler to produce code for the machine it
  78.      runs on, specify the "configuration name" with the `--target'
  79.      option; the host will default to be the same as the target.  (If
  80.      you are building a cross-compiler, see *Note Cross-Compiler::.)
  81.  
  82.      Here is an example:
  83.  
  84.           ./configure --target=sparc-sun-sunos4.1
  85.  
  86.      If you run `configure' without specifying configuration arguments,
  87.      `configure' tries to guess the type of host you are on, and uses
  88.      that configuration type for both host and target.  So you don't
  89.      need to specify a configuration, for building a native compiler,
  90.      unless `configure' cannot figure out what your configuration is.
  91.  
  92.      A configuration name may be canonical or it may be more or less
  93.      abbreviated.
  94.  
  95.      A canonical configuration name has three parts, separated by
  96.      dashes.  It looks like this: `CPU-COMPANY-SYSTEM'.  (The three
  97.      parts may themselves contain dashes; `configure' can figure out
  98.      which dashes serve which purpose.)  For example,
  99.      `m68k-sun-sunos4.1' specifies a Sun 3.
  100.  
  101.      You can also replace parts of the configuration by nicknames or
  102.      aliases.  For example, `sun3' stands for `m68k-sun', so
  103.      `sun3-sunos4.1' is another way to specify a Sun 3.  You can also
  104.      use simply `sun3-sunos', since the version of SunOS is assumed by
  105.      default to be version 4.  `sun3-bsd' also works, since `configure'
  106.      knows that the only BSD variant on a Sun 3 is SunOS.
  107.  
  108.      You can specify a version number after any of the system types,
  109.      and some of the CPU types.  In most cases, the version is
  110.      irrelevant, and will be ignored.  So you might as well specify the
  111.      version if you know it.
  112.  
  113.      See *Note Configurations::, for a list of supported configuration
  114.      names and notes on many of the configurations.  You should check
  115.      the notes in that section before proceding any further with the
  116.      installation of GNU CC.
  117.  
  118.      There are four additional options you can specify independently to
  119.      describe variant hardware and software configurations.  These are
  120.      `--with-gnu-as', `--with-gnu-ld', `--with-stabs' and `--nfp'.
  121.  
  122.     `--with-gnu-as'
  123.           If you will use GNU CC with the GNU assembler (GAS), you
  124.           should declare this by using the `--with-gnu-as' option when
  125.           you run `configure'.
  126.  
  127.           Using this option does not install GAS.  It only modifies the
  128.           output of GNU CC to work with GAS.  Building and installing
  129.           GAS is up to you.
  130.  
  131.           Conversely, if you *do not* wish to use GAS and do not specify
  132.           `--with-gnu-as' when building GNU CC, it is up to you to make
  133.           sure that GAS is not installed.  GNU CC searches for a
  134.           program named `as' in various directories; if the program it
  135.           finds is GAS, then it runs GAS.  If you are not sure where
  136.           GNU CC finds the assembler it is using, try specifying `-v'
  137.           when you run it.
  138.  
  139.           The systems where it makes a difference whether you use GAS
  140.           are
  141.           `hppa1.0-ANY-ANY', `hppa1.1-ANY-ANY', `i386-ANY-sysv',
  142.           `i386-ANY-isc',
  143.           `i860-ANY-bsd', `m68k-bull-sysv', `m68k-hp-hpux',
  144.           `m68k-sony-bsd',
  145.           `m68k-altos-sysv', `m68000-hp-hpux', `m68000-att-sysv', and
  146.           `mips-ANY').  On any other system, `--with-gnu-as' has no
  147.           effect.
  148.  
  149.           On the systems listed above (except for the HP-PA and for ISC
  150.           on the 386), if you use GAS, you should also use the GNU
  151.           linker (and specify `--with-gnu-ld').
  152.  
  153.     `--with-gnu-ld'
  154.           Specify the option `--with-gnu-ld' if you plan to use the GNU
  155.           linker with GNU CC.
  156.  
  157.           This option does not cause the GNU linker to be installed; it
  158.           just modifies the behavior of GNU CC to work with the GNU
  159.           linker.  Specifically, it inhibits the installation of
  160.           `collect2', a program which otherwise serves as a front-end
  161.           for the system's linker on most configurations.
  162.  
  163.     `--with-stabs'
  164.           On MIPS based systems and on Alphas, you must specify whether
  165.           you want GNU CC to create the normal ECOFF debugging format,
  166.           or to use BSD-style stabs passed through the ECOFF symbol
  167.           table.  The normal ECOFF debug format cannot fully handle
  168.           languages other than C.  BSD stabs format can handle other
  169.           languages, but it only works with the GNU debugger GDB.
  170.  
  171.           Normally, GNU CC uses the ECOFF debugging format by default;
  172.           if you prefer BSD stabs, specify `--with-stabs' when you
  173.           configure GNU CC.
  174.  
  175.           No matter which default you choose when you configure GNU CC,
  176.           the user can use the `-gcoff' and `-gstabs+' options to
  177.           specify explicitly the debug format for a particular
  178.           compilation.
  179.  
  180.           `--with-stabs' is meaningful on the ISC system on the 386,
  181.           also, if `--with-gas' is used.  It selects use of stabs
  182.           debugging information embedded in COFF output.  This kind of
  183.           debugging information supports C++ well; ordinary COFF
  184.           debugging information does not.
  185.  
  186.     `--nfp'
  187.           On certain systems, you must specify whether the machine has
  188.           a floating point unit.  These systems include
  189.           `m68k-sun-sunosN' and `m68k-isi-bsd'.  On any other system,
  190.           `--nfp' currently has no effect, though perhaps there are
  191.           other systems where it could usefully make a difference.
  192.  
  193.      Here we spell out what files will be set up by `configure'.
  194.      Normally you need not be concerned with these files.
  195.  
  196.         * A symbolic link named `config.h' is made to the top-level
  197.           config file for the machine you will run the compiler on
  198.           (*note Config::.).  This file is responsible for defining
  199.           information about the host machine.  It includes `tm.h'.
  200.  
  201.           The top-level config file is located in the subdirectory
  202.           `config'.  Its name is always `xm-SOMETHING.h'; usually
  203.           `xm-MACHINE.h', but there are some exceptions.
  204.  
  205.           If your system does not support symbolic links, you might
  206.           want to set up `config.h' to contain a `#include' command
  207.           which refers to the appropriate file.
  208.  
  209.         * A symbolic link named `tconfig.h' is made to the top-level
  210.           config file for your target machine.  This is used for
  211.           compiling certain programs to run on that machine.
  212.  
  213.         * A symbolic link named `tm.h' is made to the
  214.           machine-description macro file for your target machine.  It
  215.           should be in the subdirectory `config' and its name is often
  216.           `MACHINE.h'.
  217.  
  218.         * A symbolic link named `md' will be made to the machine
  219.           description pattern file.  It should be in the `config'
  220.           subdirectory and its name should be `MACHINE.md'; but MACHINE
  221.           is often not the same as the name used in the `tm.h' file
  222.           because the `md' files are more general.
  223.  
  224.         * A symbolic link named `aux-output.c' will be made to the
  225.           output subroutine file for your machine.  It should be in the
  226.           `config' subdirectory and its name should be `MACHINE.c'.
  227.  
  228.         * The command file `configure' also constructs the file
  229.           `Makefile' by adding some text to the template file
  230.           `Makefile.in'.  The additional text comes from files in the
  231.           `config' directory, named `t-TARGET' and `x-HOST'.  If these
  232.           files do not exist, it means nothing needs to be added for a
  233.           given target or host.
  234.  
  235.   4. The standard directory for installing GNU CC is `/usr/local/lib'.
  236.      If you want to install its files somewhere else, specify
  237.      `--prefix=DIR' when you run `configure'.  Here DIR is a directory
  238.      name to use instead of `/usr/local' for all purposes with one
  239.      exception: the directory `/usr/local/include' is searched for
  240.      header files no matter where you install the compiler.  To override
  241.      this name, use thge `--local-prefix' option below.
  242.  
  243.   5. Specify `--local-prefix=DIR' if you want the compiler to search
  244.      directory `DIR/include' for header files *instead* of
  245.      `/usr/local/include'.  (This is for systems that have different
  246.      conventions for where to put site-specific things.)
  247.  
  248.      Unless you have a convention other than `/usr/local' for
  249.      site-specific files, it is a bad idea to specify `--local-prefix'.
  250.  
  251.   6. Make sure the Bison parser generator is installed.  (This is
  252.      unnecessary if the Bison output files `c-parse.c' and `cexp.c' are
  253.      more recent than `c-parse.y' and `cexp.y' and you do not plan to
  254.      change the `.y' files.)
  255.  
  256.      Bison versions older than Sept 8, 1988 will produce incorrect
  257.      output for `c-parse.c'.
  258.  
  259.   7. If you have chosen a configuration for GNU CC which requires other
  260.      GNU tools (such as GAS or the GNU linker) instead of the standard
  261.      system tools, install the required tools in the build directory
  262.      under the names `as', `ld' or whatever is appropriate.  This will
  263.      enable the compiler to find the proper tools for compilation of
  264.      the program `enquire'.
  265.  
  266.      Alternatively, you can do subsequent compilation using a value of
  267.      the `PATH' environment variable such that the necessary GNU tools
  268.      come before the standard system tools.
  269.  
  270.   8. Build the compiler.  Just type `make LANGUAGES=c' in the compiler
  271.      directory.
  272.  
  273.      `LANGUAGES=c' specifies that only the C compiler should be
  274.      compiled.  The makefile normally builds compilers for all the
  275.      supported languages; currently, C, C++ and Objective C.  However,
  276.      C is the only language that is sure to work when you build with
  277.      other non-GNU C compilers.  In addition, building anything but C
  278.      at this stage is a waste of time.
  279.  
  280.      In general, you can specify the languages to build by typing the
  281.      argument `LANGUAGES="LIST"', where LIST is one or more words from
  282.      the list `c', `c++', and `objective-c'.  If you have any
  283.      additional GNU compilers as subdirectories of the GNU CC source
  284.      directory, you may also specify their names in this list.
  285.  
  286.      Ignore any warnings you may see about "statement not reached" in
  287.      `insn-emit.c'; they are normal.  Also, warnings about "unknown
  288.      escape sequence" are normal in `genopinit.c' and perhaps some
  289.      other files.  Likewise, you should ignore warnings about "constant
  290.      is so large that it is unsigned" in `insn-emit.c' and
  291.      `insn-recog.c'.  Any other compilation errors may represent bugs in
  292.      the port to your machine or operating system, and should be
  293.      investigated and reported (*note Bugs::.).
  294.  
  295.      Some commercial compilers fail to compile GNU CC because they have
  296.      bugs or limitations.  For example, the Microsoft compiler is said
  297.      to run out of macro space.  Some Ultrix compilers run out of
  298.      expression space; then you need to break up the statement where
  299.      the problem happens.
  300.  
  301.      If you are building with a previous GNU C compiler, do not use
  302.      `CC=gcc' on the make command or by editing the Makefile.  Instead,
  303.      use a full pathname to specify the compiler, such as
  304.      `CC=/usr/local/bin/gcc'.  This is because make might execute the
  305.      `gcc' in the current directory before all of the compiler
  306.      components have been built.
  307.  
  308.   9. If you are building a cross-compiler, stop here.  *Note
  309.      Cross-Compiler::.
  310.  
  311.  10. Move the first-stage object files and executables into a
  312.      subdirectory with this command:
  313.  
  314.           make stage1
  315.  
  316.      The files are moved into a subdirectory named `stage1'.  Once
  317.      installation is complete, you may wish to delete these files with
  318.      `rm -r stage1'.
  319.  
  320.  11. If you have chosen a configuration for GNU CC which requires other
  321.      GNU tools (such as GAS or the GNU linker) instead of the standard
  322.      system tools, install the required tools in the `stage1'
  323.      subdirectory under the names `as', `ld' or whatever is
  324.      appropriate.  This will enable the stage 1 compiler to find the
  325.      proper tools in the following stage.
  326.  
  327.      Alternatively, you can do subsequent compilation using a value of
  328.      the `PATH' environment variable such that the necessary GNU tools
  329.      come before the standard system tools.
  330.  
  331.  12. Recompile the compiler with itself, with this command:
  332.  
  333.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"
  334.  
  335.      This is called making the stage 2 compiler.
  336.  
  337.      The command shown above builds compilers for all the supported
  338.      languages.  If you don't want them all, you can specify the
  339.      languages to build by typing the argument `LANGUAGES="LIST"'.  LIST
  340.      should contain one or more words from the list `c', `c++',
  341.      `objective-c', and `proto'.  Separate the words with spaces.
  342.      `proto' stands for the programs `protoize' and `unprotoize'; they
  343.      are not a separate language, but you use `LANGUAGES' to enable or
  344.      disable their installation.
  345.  
  346.      If you are going to build the stage 3 compiler, then you might
  347.      want to build only the C language in stage 2.
  348.  
  349.      Once you have built the stage 2 compiler, if you are short of disk
  350.      space, you can delete the subdirectory `stage1'.
  351.  
  352.      On a 68000 or 68020 system lacking floating point hardware, unless
  353.      you have selected a `tm.h' file that expects by default that there
  354.      is no such hardware, do this instead:
  355.  
  356.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O -msoft-float"
  357.  
  358.  13. If you wish to test the compiler by compiling it with itself one
  359.      more time, install any other necessary GNU tools (such as GAS or
  360.      the GNU linker) in the `stage2' subdirectory as you did in the
  361.      `stage1' subdirectory, then do this:
  362.  
  363.           make stage2
  364.           make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  365.  
  366.      This is called making the stage 3 compiler.  Aside from the `-B'
  367.      option, the compiler options should be the same as when you made
  368.      the stage 2 compiler.  But the `LANGUAGES' option need not be the
  369.      same.  The command shown above builds compilers for all the
  370.      supported languages; if you don't want them all, you can specify
  371.      the languages to build by typing the argument `LANGUAGES="LIST"',
  372.      as described above.
  373.  
  374.      If you do not have to install any additional GNU tools, you may
  375.      use the command
  376.  
  377.           make bootstrap LANGUAGES=LANGUAGE-LIST BOOT_CFLAGS=OPTION-LIST
  378.  
  379.      instead of making `stage1', `stage2', and performing the two
  380.      compiler builds.
  381.  
  382.  14. Then compare the latest object files with the stage 2 object
  383.      files--they ought to be identical, aside from time stamps (if any).
  384.  
  385.      On some systems, meaningful comparison of object files is
  386.      impossible; they always appear "different."  This is currently
  387.      true on Solaris and probably on all systems that use ELF object
  388.      file format.  On some versions of Irix on SGI machines and OSF/1
  389.      on Alpha systems, you will not be able to compare the files
  390.      without specifying `-save-temps'; see the description of
  391.      individual systems above to see if you get comparison failures.
  392.      You may have similar problems on other systems.
  393.  
  394.      Use this command to compare the files:
  395.  
  396.           make compare
  397.  
  398.      This will mention any object files that differ between stage 2 and
  399.      stage 3.  Any difference, no matter how innocuous, indicates that
  400.      the stage 2 compiler has compiled GNU CC incorrectly, and is
  401.      therefore a potentially serious bug which you should investigate
  402.      and report (*note Bugs::.).
  403.  
  404.      If your system does not put time stamps in the object files, then
  405.      this is a faster way to compare them (using the Bourne shell):
  406.  
  407.           for file in *.o; do
  408.           cmp $file stage2/$file
  409.           done
  410.  
  411.      If you have built the compiler with the `-mno-mips-tfile' option on
  412.      MIPS machines, you will not be able to compare the files.
  413.  
  414.  15. Build the Objective C library (if you have built the Objective C
  415.      compiler).  Here is the command to do this:
  416.  
  417.           make objc-runtime CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  418.  
  419.  16. Install the compiler driver, the compiler's passes and run-time
  420.      support with `make install'.  Use the same value for `CC',
  421.      `CFLAGS' and `LANGUAGES' that you used when compiling the files
  422.      that are being installed.  One reason this is necessary is that
  423.      some versions of Make have bugs and recompile files gratuitously
  424.      when you do this step.  If you use the same variable values, those
  425.      files will be recompiled properly.
  426.  
  427.      For example, if you have built the stage 2 compiler, you can use
  428.      the following command:
  429.  
  430.           make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST"
  431.  
  432.      This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1',
  433.      `cpp' and `libgcc.a' in the directory
  434.      `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the
  435.      compiler driver program looks for them.  Here TARGET is the target
  436.      machine type specified when you ran `configure', and VERSION is
  437.      the version number of GNU CC.  This naming scheme permits various
  438.      versions and/or cross-compilers to coexist.
  439.  
  440.      This also copies the driver program `xgcc' into
  441.      `/usr/local/bin/gcc', so that it appears in typical execution
  442.      search paths.
  443.  
  444.      On some systems, this command causes recompilation of some files.
  445.      This is usually due to bugs in `make'.  You should either ignore
  446.      this problem, or use GNU Make.
  447.  
  448.      *Warning: there is a bug in `alloca' in the Sun library.  To avoid
  449.      this bug, be sure to install the executables of GNU CC that were
  450.      compiled by GNU CC.  (That is, the executables from stage 2 or 3,
  451.      not stage 1.)  They use `alloca' as a built-in function and never
  452.      the one in the library.*
  453.  
  454.      (It is usually better to install GNU CC executables from stage 2
  455.      or 3, since they usually run faster than the ones compiled with
  456.      some other compiler.)
  457.  
  458.  17. Install the Objective C library (if you are installing the
  459.      Objective C compiler).  Here is the command to do this:
  460.  
  461.           make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  462.  
  463.  18. If you're going to use C++, it's likely that you need to also
  464.      install the libg++ distribution.  It should be available from the
  465.      same place where you got the GNU C distribution.  Just as GNU C
  466.      does not distribute a C runtime library, it also does not include
  467.      a C++ run-time library.  All I/O functionality, special class
  468.      libraries, etc., are available in the libg++ distribution.
  469.  
  470.