home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gcc-2.4.5 / gcc.info-5 < prev    next >
Encoding:
GNU Info File  |  1993-06-20  |  41.9 KB  |  950 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.    Here is the procedure for installing GNU CC on a Unix system.
  37.  
  38. * Menu:
  39.  
  40. * Other Dir::     Compiling in a separate directory (not where the source is).
  41. * Cross-Compiler::   Building and installing a cross-compiler.
  42. * PA Install::    See below for installation on the HP Precision Architecture.
  43. * Sun Install::   See below for installation on the Sun.
  44. * 3b1 Install::   See below for installation on the 3b1.
  45. * Unos Install::  See below for installation on Unos (from CRDS).
  46. * VMS Install::   See below for installation on VMS.
  47. * WE32K Install:: See below for installation on the 3b* aside from the 3b1.
  48. * MIPS Install::  See below for installation on the MIPS Architecture.
  49. * Collect2::      How `collect2' works; how it finds `ld'.
  50.  
  51.   1. If you have built GNU CC previously in the same directory for a
  52.      different target machine, do `make distclean' to delete all files
  53.      that might be invalid.  One of the files this deletes is
  54.      `Makefile'; if `make distclean' complains that `Makefile' does not
  55.      exist, it probably means that the directory is already suitably
  56.      clean.
  57.  
  58.   2. On a System V release 4 system, make sure `/usr/bin' precedes
  59.      `/usr/ucb' in `PATH'.  The `cc' command in `/usr/ucb' uses
  60.      libraries which have bugs.
  61.  
  62.   3. Specify the host and target machine configurations.  You do this by
  63.      running the file `configure' with appropriate arguments.
  64.  
  65.      If you are building a compiler to produce code for the machine it
  66.      runs on, specify just one machine type.  Use the `--target'
  67.      option; the host type will default to be the same as the target.
  68.      (For information on building a cross-compiler, see *Note
  69.      Cross-Compiler::.)  The command looks like this:
  70.  
  71.           configure --target=sparc-sun-sunos4.1
  72.  
  73.      A configuration name may be canonical or it may be more or less
  74.      abbreviated.
  75.  
  76.      A canonical configuration name has three parts, separated by
  77.      dashes.  It looks like this: `CPU-COMPANY-SYSTEM'.  (The three
  78.      parts may themselves contain dashes; `configure' can figure out
  79.      which dashes serve which purpose.)  For example,
  80.      `m68k-sun-sunos4.1' specifies a Sun 3.
  81.  
  82.      You can also replace parts of the configuration by nicknames or
  83.      aliases.  For example, `sun3' stands for `m68k-sun', so
  84.      `sun3-sunos4.1' is another way to specify a Sun 3.  You can also
  85.      use simply `sun3-sunos', since the version of SunOS is assumed by
  86.      default to be version 4.  `sun3-bsd' also works, since `configure'
  87.      knows that the only BSD variant on a Sun 3 is SunOS.
  88.  
  89.      You can specify a version number after any of the system types,
  90.      and some of the CPU types.  In most cases, the version is
  91.      irrelevant, and will be ignored.  So you might as well specify the
  92.      version if you know it.
  93.  
  94.      Here are the possible CPU types:
  95.  
  96.           a29k, alpha, arm, cN, clipper, elxsi, h8300, hppa1.0, hppa1.1,
  97.           i386, i860, i960, m68000, m68k, m88k, mips, ns32k, pyramid,
  98.           romp, rs6000, sh, sparc, sparclite, vax, we32k.
  99.  
  100.      Here are the recognized company names.  As you can see, customary
  101.      abbreviations are used rather than the longer official names.
  102.  
  103.           alliant, altos, apollo, att, bull, cbm, convergent, convex,
  104.           crds, dec, dg, dolphin, elxsi, encore, harris, hitachi, hp,
  105.           ibm, intergraph, isi, mips, motorola, ncr, next, ns, omron,
  106.           plexus, sequent, sgi, sony, sun, tti, unicom.
  107.  
  108.      The company name is meaningful only to disambiguate when the rest
  109.      of the information supplied is insufficient.  You can omit it,
  110.      writing just `CPU-SYSTEM', if it is not needed.  For example,
  111.      `vax-ultrix4.2' is equivalent to `vax-dec-ultrix4.2'.
  112.  
  113.      Here is a list of system types:
  114.  
  115.           aix, acis, aos, bsd, clix, ctix, dgux, dynix, genix, hpux,
  116.           isc, linux, luna, mach, minix, newsos, osf, osfrose, riscos,
  117.           sco, solaris, sunos, sysv, ultrix, unos, vms.
  118.  
  119.      You can omit the system type; then `configure' guesses the
  120.      operating system from the CPU and company.
  121.  
  122.      You can add a version number to the system type; this may or may
  123.      not make a difference.  For example, you can write `bsd4.3' or
  124.      `bsd4.4' to distinguish versions of BSD.  In practice, the version
  125.      number is most needed for `sysv3' and `sysv4', which are often
  126.      treated differently.
  127.  
  128.      If you specify an impossible combination such as `i860-dg-vms',
  129.      then you may get an error message from `configure', or it may
  130.      ignore part of the information and do the best it can with the
  131.      rest.  `configure' always prints the canonical name for the
  132.      alternative that it used.
  133.  
  134.      Often a particular model of machine has a name.  Many machine
  135.      names are recognized as aliases for CPU/company combinations.
  136.      Thus, the machine name `sun3', mentioned above, is an alias for
  137.      `m68k-sun'.  Sometimes we accept a company name as a machine name,
  138.      when the name is popularly used for a particular machine.  Here is
  139.      a table of the known machine names:
  140.  
  141.           3300, 3b1, 3bN, 7300, altos3068, altos, apollo68, att-7300,
  142.           balance, convex-cN, crds, decstation-3100, decstation, delta,
  143.           encore, fx2800, gmicro, hp7NN, hp8NN, hp9k2NN, hp9k3NN,
  144.           hp9k7NN, hp9k8NN, iris4d, iris, isi68, m3230, magnum, merlin,
  145.           miniframe, mmax, news-3600, news800, news, next, pbd, pc532,
  146.           pmax, ps2, risc-news, rtpc, sun2, sun386i, sun386, sun3,
  147.           sun4, symmetry, tower-32, tower.
  148.  
  149.      Remember that a machine name specifies both the cpu type and the
  150.      company name.
  151.  
  152.      There are four additional options you can specify independently to
  153.      describe variant hardware and software configurations.  These are
  154.      `--with-gnu-as', `--with-gnu-ld', `--with-stabs' and `--nfp'.
  155.  
  156.     `--with-gnu-as'
  157.           If you will use GNU CC with the GNU assembler (GAS), you
  158.           should declare this by using the `--with-gnu-as' option when
  159.           you run `configure'.
  160.  
  161.           Using this option does not install GAS.  It only modifies the
  162.           output of GNU CC to work with GAS.  Building and installing
  163.           GAS is up to you.
  164.  
  165.           The systems where it makes a difference whether you use GAS
  166.           are `i386-ANYTHING-sysv', `i860-ANYTHING-bsd',
  167.           `m68k-hp-hpux', `m68k-sony-bsd', `m68k-altos-sysv',
  168.           `m68000-hp-hpux', `m68000-att-sysv', and `mips-ANY').  On any
  169.           other system, `--with-gnu-as' has no effect.
  170.  
  171.           On the systems listed above, if you use GAS, you should also
  172.           use the GNU linker (and specify `--with-gnu-ld').
  173.  
  174.     `--with-gnu-ld'
  175.           Specify the option `--with-gnu-ld' if you plan to use the GNU
  176.           linker with GNU CC.
  177.  
  178.           This option does not cause the GNU linker to be installed; it
  179.           just modifies the behavior of GNU CC to work with the GNU
  180.           linker.  Specifically, it inhibits the installation of
  181.           `collect2', a program which otherwise serves as a front-end
  182.           for the system's linker on most configurations.
  183.  
  184.     `--with-stabs'
  185.           On MIPS based systems, you must specify whether you want GNU
  186.           CC to create the normal ECOFF debugging format, or to use
  187.           BSD-style stabs passed through the ECOFF symbol table.  The
  188.           normal ECOFF debug format cannot fully handle languages other
  189.           than C.  BSD stabs format can handle other languages, but it
  190.           only works with the GNU debugger GDB.
  191.  
  192.           Normally, GNU CC uses the ECOFF debugging format by default;
  193.           if you prefer BSD stabs, specify `--with-stabs' when you
  194.           configure GNU CC.
  195.  
  196.           No matter which default you choose when you configure GNU CC,
  197.           the user can use the `-gcoff' and `-gstabs+' options to
  198.           specify explicitly the debug format for a particular
  199.           compilation.
  200.  
  201.     `--nfp'
  202.           On certain systems, you must specify whether the machine has
  203.           a floating point unit.  These systems include
  204.           `m68k-sun-sunosN' and `m68k-isi-bsd'.  On any other system,
  205.           `--nfp' currently has no effect, though perhaps there are
  206.           other systems where it could usefully make a difference.
  207.  
  208.      If you want to install your own homemade configuration files, you
  209.      can use `local' as the company name to access them.  If you use
  210.      configuration `CPU-local', the configuration name without the cpu
  211.      prefix is used to form the configuration file names.
  212.  
  213.      Thus, if you specify `m68k-local', configuration uses files
  214.      `local.md', `local.h', `local.c', `xm-local.h', `t-local', and
  215.      `x-local', all in the directory `config/m68k'.
  216.  
  217.      Here is a list of configurations that have special treatment or
  218.      special things you must know:
  219.  
  220.     `alpha-*-osf1'
  221.           Systems using processors that implement the DEC Alpha
  222.           architecture and are running the OSF/1 operating system, for
  223.           example the DEC Alpha AXP systems.  (VMS on the Alpha is not
  224.           currently supported by GNU CC.)
  225.  
  226.           GNU CC writes a `.verstamp' directive to the assembler output
  227.           file unless it is built as a cross-compiler.  It gets the
  228.           version to use from the system header file
  229.           `/usr/include/stamp.h'.  If you install a new version of
  230.           OSF/1, you should rebuild GCC to pick up the new version
  231.           stamp.
  232.  
  233.           Note that since the Alpha is a 64-bit architecture,
  234.           cross-compilers from 32-bit machines will not generate as
  235.           efficient code as that generated when the compiler is running
  236.           on a 64-bit machine because many optimizations that depend on
  237.           being able to represent a word on the target in an integral
  238.           value on the host cannot be performed.  Building
  239.           cross-compilers for 32-bit machines that run on the Alpha has
  240.           not been tested and may not work properly.
  241.  
  242.     `a29k'
  243.           AMD Am29k-family processors.  These are normally used in
  244.           embedded applications.  There are no standard Unix
  245.           configurations.  This configuration corresponds to AMD's
  246.           standard calling sequence and binary interface and is
  247.           compatible with other 29k tools.
  248.  
  249.           You may need to make a variant of the file `a29k.h' for your
  250.           particular configuration.
  251.  
  252.     `a29k-*-bsd'
  253.           AMD Am29050 used in a system running a variant of BSD Unix.
  254.  
  255.     `elxsi-elxsi-bsd'
  256.           The Elxsi's C compiler has known limitations that prevent it
  257.           from compiling GNU C.  Please contact `mrs@cygnus.com' for
  258.           more details.
  259.  
  260.     `i386-*-sco'
  261.           Compilation with RCC is recommended.  Also, it may be a good
  262.           idea to link with GNU malloc instead of the malloc that comes
  263.           with the system.
  264.  
  265.     `i386-*-isc'
  266.           It may be good idea to link with GNU malloc instead of the
  267.           malloc that comes with the system.
  268.  
  269.     `i386-*-esix'
  270.           It may be good idea to link with GNU malloc instead of the
  271.           malloc that comes with the system.
  272.  
  273.     `i386-ibm-aix'
  274.           You need to use GAS version 2.1 or later, and and LD from GNU
  275.           binutils version 2.2 or later.
  276.  
  277.     `i386-sequent'
  278.           Go to the Berkeley universe before compiling.  In addition,
  279.           you probably need to create a file named `string.h'
  280.           containing just one line: `#include <strings.h>'.
  281.  
  282.     `i386-sun-sunos4'
  283.           You may find that you need another version of GNU CC to begin
  284.           bootstrapping with, since the current version when built with
  285.           the system's own compiler seems to get an infinite loop
  286.           compiling part of `libgcc2.c'.  GNU CC version 2 compiled
  287.           with GNU CC (any version) seems not to have this problem.
  288.  
  289.     `m68000-att'
  290.           AT&T 3b1, a.k.a. 7300 PC.  Special procedures are needed to
  291.           compile GNU CC with this machine's standard C compiler, due
  292.           to bugs in that compiler.  *Note 3b1 Install::.  You can
  293.           bootstrap it more easily with previous versions of GNU CC if
  294.           you have them.
  295.  
  296.     `m68000-hp-bsd'
  297.           HP 9000 series 200 running BSD.  Note that the C compiler
  298.           that comes with this system cannot compile GNU CC; contact
  299.           `law@cs.utah.edu' to get binaries of GNU CC for bootstrapping.
  300.  
  301.     `m68k-altos'
  302.           Altos 3068.  You must use the GNU assembler, linker and
  303.           debugger.  Also, you must fix a kernel bug.  Details in the
  304.           file `README.ALTOS'.
  305.  
  306.     `m68k-hp-hpux'
  307.           HP 9000 series 300 or 400 running HP-UX.  HP-UX version 8.0
  308.           has a bug in the assembler that prevents compilation of GNU
  309.           CC.  To fix it, get patch PHCO_0800 from HP.
  310.  
  311.           In addition, `--gas' does not currently work with this
  312.           configuration.  Changes in HP-UX have broken the library
  313.           conversion tool and the linker.
  314.  
  315.     `m68k-sun'
  316.           Sun 3.  We do not provide a configuration file to use the Sun
  317.           FPA by default, because programs that establish signal
  318.           handlers for floating point traps inherently cannot work with
  319.           the FPA.
  320.  
  321.     `m88k-*-svr3'
  322.           Motorola m88k running the AT&T/Unisoft/Motorola V.3 reference
  323.           port.  These systems tend to use the Green Hills C, revision
  324.           1.8.5, as the standard C compiler.  There are apparently bugs
  325.           in this compiler that result in object files differences
  326.           between stage 2 and stage 3.  If this happens, make the stage
  327.           4 compiler and compare it to the stage 3 compiler.  If the
  328.           stage 3 and stage 4 object files are identical, this suggests
  329.           you encountered a problem with the standard C compiler; the
  330.           stage 3 and 4 compilers may be usable.
  331.  
  332.           It is best, however, to use an older version of GNU CC for
  333.           bootstrapping if you have one.
  334.  
  335.     `m88k-*-dgux'
  336.           Motorola m88k running DG/UX.  To build native or cross
  337.           compilers on DG/UX, you must first change to the 88open BCS
  338.           software development environment.  This is done by issuing
  339.           this command:
  340.  
  341.                eval `sde-target m88kbcs`
  342.  
  343.     `m88k-tektronix-sysv3'
  344.           Tektronix XD88 running UTekV 3.2e.  Do not turn on
  345.           optimization while building stage1 if you bootstrap with the
  346.           buggy Green Hills compiler.  Also, The bundled LAI System V
  347.           NFS is buggy so if you build in an NFS mounted directory,
  348.           start from a fresh reboot, or avoid NFS all together.
  349.           Otherwise you may have trouble getting clean comparisons
  350.           between stages.
  351.  
  352.     `mips-mips-bsd'
  353.           MIPS machines running the MIPS operating system in BSD mode.
  354.           It's possible that some old versions of the system lack the
  355.           functions `memcpy', `memcmp', and `memset'.  If your system
  356.           lacks these, you must remove or undo the definition of
  357.           `TARGET_MEM_FUNCTIONS' in `mips-bsd.h'.
  358.  
  359.     `mips-sgi-*'
  360.           Silicon Graphics MIPS machines running IRIX.  In order to
  361.           compile GCC on an SGI the "c.hdr.lib" option must be
  362.           installed from the CD-ROM supplied from Silicon Graphics.
  363.           This is found on the 2nd CD in release 4.0.1.
  364.  
  365.     `mips-sony-sysv'
  366.           Sony MIPS NEWS.  This works in NEWSOS 5.0.1, but not in 5.0.2
  367.           (which uses ELF instead of COFF).  Support for 5.0.2 will
  368.           probably be provided soon by volunteers.  In particular, the
  369.           linker does not like the code generated by GCC when shared
  370.           libraries are linked in.
  371.  
  372.     `ns32k-encore'
  373.           Encore ns32000 system.  Encore systems are supported only
  374.           under BSD.
  375.  
  376.     `ns32k-*-genix'
  377.           National Semiconductor ns32000 system.  Genix has bugs in
  378.           `alloca' and `malloc'; you must get the compiled versions of
  379.           these from GNU Emacs.
  380.  
  381.     `ns32k-sequent'
  382.           Go to the Berkeley universe before compiling.  In addition,
  383.           you probably need to create a file named `string.h'
  384.           containing just one line: `#include <strings.h>'.
  385.  
  386.     `ns32k-utek'
  387.           UTEK ns32000 system ("merlin").  The C compiler that comes
  388.           with this system cannot compile GNU CC; contact
  389.           `tektronix!reed!mason' to get binaries of GNU CC for
  390.           bootstrapping.
  391.  
  392.     `romp-*-aos'
  393.     `romp-*-mach'
  394.           The only operating systems supported for the IBM RT PC are
  395.           AOS and MACH.  GNU CC does not support AIX running on the RT.
  396.           We recommend you compile GNU CC with an earlier version of
  397.           itself; if you compile GNU CC with `hc', the Metaware
  398.           compiler, it will work, but you will get mismatches between
  399.           the stage 2 and stage 3 compilers in various files.  These
  400.           errors are minor differences in some floating-point constants
  401.           and can be safely ignored; the stage 3 compiler is correct.
  402.  
  403.     `rs6000-*-aix'
  404.           *Read the file `README.RS6000' for information on how to get
  405.           a fix for problems in the IBM assembler that interfere with
  406.           GNU CC.* You must either obtain the new assembler or avoid
  407.           using the `-g' switch.  Note that `Makefile.in' uses `-g' by
  408.           default when compiling `libgcc2.c'.
  409.  
  410.     `vax-dec-ultrix'
  411.           Don't try compiling with Vax C (`vcc').  It produces
  412.           incorrect code in some cases (for example, when `alloca' is
  413.           used).
  414.  
  415.           Meanwhile, compiling `cp-parse.c' with pcc does not work
  416.           because of an internal table size limitation in that
  417.           compiler.  To avoid this problem, compile just the GNU C
  418.           compiler first, and use it to recompile building all the
  419.           languages that you want to run.
  420.  
  421.      Here we spell out what files will be set up by `configure'.
  422.      Normally you need not be concerned with these files.
  423.  
  424.         * A symbolic link named `config.h' is made to the top-level
  425.           config file for the machine you will run the compiler on
  426.           (*note Config::.).  This file is responsible for defining
  427.           information about the host machine.  It includes `tm.h'.
  428.  
  429.           The top-level config file is located in the subdirectory
  430.           `config'.  Its name is always `xm-SOMETHING.h'; usually
  431.           `xm-MACHINE.h', but there are some exceptions.
  432.  
  433.           If your system does not support symbolic links, you might
  434.           want to set up `config.h' to contain a `#include' command
  435.           which refers to the appropriate file.
  436.  
  437.         * A symbolic link named `tconfig.h' is made to the top-level
  438.           config file for your target machine.  This is used for
  439.           compiling certain programs to run on that machine.
  440.  
  441.         * A symbolic link named `tm.h' is made to the
  442.           machine-description macro file for your target machine.  It
  443.           should be in the subdirectory `config' and its name is often
  444.           `MACHINE.h'.
  445.  
  446.         * A symbolic link named `md' will be made to the machine
  447.           description pattern file.  It should be in the `config'
  448.           subdirectory and its name should be `MACHINE.md'; but MACHINE
  449.           is often not the same as the name used in the `tm.h' file
  450.           because the `md' files are more general.
  451.  
  452.         * A symbolic link named `aux-output.c' will be made to the
  453.           output subroutine file for your machine.  It should be in the
  454.           `config' subdirectory and its name should be `MACHINE.c'.
  455.  
  456.         * The command file `configure' also constructs the file
  457.           `Makefile' by adding some text to the template file
  458.           `Makefile.in'.  The additional text comes from files in the
  459.           `config' directory, named `t-TARGET' and `x-HOST'.  If these
  460.           files do not exist, it means nothing needs to be added for a
  461.           given target or host.
  462.  
  463.   4. The standard directory for installing GNU CC is `/usr/local/lib'.
  464.      If you want to install its files somewhere else, specify
  465.      `--prefix=DIR' when you run `configure'.  Here DIR is a directory
  466.      name to use instead of `/usr/local' for all purposes with one
  467.      exception: the directory `/usr/local/include' is searched for
  468.      header files no matter where you install the compiler.
  469.  
  470.   5. Specify `--local-prefix=DIR' if you want the compiler to search
  471.      directory `DIR/include' for header files *instead* of
  472.      `/usr/local/include'.  (This is for systems that have different
  473.      conventions for where to put site-specific things.)
  474.  
  475.   6. Make sure the Bison parser generator is installed.  (This is
  476.      unnecessary if the Bison output files `c-parse.c' and `cexp.c' are
  477.      more recent than `c-parse.y' and `cexp.y' and you do not plan to
  478.      change the `.y' files.)
  479.  
  480.      Bison versions older than Sept 8, 1988 will produce incorrect
  481.      output for `c-parse.c'.
  482.  
  483.   7. Build the compiler.  Just type `make LANGUAGES=c' in the compiler
  484.      directory.
  485.  
  486.      `LANGUAGES=c' specifies that only the C compiler should be
  487.      compiled.  The makefile normally builds compilers for all the
  488.      supported languages; currently, C, C++ and Objective C.  However,
  489.      C is the only language that is sure to work when you build with
  490.      other non-GNU C compilers.  In addition, building anything but C
  491.      at this stage is a waste of time.
  492.  
  493.      In general, you can specify the languages to build by typing the
  494.      argument `LANGUAGES="LIST"', where LIST is one or more words from
  495.      the list `c', `c++', and `objective-c'.
  496.  
  497.      Ignore any warnings you may see about "statement not reached" in
  498.      `insn-emit.c'; they are normal.  Also, warnings about "unknown
  499.      escape sequence" are normal in `genopinit.c' and perhaps some
  500.      other files.  Any other compilation errors may represent bugs in
  501.      the port to your machine or operating system, and should be
  502.      investigated and reported (*note Bugs::.).
  503.  
  504.      Some commercial compilers fail to compile GNU CC because they have
  505.      bugs or limitations.  For example, the Microsoft compiler is said
  506.      to run out of macro space.  Some Ultrix compilers run out of
  507.      expression space; then you need to break up the statement where
  508.      the problem happens.
  509.  
  510.      If you are building with a previous GNU C compiler, do not use
  511.      `CC=gcc' on the make command or by editing the Makefile.  Instead,
  512.      use a full pathname to specify the compiler, such as
  513.      `CC=/usr/local/bin/gcc'.  This is because make might execute the
  514.      `gcc' in the current directory before all of the compiler
  515.      components have been built.
  516.  
  517.   8. If you are building a cross-compiler, stop here.  *Note
  518.      Cross-Compiler::.
  519.  
  520.   9. Move the first-stage object files and executables into a
  521.      subdirectory with this command:
  522.  
  523.           make stage1
  524.  
  525.      The files are moved into a subdirectory named `stage1'.  Once
  526.      installation is complete, you may wish to delete these files with
  527.      `rm -r stage1'.
  528.  
  529.  10. If you have chosen a configuration for GNU CC which requires other
  530.      GNU tools (such as GAS or the GNU linker) instead of the standard
  531.      system tools, install the required tools in the `stage1'
  532.      subdirectory under the names `as', `ld' or whatever is
  533.      appropriate.  This will enable the stage 1 compiler to find the
  534.      proper tools in the following stage.
  535.  
  536.      Alternatively, you can do subsequent compilation using a value of
  537.      the `PATH' environment variable such that the necessary GNU tools
  538.      come before the standard system tools.
  539.  
  540.  11. Recompile the compiler with itself, with this command:
  541.  
  542.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"
  543.  
  544.      This is called making the stage 2 compiler.
  545.  
  546.      The command shown above builds compilers for all the supported
  547.      languages.  If you don't want them all, you can specify the
  548.      languages to build by typing the argument `LANGUAGES="LIST"'.  LIST
  549.      should contain one or more words from the list `c', `c++',
  550.      `objective-c', and `proto'.  Separate the words with spaces.
  551.      `proto' stands for the programs `protoize' and `unprotoize'; they
  552.      are not a separate language, but you use `LANGUAGES' to enable or
  553.      disable their installation.
  554.  
  555.      If you are going to build the stage 3 compiler, then you might
  556.      want to build only the C language in stage 2.
  557.  
  558.      Once you have built the stage 2 compiler, if you are short of disk
  559.      space, you can delete the subdirectory `stage1'.
  560.  
  561.      On a 68000 or 68020 system lacking floating point hardware, unless
  562.      you have selected a `tm.h' file that expects by default that there
  563.      is no such hardware, do this instead:
  564.  
  565.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O -msoft-float"
  566.  
  567.  12. If you wish to test the compiler by compiling it with itself one
  568.      more time, install any other necessary GNU tools (such as GAS or
  569.      the GNU linker) in the `stage2' subdirectory as you did in the
  570.      `stage1' subdirectory, then do this:
  571.  
  572.           make stage2
  573.           make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  574.  
  575.      This is called making the stage 3 compiler.  Aside from the `-B'
  576.      option, the compiler options should be the same as when you made
  577.      the stage 2 compiler.  But the `LANGUAGES' option need not be the
  578.      same.  The command shown above builds compilers for all the
  579.      supported languages; if you don't want them all, you can specify
  580.      the languages to build by typing the argument `LANGUAGES="LIST"',
  581.      as described above.
  582.  
  583.      Then compare the latest object files with the stage 2 object
  584.      files--they ought to be identical, unless they contain time stamps.
  585.      You can compare the files, disregarding the time stamps if any,
  586.      like this:
  587.  
  588.           make compare
  589.  
  590.      This will mention any object files that differ between stage 2 and
  591.      stage 3.  Any difference, no matter how innocuous, indicates that
  592.      the stage 2 compiler has compiled GNU CC incorrectly, and is
  593.      therefore a potentially serious bug which you should investigate
  594.      and report (*note Bugs::.).
  595.  
  596.      If your system does not put time stamps in the object files, then
  597.      this is a faster way to compare them (using the Bourne shell):
  598.  
  599.           for file in *.o; do
  600.           cmp $file stage2/$file
  601.           done
  602.  
  603.      If you have built the compiler with the `-mno-mips-tfile' option on
  604.      MIPS machines, you will not be able to compare the files.
  605.  
  606.      The Alpha stores file names in the object files and `make compare'
  607.      does not know how to ignore them, so normally you cannot compare
  608.      on the Alpha.  However, if you use the `-save-temps' option when
  609.      compiling *both* stage 2 and stage 3, this causes the same file
  610.      names to be used in both stages; then you can do the comparison.
  611.  
  612.  13. Install the compiler driver, the compiler's passes and run-time
  613.      support with `make install'.  Use the same value for `CC',
  614.      `CFLAGS' and `LANGUAGES' that you used when compiling the files
  615.      that are being installed.  One reason this is necessary is that
  616.      some versions of Make have bugs and recompile files gratuitously
  617.      when you do this step.  If you use the same variable values, those
  618.      files will be recompiled properly.
  619.  
  620.      For example, if you have built the stage 2 compiler, you can use
  621.      the following command:
  622.  
  623.           make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST"
  624.  
  625.      This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1',
  626.      `cpp' and `libgcc.a' in the directory
  627.      `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the
  628.      compiler driver program looks for them.  Here TARGET is the target
  629.      machine type specified when you ran `configure', and VERSION is
  630.      the version number of GNU CC.  This naming scheme permits various
  631.      versions and/or cross-compilers to coexist.
  632.  
  633.      This also copies the driver program `xgcc' into
  634.      `/usr/local/bin/gcc', so that it appears in typical execution
  635.      search paths.
  636.  
  637.      On some systems, this command causes recompilation of some files.
  638.      This is usually due to bugs in `make'.  You should either ignore
  639.      this problem, or use GNU Make.
  640.  
  641.      *Warning: there is a bug in `alloca' in the Sun library.  To avoid
  642.      this bug, be sure to install the executables of GNU CC that were
  643.      compiled by GNU CC.  (That is, the executables from stage 2 or 3,
  644.      not stage 1.)  They use `alloca' as a built-in function and never
  645.      the one in the library.*
  646.  
  647.      (It is usually better to install GNU CC executables from stage 2
  648.      or 3, since they usually run faster than the ones compiled with
  649.      some other compiler.)
  650.  
  651.  14. Install the Objective C library (if you have built the Objective C
  652.      compiler).  Here is the command to do this:
  653.  
  654.           make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  655.  
  656.  15. If you're going to use C++, it's likely that you need to also
  657.      install the libg++ distribution.  It should be available from the
  658.      same place where you got the GNU C distribution.  Just as GNU C
  659.      does not distribute a C runtime library, it also does not include
  660.      a C++ run-time library.  All I/O functionality, special class
  661.      libraries, etc., are available in the libg++ distribution.
  662.  
  663. 
  664. File: gcc.info,  Node: Other Dir,  Next: Cross-Compiler,  Up: Installation
  665.  
  666. Compilation in a Separate Directory
  667. ===================================
  668.  
  669.    If you wish to build the object files and executables in a directory
  670. other than the one containing the source files, here is what you must
  671. do differently:
  672.  
  673.   1. Make sure you have a version of Make that supports the `VPATH'
  674.      feature.  (GNU Make supports it, as do Make versions on most BSD
  675.      systems.)
  676.  
  677.   2. If you have ever run `configure' in the source directory, you must
  678.      undo the configuration.  Do this by running:
  679.  
  680.           make distclean
  681.  
  682.   3. Go to the directory in which you want to build the compiler before
  683.      running `configure':
  684.  
  685.           mkdir gcc-sun3
  686.           cd gcc-sun3
  687.  
  688.      On systems that do not support symbolic links, this directory must
  689.      be on the same file system as the source code directory.
  690.  
  691.   4. Specify where to find `configure' when you run it:
  692.  
  693.           ../gcc/configure ...
  694.  
  695.      This also tells `configure' where to find the compiler sources;
  696.      `configure' takes the directory from the file name that was used to
  697.      invoke it.  But if you want to be sure, you can specify the source
  698.      directory with the `--srcdir' option, like this:
  699.  
  700.           ../gcc/configure --srcdir=../gcc sun3
  701.  
  702.      The directory you specify with `--srcdir' need not be the same as
  703.      the one that `configure' is found in.
  704.  
  705.    Now, you can run `make' in that directory.  You need not repeat the
  706. configuration steps shown above, when ordinary source files change.  You
  707. must, however, run `configure' again when the configuration files
  708. change, if your system does not support symbolic links.
  709.  
  710. 
  711. File: gcc.info,  Node: Cross-Compiler,  Next: PA Install,  Prev: Other Dir,  Up: Installation
  712.  
  713. Building and Installing a Cross-Compiler
  714. ========================================
  715.  
  716.    GNU CC can function as a cross-compiler for many machines, but not
  717. all.
  718.  
  719.    * Cross-compilers for the Mips as target currently do not work
  720.      because the auxiliary programs `mips-tdump.c' and `mips-tfile.c'
  721.      can't be compiled on anything but a Mips.
  722.  
  723.    * Cross-compilers to or from the Vax probably don't work completely
  724.      because the Vax uses an incompatible floating point format (not
  725.      IEEE format).
  726.  
  727.    Since GNU CC generates assembler code, you probably need a
  728. cross-assembler that GNU CC can run, in order to produce object files.
  729. If you want to link on other than the target machine, you need a
  730. cross-linker as well.  You also need header files and libraries suitable
  731. for the target machine that you can install on the host machine.
  732.  
  733.    To build GNU CC as a cross-compiler, you start out by running
  734. `configure'.  You must specify two different configurations, the host
  735. and the target.  Use the `--host=HOST' option for the host and
  736. `--target=TARGET' to specify the target type.  For example, here is how
  737. to configure for a cross-compiler that runs on a hypothetical Intel 386
  738. system and produces code for an HP 68030 system running BSD:
  739.  
  740.      configure --target=m68k-hp-bsd4.3 --host=i386-bozotheclone-bsd4.3
  741.  
  742.    Next you should install the cross-assembler and cross-linker (and
  743. `ar' and `ranlib').  Put them in the directory `/usr/local/TARGET/bin'.
  744. The installation of GNU CC will find them there and copy or link them
  745. to the proper place to find them when you run the cross-compiler later.
  746.  
  747.    If you want to install any additional libraries to use with the
  748. cross-compiler, put them in the directory `/usr/local/TARGET/lib'; all
  749. files in that subdirectory will be installed in the proper place when
  750. you install the cross-compiler.  Likewise, put the header files for the
  751. target machine in `/usr/local/TARGET/include'.
  752.  
  753.    You must now produce a substitute for `libgcc1.a'.  Normally this
  754. file is compiled with the "native compiler" for the target machine;
  755. compiling it with GNU CC does not work.  But compiling it with the host
  756. machine's compiler also doesn't work--that produces a file that would
  757. run on the host, and you need it to run on the target.
  758.  
  759.    We can't give you any automatic way to produce this substitute.  For
  760. some targets, the subroutines in `libgcc1.c' are not actually used.
  761. You need not provide the ones that won't be used.  The ones that most
  762. commonly are used are the multiplication, division and remainder
  763. routines--many RISC machines rely on the library for this.  One way to
  764. make them work is to define the appropriate `perform_...' macros for
  765. the subroutines that you need.  If these definitions do not use the C
  766. arithmetic operators that they are meant to implement, you might be
  767. able to compile them with the cross-compiler you are building.  To do
  768. this, specify `LIBGCC1=libgcc1.a OLDCC=./xgcc' when building the
  769. compiler.
  770.  
  771.    Now you can proceed just as for compiling a single-machine compiler
  772. through the step of building stage 1.  If you have not provided some
  773. sort of `libgcc1.a', then compilation will give up at the point where
  774. it needs that file, printing a suitable error message.  If you do
  775. provide `libgcc1.a', then building the compiler will automatically
  776. compile and link a test program called `cross-test'; if you get errors
  777. in the linking, it means that not all of the necessary routines in
  778. `libgcc1.a' are available.
  779.  
  780.    When you are using a cross-compiler configuration, building stage 1
  781. does not compile all of GNU CC.  This is because one part of building,
  782. the compilation of `libgcc2.c', requires use of the cross-compiler.
  783.  
  784.    However, when you type `make install' to install the bulk of the
  785. cross-compiler, that will also compile `libgcc2.c' and install the
  786. resulting `libgcc.a'.
  787.  
  788.    Do not try to build stage 2 for a cross-compiler.  It doesn't work to
  789. rebuild GNU CC as a cross-compiler using the cross-compiler, because
  790. that would produce a program that runs on the target machine, not on the
  791. host.  For example, if you compile a 386-to-68030 cross-compiler with
  792. itself, the result will not be right either for the 386 (because it was
  793. compiled into 68030 code) or for the 68030 (because it was configured
  794. for a 386 as the host).  If you want to compile GNU CC into 68030 code,
  795. whether you compile it on a 68030 or with a cross-compiler on a 386, you
  796. must specify a 68030 as the host when you configure it.
  797.  
  798. 
  799. File: gcc.info,  Node: PA Install,  Next: Sun Install,  Prev: Cross-Compiler,  Up: Installation
  800.  
  801. Installing on the HP Precision Architecture
  802. ===========================================
  803.  
  804.    There are two variants of this CPU, called 1.0 and 1.1, which have
  805. different machine descriptions.  You must use the right one for your
  806. machine.  All 7NN machines and 8N7 machines use 1.1, while all other
  807. 8NN machines use 1.0.
  808.  
  809.    The easiest way to handle this problem is to use `configure hpNNN'
  810. or `configure hpNNN-hpux', where NNN is the model number of the
  811. machine.  Then `configure' will figure out if the machine is a 1.0 or
  812. 1.1.  Use `uname -a' to find out the model number of your machine.
  813.  
  814.    `-g' does not work on HP-UX, since that system uses a peculiar
  815. debugging format which GNU CC does not know about.  There are
  816. preliminary versions of GAS and GDB for the HP-PA which do work with
  817. GNU CC for debugging.  You can get them by anonymous ftp from
  818. `jaguar.cs.utah.edu' `dist' subdirectory.  You would need to install
  819. GAS in the file
  820.  
  821.      /usr/local/lib/gcc-lib/CONFIGURATION/GCCVERSION/as
  822.  
  823. where CONFIGURATION is the configuration name (perhaps `hpNNN-hpux')
  824. and GCCVERSION is the GNU CC version number.  Do this *before* starting
  825. the build process, otherwise you will get errors from the HPUX
  826. assembler while building `libgcc2.a'.  The command
  827.  
  828.      make install-dir
  829.  
  830. will create the necessary directory hierarchy so you can install GAS
  831. before building GCC.
  832.  
  833.    If you obtained GAS before October 6, 1992 it is highly recommended
  834. you get a new one to avoid several bugs which have been discovered
  835. recently.
  836.  
  837.    To enable debugging, configure GNU CC with the `--gas' option before
  838. building.
  839.  
  840.    It has been reported that GNU CC produces invalid assembly code for
  841. 1.1 machines running HP-UX 8.02 when using the HP assembler.  Typically
  842. the errors look like this:
  843.      as: bug.s @line#15 [err#1060]
  844.        Argument 0 or 2 in FARG upper
  845.               - lookahead = ARGW1=FR,RTNVAL=GR
  846.      as: foo.s @line#28 [err#1060]
  847.        Argument 0 or 2 in FARG upper
  848.               - lookahead = ARGW1=FR
  849.  
  850.    You can check the version of HP-UX you are running by executing the
  851. command `uname -r'.   If you are indeed running HP-UX 8.02 on a 1.1
  852. machine and using the HP assembler then configure GCC with
  853. "hp700-hpux8.02".
  854.  
  855. 
  856. File: gcc.info,  Node: Sun Install,  Next: 3b1 Install,  Prev: PA Install,  Up: Installation
  857.  
  858. Installing GNU CC on the Sun
  859. ============================
  860.  
  861.    On Solaris (version 2.1), do not use the linker or other tools in
  862. `/usr/ucb' to build GNU CC.  Use `/usr/ccs/bin'.
  863.  
  864.    Make sure the environment variable `FLOAT_OPTION' is not set when
  865. you compile `libgcc.a'.  If this option were set to `f68881' when
  866. `libgcc.a' is compiled, the resulting code would demand to be linked
  867. with a special startup file and would not link properly without special
  868. pains.
  869.  
  870.    There is a bug in `alloca' in certain versions of the Sun library.
  871. To avoid this bug, install the binaries of GNU CC that were compiled by
  872. GNU CC.  They use `alloca' as a built-in function and never the one in
  873. the library.
  874.  
  875.    Some versions of the Sun compiler crash when compiling GNU CC.  The
  876. problem is a segmentation fault in cpp.  This problem seems to be due to
  877. the bulk of data in the environment variables.  You may be able to avoid
  878. it by using the following command to compile GNU CC with Sun CC:
  879.  
  880.      make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"
  881.  
  882. 
  883. File: gcc.info,  Node: 3b1 Install,  Next: Unos Install,  Prev: Sun Install,  Up: Installation
  884.  
  885. Installing GNU CC on the 3b1
  886. ============================
  887.  
  888.    Installing GNU CC on the 3b1 is difficult if you do not already have
  889. GNU CC running, due to bugs in the installed C compiler.  However, the
  890. following procedure might work.  We are unable to test it.
  891.  
  892.   1. Comment out the `#include "config.h"' line on line 37 of `cccp.c'
  893.      and do `make cpp'.  This makes a preliminary version of GNU cpp.
  894.  
  895.   2. Save the old `/lib/cpp' and copy the preliminary GNU cpp to that
  896.      file name.
  897.  
  898.   3. Undo your change in `cccp.c', or reinstall the original version,
  899.      and do `make cpp' again.
  900.  
  901.   4. Copy this final version of GNU cpp into `/lib/cpp'.
  902.  
  903.   5. Replace every occurrence of `obstack_free' in the file `tree.c'
  904.      with `_obstack_free'.
  905.  
  906.   6. Run `make' to get the first-stage GNU CC.
  907.  
  908.   7. Reinstall the original version of `/lib/cpp'.
  909.  
  910.   8. Now you can compile GNU CC with itself and install it in the normal
  911.      fashion.
  912.  
  913. 
  914. File: gcc.info,  Node: Unos Install,  Next: VMS Install,  Prev: 3b1 Install,  Up: Installation
  915.  
  916. Installing GNU CC on Unos
  917. =========================
  918.  
  919.    Use `configure unos' for building on Unos.
  920.  
  921.    The Unos assembler is named `casm' instead of `as'.  For some
  922. strange reason linking `/bin/as' to `/bin/casm' changes the behavior,
  923. and does not work.  So, when installing GNU CC, you should install the
  924. following script as `as' in the subdirectory where the passes of GCC
  925. are installed:
  926.  
  927.      #!/bin/sh
  928.      casm $*
  929.  
  930.    The default Unos library is named `libunos.a' instead of `libc.a'.
  931. To allow GNU CC to function, either change all references to `-lc' in
  932. `gcc.c' to `-lunos' or link `/lib/libc.a' to `/lib/libunos.a'.
  933.  
  934.    When compiling GNU CC with the standard compiler, to overcome bugs in
  935. the support of `alloca', do not use `-O' when making stage 2.  Then use
  936. the stage 2 compiler with `-O' to make the stage 3 compiler.  This
  937. compiler will have the same characteristics as the usual stage 2
  938. compiler on other systems.  Use it to make a stage 4 compiler and
  939. compare that with stage 3 to verify proper compilation.
  940.  
  941.    (Perhaps simply defining `ALLOCA' in `x-crds' as described in the
  942. comments there will make the above paragraph superfluous.  Please
  943. inform us of whether this works.)
  944.  
  945.    Unos uses memory segmentation instead of demand paging, so you will
  946. need a lot of memory.  5 Mb is barely enough if no other tasks are
  947. running.  If linking `cc1' fails, try putting the object files into a
  948. library and linking from that library.
  949.  
  950.