home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / gnu / gcc-2.5.8-bin.lha / info / gcc.info-5 < prev    next >
Encoding:
GNU Info File  |  1994-02-21  |  48.8 KB  |  1,117 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.55 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. * Header Dirs::   Understanding the standard header file directories.
  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.      If you are building a compiler to produce code for the machine it
  72.      runs on, specify just one machine type, with the `--target'
  73.      option; the host type will default to be the same as the target.
  74.      (For information on building a cross-compiler, see *Note
  75.      Cross-Compiler::.)  Here is an example:
  76.  
  77.           configure --target=sparc-sun-sunos4.1
  78.  
  79.      If you run `configure' without specifying configuration arguments,
  80.      `configure' tries to guess the type of host you are on, and uses
  81.      that configuration type for both host and target.  So you don't
  82.      need to specify a configuration, for building a native compiler,
  83.      unless `configure' cannot figure out what your configuration is.
  84.  
  85.      A configuration name may be canonical or it may be more or less
  86.      abbreviated.
  87.  
  88.      A canonical configuration name has three parts, separated by
  89.      dashes.  It looks like this: `CPU-COMPANY-SYSTEM'.  (The three
  90.      parts may themselves contain dashes; `configure' can figure out
  91.      which dashes serve which purpose.)  For example,
  92.      `m68k-sun-sunos4.1' specifies a Sun 3.
  93.  
  94.      You can also replace parts of the configuration by nicknames or
  95.      aliases.  For example, `sun3' stands for `m68k-sun', so
  96.      `sun3-sunos4.1' is another way to specify a Sun 3.  You can also
  97.      use simply `sun3-sunos', since the version of SunOS is assumed by
  98.      default to be version 4.  `sun3-bsd' also works, since `configure'
  99.      knows that the only BSD variant on a Sun 3 is SunOS.
  100.  
  101.      You can specify a version number after any of the system types,
  102.      and some of the CPU types.  In most cases, the version is
  103.      irrelevant, and will be ignored.  So you might as well specify the
  104.      version if you know it.
  105.  
  106.      Here are the possible CPU types:
  107.  
  108.           a29k, alpha, arm, cN, clipper, elxsi, h8300, hppa1.0, hppa1.1,
  109.           i370, i386, i486, i860, i960, m68000, m68k, m88k, mips,
  110.           ns32k, pyramid, romp, rs6000, sh, sparc, sparclite, vax,
  111.           we32k.
  112.  
  113.      Here are the recognized company names.  As you can see, customary
  114.      abbreviations are used rather than the longer official names.
  115.  
  116.           alliant, altos, apollo, att, bull, cbm, convergent, convex,
  117.           crds, dec, dg, dolphin, elxsi, encore, harris, hitachi, hp,
  118.           ibm, intergraph, isi, mips, motorola, ncr, next, ns, omron,
  119.           plexus, sequent, sgi, sony, sun, tti, unicom.
  120.  
  121.      The company name is meaningful only to disambiguate when the rest
  122.      of the information supplied is insufficient.  You can omit it,
  123.      writing just `CPU-SYSTEM', if it is not needed.  For example,
  124.      `vax-ultrix4.2' is equivalent to `vax-dec-ultrix4.2'.
  125.  
  126.      Here is a list of system types:
  127.  
  128.           aix, acis, aos, bsd, clix, ctix, dgux, dynix, genix, hpux,
  129.           isc, linux, luna, lynxos, mach, minix, newsos, osf, osfrose,
  130.           riscos, sco, solaris, sunos, sysv, ultrix, unos, vms.
  131.  
  132.      You can omit the system type; then `configure' guesses the
  133.      operating system from the CPU and company.
  134.  
  135.      You can add a version number to the system type; this may or may
  136.      not make a difference.  For example, you can write `bsd4.3' or
  137.      `bsd4.4' to distinguish versions of BSD.  In practice, the version
  138.      number is most needed for `sysv3' and `sysv4', which are often
  139.      treated differently.
  140.  
  141.      If you specify an impossible combination such as `i860-dg-vms',
  142.      then you may get an error message from `configure', or it may
  143.      ignore part of the information and do the best it can with the
  144.      rest.  `configure' always prints the canonical name for the
  145.      alternative that it used.
  146.  
  147.      Often a particular model of machine has a name.  Many machine
  148.      names are recognized as aliases for CPU/company combinations.
  149.      Thus, the machine name `sun3', mentioned above, is an alias for
  150.      `m68k-sun'.  Sometimes we accept a company name as a machine name,
  151.      when the name is popularly used for a particular machine.  Here is
  152.      a table of the known machine names:
  153.  
  154.           3300, 3b1, 3bN, 7300, altos3068, altos, apollo68, att-7300,
  155.           balance, convex-cN, crds, decstation-3100, decstation, delta,
  156.           encore, fx2800, gmicro, hp7NN, hp8NN, hp9k2NN, hp9k3NN,
  157.           hp9k7NN, hp9k8NN, iris4d, iris, isi68, m3230, magnum, merlin,
  158.           miniframe, mmax, news-3600, news800, news, next, pbd, pc532,
  159.           pmax, ps2, risc-news, rtpc, sun2, sun386i, sun386, sun3,
  160.           sun4, symmetry, tower-32, tower.
  161.  
  162.      Remember that a machine name specifies both the cpu type and the
  163.      company name.
  164.  
  165.      There are four additional options you can specify independently to
  166.      describe variant hardware and software configurations.  These are
  167.      `--with-gnu-as', `--with-gnu-ld', `--with-stabs' and `--nfp'.
  168.  
  169.     `--with-gnu-as'
  170.           If you will use GNU CC with the GNU assembler (GAS), you
  171.           should declare this by using the `--with-gnu-as' option when
  172.           you run `configure'.
  173.  
  174.           Using this option does not install GAS.  It only modifies the
  175.           output of GNU CC to work with GAS.  Building and installing
  176.           GAS is up to you.
  177.  
  178.           Conversely, if you *do not* wish to use GAS and do not specify
  179.           `--with-gnu-as' when building GNU CC, it is up to you to make
  180.           sure that GAS is not installed.  GNU CC searches for a
  181.           program named `as' in various directories; if the program it
  182.           finds is GAS, then it runs GAS.  If you are not sure where
  183.           GNU CC finds the assembler it is using, try specifying `-v'
  184.           when you run it.
  185.  
  186.           The systems where it makes a difference whether you use GAS
  187.           are
  188.           `hppa1.0-ANY-ANY', `hppa1.1-ANY-ANY', `i386-ANY-sysv',
  189.           `i386-ANY-isc',
  190.           `i860-ANY-bsd', `m68k-bull-sysv', `m68k-hp-hpux',
  191.           `m68k-sony-bsd',
  192.           `m68k-altos-sysv', `m68000-hp-hpux', `m68000-att-sysv', and
  193.           `mips-ANY').  On any other system, `--with-gnu-as' has no
  194.           effect.
  195.  
  196.           On the systems listed above (except for the HP-PA and for ISC
  197.           on the 386), if you use GAS, you should also use the GNU
  198.           linker (and specify `--with-gnu-ld').
  199.  
  200.     `--with-gnu-ld'
  201.           Specify the option `--with-gnu-ld' if you plan to use the GNU
  202.           linker with GNU CC.
  203.  
  204.           This option does not cause the GNU linker to be installed; it
  205.           just modifies the behavior of GNU CC to work with the GNU
  206.           linker.  Specifically, it inhibits the installation of
  207.           `collect2', a program which otherwise serves as a front-end
  208.           for the system's linker on most configurations.
  209.  
  210.     `--with-stabs'
  211.           On MIPS based systems and on Alphas, you must specify whether
  212.           you want GNU CC to create the normal ECOFF debugging format,
  213.           or to use BSD-style stabs passed through the ECOFF symbol
  214.           table.  The normal ECOFF debug format cannot fully handle
  215.           languages other than C.  BSD stabs format can handle other
  216.           languages, but it only works with the GNU debugger GDB.
  217.  
  218.           Normally, GNU CC uses the ECOFF debugging format by default;
  219.           if you prefer BSD stabs, specify `--with-stabs' when you
  220.           configure GNU CC.
  221.  
  222.           No matter which default you choose when you configure GNU CC,
  223.           the user can use the `-gcoff' and `-gstabs+' options to
  224.           specify explicitly the debug format for a particular
  225.           compilation.
  226.  
  227.           `--with-stabs' is meaningful on the ISC system on the 386,
  228.           also, if `--with-gas' is used.  It selects use of stabs
  229.           debugging information embedded in COFF output.  This kind of
  230.           debugging information supports C++ well; ordinary COFF
  231.           debugging information does not.
  232.  
  233.     `--nfp'
  234.           On certain systems, you must specify whether the machine has
  235.           a floating point unit.  These systems include
  236.           `m68k-sun-sunosN' and `m68k-isi-bsd'.  On any other system,
  237.           `--nfp' currently has no effect, though perhaps there are
  238.           other systems where it could usefully make a difference.
  239.  
  240.      If you want to install your own homemade configuration files, you
  241.      can use `local' as the company name to access them.  If you use
  242.      configuration `CPU-local', the configuration name without the cpu
  243.      prefix is used to form the configuration file names.
  244.  
  245.      Thus, if you specify `m68k-local', configuration uses files
  246.      `local.md', `local.h', `local.c', `xm-local.h', `t-local', and
  247.      `x-local', all in the directory `config/m68k'.
  248.  
  249.      Here is a list of configurations that have special treatment or
  250.      special things you must know:
  251.  
  252.     `alpha-*-osf1'
  253.           Systems using processors that implement the DEC Alpha
  254.           architecture and are running the OSF/1 operating system, for
  255.           example the DEC Alpha AXP systems.  (VMS on the Alpha is not
  256.           currently supported by GNU CC.)
  257.  
  258.           Objective C and C++ do not yet work on the Alpha.  We hope to
  259.           support C++ in version 2.6.
  260.  
  261.           GNU CC writes a `.verstamp' directive to the assembler output
  262.           file unless it is built as a cross-compiler.  It gets the
  263.           version to use from the system header file
  264.           `/usr/include/stamp.h'.  If you install a new version of
  265.           OSF/1, you should rebuild GCC to pick up the new version
  266.           stamp.
  267.  
  268.           Note that since the Alpha is a 64-bit architecture,
  269.           cross-compilers from 32-bit machines will not generate as
  270.           efficient code as that generated when the compiler is running
  271.           on a 64-bit machine because many optimizations that depend on
  272.           being able to represent a word on the target in an integral
  273.           value on the host cannot be performed.  Building
  274.           cross-compilers on the Alpha for 32-bit machines has only
  275.           been tested in a few cases and may not work properly.
  276.  
  277.           `make compare' may fail on some versions of OSF/1 unless you
  278.           add `-save-temps' to `CFLAGS'.  The same problem occurs on
  279.           Irix version 5.1.1.  On these systems, the name of the
  280.           assembler input file is stored in the object file, and that
  281.           makes comparison fail if it differs between the `stage1' and
  282.           `stage2' compilations.  The option `-save-temps' forces a
  283.           fixed name to be used for the assembler input file, instead
  284.           of a randomly chosen name in `/tmp'.
  285.  
  286.           GNU CC now supports both the native (ECOFF) debugging format
  287.           used by DBX and GDB and an encapsulated STABS format for use
  288.           only with GDB.  See the discussion of the `--with-stabs'
  289.           option of `configure' above for more information on these
  290.           formats and how to select them.
  291.  
  292.           There is a bug in DEC's assembler that produces incorrect
  293.           line numbers for ECOFF format when the `.align' directive is
  294.           used.  To work around this problem, GNU CC will not emit such
  295.           alignment directives even if optimization is being performed
  296.           if it is writing ECOFF format debugging information.
  297.           Unfortunately, this has the very undesirable side-effect that
  298.           code addresses when `-O' is specified are different depending
  299.           on whether or not `-g' is also specified.
  300.  
  301.           To avoid this behavior, specify `-gstabs+' and use GDB
  302.           instead of DBX.  DEC is now aware of this problem with the
  303.           assembler and hopes to provide a fix shortly.
  304.  
  305.     `a29k'
  306.           AMD Am29k-family processors.  These are normally used in
  307.           embedded applications.  There are no standard Unix
  308.           configurations.  This configuration corresponds to AMD's
  309.           standard calling sequence and binary interface and is
  310.           compatible with other 29k tools.
  311.  
  312.           You may need to make a variant of the file `a29k.h' for your
  313.           particular configuration.
  314.  
  315.     `a29k-*-bsd'
  316.           AMD Am29050 used in a system running a variant of BSD Unix.
  317.  
  318.     `elxsi-elxsi-bsd'
  319.           The Elxsi's C compiler has known limitations that prevent it
  320.           from compiling GNU C.  Please contact `mrs@cygnus.com' for
  321.           more details.
  322.  
  323.     `hppa*-*-*'
  324.           Using GAS is highly recommended for all HP-PA configurations.
  325.           See *Note PA Install:: for the special procedures needed to
  326.           compile GNU CC for the HP-PA.
  327.  
  328.     `i386-*-sco'
  329.           Compilation with RCC is recommended.  Also, it may be a good
  330.           idea to link with GNU malloc instead of the malloc that comes
  331.           with the system.
  332.  
  333.     `i386-*-sco3.2.4'
  334.           Use this configuration for SCO release 3.2 version 4.
  335.  
  336.     `i386-*-isc'
  337.           It may be good idea to link with GNU malloc instead of the
  338.           malloc that comes with the system.
  339.  
  340.     `i386-*-esix'
  341.           It may be good idea to link with GNU malloc instead of the
  342.           malloc that comes with the system.
  343.  
  344.     `i386-ibm-aix'
  345.           You need to use GAS version 2.1 or later, and and LD from GNU
  346.           binutils version 2.2 or later.
  347.  
  348.     `i386-sequent'
  349.           Go to the Berkeley universe before compiling.  In addition,
  350.           you probably need to create a file named `string.h'
  351.           containing just one line: `#include <strings.h>'.
  352.  
  353.     `i386-sun-sunos4'
  354.           You may find that you need another version of GNU CC to begin
  355.           bootstrapping with, since the current version when built with
  356.           the system's own compiler seems to get an infinite loop
  357.           compiling part of `libgcc2.c'.  GNU CC version 2 compiled
  358.           with GNU CC (any version) seems not to have this problem.
  359.  
  360.     `i860-intel-osf1'
  361.           This is the Paragon.  If you have version 1.0 of the
  362.           operating system, see *Note Installation Problems::, for
  363.           special things you need to do to compensate for peculiarities
  364.           in the system.
  365.  
  366.     `m68000-att'
  367.           AT&T 3b1, a.k.a. 7300 PC.  Special procedures are needed to
  368.           compile GNU CC with this machine's standard C compiler, due
  369.           to bugs in that compiler.  *Note 3b1 Install::.  You can
  370.           bootstrap it more easily with previous versions of GNU CC if
  371.           you have them.
  372.  
  373.     `m68000-hp-bsd'
  374.           HP 9000 series 200 running BSD.  Note that the C compiler
  375.           that comes with this system cannot compile GNU CC; contact
  376.           `law@cs.utah.edu' to get binaries of GNU CC for bootstrapping.
  377.  
  378.     `m68k-altos'
  379.           Altos 3068.  You must use the GNU assembler, linker and
  380.           debugger.  Also, you must fix a kernel bug.  Details in the
  381.           file `README.ALTOS'.
  382.  
  383.     `m68k-bull-sysv'
  384.           Bull DPX/2 series 200 and 300 with BOS-2.00.45 up to
  385.           BOS-2.01. GNU CC works either with native assembler or GNU
  386.           assembler. You can use GNU assembler with native coff
  387.           generation by providing `--gas' to the configure script or
  388.           use GNU assembler with dbx-in-coff encapsulation by providing
  389.           `--gas --stabs'. For any problem with native assembler or for
  390.           availability of the DPX/2 port of GAS, contact
  391.           `F.Pierresteguy@frcl.bull.fr'.
  392.  
  393.     `m68k-hp-hpux'
  394.           HP 9000 series 300 or 400 running HP-UX.  HP-UX version 8.0
  395.           has a bug in the assembler that prevents compilation of GNU
  396.           CC.  To fix it, get patch PHCO_0800 from HP.
  397.  
  398.           In addition, `--gas' does not currently work with this
  399.           configuration.  Changes in HP-UX have broken the library
  400.           conversion tool and the linker.
  401.  
  402.     `m68k-sun'
  403.           Sun 3.  We do not provide a configuration file to use the Sun
  404.           FPA by default, because programs that establish signal
  405.           handlers for floating point traps inherently cannot work with
  406.           the FPA.
  407.  
  408.     `m88k-*-svr3'
  409.           Motorola m88k running the AT&T/Unisoft/Motorola V.3 reference
  410.           port.  These systems tend to use the Green Hills C, revision
  411.           1.8.5, as the standard C compiler.  There are apparently bugs
  412.           in this compiler that result in object files differences
  413.           between stage 2 and stage 3.  If this happens, make the stage
  414.           4 compiler and compare it to the stage 3 compiler.  If the
  415.           stage 3 and stage 4 object files are identical, this suggests
  416.           you encountered a problem with the standard C compiler; the
  417.           stage 3 and 4 compilers may be usable.
  418.  
  419.           It is best, however, to use an older version of GNU CC for
  420.           bootstrapping if you have one.
  421.  
  422.     `m88k-*-dgux'
  423.           Motorola m88k running DG/UX.  To build native or cross
  424.           compilers on DG/UX, you must first change to the 88open BCS
  425.           software development environment.  This is done by issuing
  426.           this command:
  427.  
  428.                eval `sde-target m88kbcs`
  429.  
  430.     `m88k-tektronix-sysv3'
  431.           Tektronix XD88 running UTekV 3.2e.  Do not turn on
  432.           optimization while building stage1 if you bootstrap with the
  433.           buggy Green Hills compiler.  Also, The bundled LAI System V
  434.           NFS is buggy so if you build in an NFS mounted directory,
  435.           start from a fresh reboot, or avoid NFS all together.
  436.           Otherwise you may have trouble getting clean comparisons
  437.           between stages.
  438.  
  439.     `mips-mips-bsd'
  440.           MIPS machines running the MIPS operating system in BSD mode.
  441.           It's possible that some old versions of the system lack the
  442.           functions `memcpy', `memcmp', and `memset'.  If your system
  443.           lacks these, you must remove or undo the definition of
  444.           `TARGET_MEM_FUNCTIONS' in `mips-bsd.h'.
  445.  
  446.     `mips-sgi-*'
  447.           Silicon Graphics MIPS machines running IRIX.  In order to
  448.           compile GCC on an SGI the "c.hdr.lib" option must be
  449.           installed from the CD-ROM supplied from Silicon Graphics.
  450.           This is found on the 2nd CD in release 4.0.1.
  451.  
  452.     `mips-sony-sysv'
  453.           Sony MIPS NEWS.  This works in NEWSOS 5.0.1, but not in 5.0.2
  454.           (which uses ELF instead of COFF).  Support for 5.0.2 will
  455.           probably be provided soon by volunteers.  In particular, the
  456.           linker does not like the code generated by GCC when shared
  457.           libraries are linked in.
  458.  
  459.     `ns32k-encore'
  460.           Encore ns32000 system.  Encore systems are supported only
  461.           under BSD.
  462.  
  463.     `ns32k-*-genix'
  464.           National Semiconductor ns32000 system.  Genix has bugs in
  465.           `alloca' and `malloc'; you must get the compiled versions of
  466.           these from GNU Emacs.
  467.  
  468.     `ns32k-sequent'
  469.           Go to the Berkeley universe before compiling.  In addition,
  470.           you probably need to create a file named `string.h'
  471.           containing just one line: `#include <strings.h>'.
  472.  
  473.     `ns32k-utek'
  474.           UTEK ns32000 system ("merlin").  The C compiler that comes
  475.           with this system cannot compile GNU CC; contact
  476.           `tektronix!reed!mason' to get binaries of GNU CC for
  477.           bootstrapping.
  478.  
  479.     `romp-*-aos'
  480.     `romp-*-mach'
  481.           The only operating systems supported for the IBM RT PC are
  482.           AOS and MACH.  GNU CC does not support AIX running on the RT.
  483.           We recommend you compile GNU CC with an earlier version of
  484.           itself; if you compile GNU CC with `hc', the Metaware
  485.           compiler, it will work, but you will get mismatches between
  486.           the stage 2 and stage 3 compilers in various files.  These
  487.           errors are minor differences in some floating-point constants
  488.           and can be safely ignored; the stage 3 compiler is correct.
  489.  
  490.     `rs6000-*-aix'
  491.           *Read the file `README.RS6000' for information on how to get
  492.           a fix for problems in the IBM assembler that interfere with
  493.           GNU CC.* You must either obtain the new assembler or avoid
  494.           using the `-g' switch.  Note that `Makefile.in' uses `-g' by
  495.           default when compiling `libgcc2.c'.
  496.  
  497.           The PowerPC and POWER2 architectures are now supported, but
  498.           have not been extensively tested due to lack of appropriate
  499.           systems.  Only AIX is supported on the PowerPC.
  500.  
  501.           Objective C does not work on this architecture.
  502.  
  503.           XLC version 1.3.0.0 will miscompile `jump.c'.  XLC version
  504.           1.3.0.1 or later fixes this problem.  We do not yet have a
  505.           PTF number for this fix.
  506.  
  507.     `vax-dec-ultrix'
  508.           Don't try compiling with Vax C (`vcc').  It produces
  509.           incorrect code in some cases (for example, when `alloca' is
  510.           used).
  511.  
  512.           Meanwhile, compiling `cp-parse.c' with pcc does not work
  513.           because of an internal table size limitation in that
  514.           compiler.  To avoid this problem, compile just the GNU C
  515.           compiler first, and use it to recompile building all the
  516.           languages that you want to run.
  517.  
  518.      Here we spell out what files will be set up by `configure'.
  519.      Normally you need not be concerned with these files.
  520.  
  521.         * A symbolic link named `config.h' is made to the top-level
  522.           config file for the machine you will run the compiler on
  523.           (*note Config::.).  This file is responsible for defining
  524.           information about the host machine.  It includes `tm.h'.
  525.  
  526.           The top-level config file is located in the subdirectory
  527.           `config'.  Its name is always `xm-SOMETHING.h'; usually
  528.           `xm-MACHINE.h', but there are some exceptions.
  529.  
  530.           If your system does not support symbolic links, you might
  531.           want to set up `config.h' to contain a `#include' command
  532.           which refers to the appropriate file.
  533.  
  534.         * A symbolic link named `tconfig.h' is made to the top-level
  535.           config file for your target machine.  This is used for
  536.           compiling certain programs to run on that machine.
  537.  
  538.         * A symbolic link named `tm.h' is made to the
  539.           machine-description macro file for your target machine.  It
  540.           should be in the subdirectory `config' and its name is often
  541.           `MACHINE.h'.
  542.  
  543.         * A symbolic link named `md' will be made to the machine
  544.           description pattern file.  It should be in the `config'
  545.           subdirectory and its name should be `MACHINE.md'; but MACHINE
  546.           is often not the same as the name used in the `tm.h' file
  547.           because the `md' files are more general.
  548.  
  549.         * A symbolic link named `aux-output.c' will be made to the
  550.           output subroutine file for your machine.  It should be in the
  551.           `config' subdirectory and its name should be `MACHINE.c'.
  552.  
  553.         * The command file `configure' also constructs the file
  554.           `Makefile' by adding some text to the template file
  555.           `Makefile.in'.  The additional text comes from files in the
  556.           `config' directory, named `t-TARGET' and `x-HOST'.  If these
  557.           files do not exist, it means nothing needs to be added for a
  558.           given target or host.
  559.  
  560.   4. The standard directory for installing GNU CC is `/gnu/lib'.  If
  561.      you want to install its files somewhere else, specify
  562.      `--prefix=DIR' when you run `configure'.  Here DIR is a directory
  563.      name to use instead of `/gnu' for all purposes with one exception:
  564.      the directory `/gnu/include' is searched for header files no
  565.      matter where you install the compiler.
  566.  
  567.   5. Specify `--local-prefix=DIR' if you want the compiler to search
  568.      directory `DIR/include' for header files *instead* of
  569.      `/gnu/include'.  (This is for systems that have different
  570.      conventions for where to put site-specific things.)
  571.  
  572.      Unless you have a convention other than `/gnu' for site-specific
  573.      files, it is a bad idea to specify `--local-prefix'.
  574.  
  575.   6. Make sure the Bison parser generator is installed.  (This is
  576.      unnecessary if the Bison output files `c-parse.c' and `cexp.c' are
  577.      more recent than `c-parse.y' and `cexp.y' and you do not plan to
  578.      change the `.y' files.)
  579.  
  580.      Bison versions older than Sept 8, 1988 will produce incorrect
  581.      output for `c-parse.c'.
  582.  
  583.   7. If you have chosen a configuration for GNU CC which requires other
  584.      GNU tools (such as GAS or the GNU linker) instead of the standard
  585.      system tools, install the required tools in the build directory
  586.      under the names `as', `ld' or whatever is appropriate.  This will
  587.      enable the compiler to find the proper tools for compilation of
  588.      the program `enquire'.
  589.  
  590.      Alternatively, you can do subsequent compilation using a value of
  591.      the `PATH' environment variable such that the necessary GNU tools
  592.      come before the standard system tools.
  593.  
  594.   8. Build the compiler.  Just type `make LANGUAGES=c' in the compiler
  595.      directory.
  596.  
  597.      `LANGUAGES=c' specifies that only the C compiler should be
  598.      compiled.  The makefile normally builds compilers for all the
  599.      supported languages; currently, C, C++ and Objective C.  However,
  600.      C is the only language that is sure to work when you build with
  601.      other non-GNU C compilers.  In addition, building anything but C
  602.      at this stage is a waste of time.
  603.  
  604.      In general, you can specify the languages to build by typing the
  605.      argument `LANGUAGES="LIST"', where LIST is one or more words from
  606.      the list `c', `c++', and `objective-c'.
  607.  
  608.      Ignore any warnings you may see about "statement not reached" in
  609.      `insn-emit.c'; they are normal.  Also, warnings about "unknown
  610.      escape sequence" are normal in `genopinit.c' and perhaps some
  611.      other files.  Any other compilation errors may represent bugs in
  612.      the port to your machine or operating system, and should be
  613.      investigated and reported (*note Bugs::.).
  614.  
  615.      Some commercial compilers fail to compile GNU CC because they have
  616.      bugs or limitations.  For example, the Microsoft compiler is said
  617.      to run out of macro space.  Some Ultrix compilers run out of
  618.      expression space; then you need to break up the statement where
  619.      the problem happens.
  620.  
  621.      If you are building with a previous GNU C compiler, do not use
  622.      `CC=gcc' on the make command or by editing the Makefile.  Instead,
  623.      use a full pathname to specify the compiler, such as
  624.      `CC=/gnu/bin/gcc'.  This is because make might execute the `gcc'
  625.      in the current directory before all of the compiler components
  626.      have been built.
  627.  
  628.   9. If you are building a cross-compiler, stop here.  *Note
  629.      Cross-Compiler::.
  630.  
  631.  10. Move the first-stage object files and executables into a
  632.      subdirectory with this command:
  633.  
  634.           make stage1
  635.  
  636.      The files are moved into a subdirectory named `stage1'.  Once
  637.      installation is complete, you may wish to delete these files with
  638.      `rm -r stage1'.
  639.  
  640.  11. If you have chosen a configuration for GNU CC which requires other
  641.      GNU tools (such as GAS or the GNU linker) instead of the standard
  642.      system tools, install the required tools in the `stage1'
  643.      subdirectory under the names `as', `ld' or whatever is
  644.      appropriate.  This will enable the stage 1 compiler to find the
  645.      proper tools in the following stage.
  646.  
  647.      Alternatively, you can do subsequent compilation using a value of
  648.      the `PATH' environment variable such that the necessary GNU tools
  649.      come before the standard system tools.
  650.  
  651.  12. Recompile the compiler with itself, with this command:
  652.  
  653.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"
  654.  
  655.      This is called making the stage 2 compiler.
  656.  
  657.      The command shown above builds compilers for all the supported
  658.      languages.  If you don't want them all, you can specify the
  659.      languages to build by typing the argument `LANGUAGES="LIST"'.  LIST
  660.      should contain one or more words from the list `c', `c++',
  661.      `objective-c', and `proto'.  Separate the words with spaces.
  662.      `proto' stands for the programs `protoize' and `unprotoize'; they
  663.      are not a separate language, but you use `LANGUAGES' to enable or
  664.      disable their installation.
  665.  
  666.      If you are going to build the stage 3 compiler, then you might
  667.      want to build only the C language in stage 2.
  668.  
  669.      Once you have built the stage 2 compiler, if you are short of disk
  670.      space, you can delete the subdirectory `stage1'.
  671.  
  672.      On a 68000 or 68020 system lacking floating point hardware, unless
  673.      you have selected a `tm.h' file that expects by default that there
  674.      is no such hardware, do this instead:
  675.  
  676.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O -msoft-float"
  677.  
  678.  13. If you wish to test the compiler by compiling it with itself one
  679.      more time, install any other necessary GNU tools (such as GAS or
  680.      the GNU linker) in the `stage2' subdirectory as you did in the
  681.      `stage1' subdirectory, then do this:
  682.  
  683.           make stage2
  684.           make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  685.  
  686.      This is called making the stage 3 compiler.  Aside from the `-B'
  687.      option, the compiler options should be the same as when you made
  688.      the stage 2 compiler.  But the `LANGUAGES' option need not be the
  689.      same.  The command shown above builds compilers for all the
  690.      supported languages; if you don't want them all, you can specify
  691.      the languages to build by typing the argument `LANGUAGES="LIST"',
  692.      as described above.
  693.  
  694.      Then compare the latest object files with the stage 2 object
  695.      files--they ought to be identical, aside from time stamps (if any).
  696.  
  697.      On some systems, meaningful comparison of object files is
  698.      impossible; they always appear "different."  This is currently
  699.      true on Solaris and probably on all systems that use ELF object
  700.      file format.  Some other systems where this is so are listed below.
  701.  
  702.      Use this command to compare the files:
  703.  
  704.           make compare
  705.  
  706.      This will mention any object files that differ between stage 2 and
  707.      stage 3.  Any difference, no matter how innocuous, indicates that
  708.      the stage 2 compiler has compiled GNU CC incorrectly, and is
  709.      therefore a potentially serious bug which you should investigate
  710.      and report (*note Bugs::.).
  711.  
  712.      If your system does not put time stamps in the object files, then
  713.      this is a faster way to compare them (using the Bourne shell):
  714.  
  715.           for file in *.o; do
  716.           cmp $file stage2/$file
  717.           done
  718.  
  719.      If you have built the compiler with the `-mno-mips-tfile' option on
  720.      MIPS machines, you will not be able to compare the files.
  721.  
  722.      The Alpha stores file names of internal temporary files in the
  723.      object files and `make compare' does not know how to ignore them,
  724.      so normally you cannot compare on the Alpha.  However, if you use
  725.      the `-save-temps' option when compiling *both* stage 2 and stage
  726.      3, this causes the same file names to be used in both stages; then
  727.      you can do the comparison.
  728.  
  729.  14. Build the Objective C library (if you have built the Objective C
  730.      compiler).  Here is the command to do this:
  731.  
  732.           make objc-runtime CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  733.  
  734.  15. Install the compiler driver, the compiler's passes and run-time
  735.      support with `make install'.  Use the same value for `CC',
  736.      `CFLAGS' and `LANGUAGES' that you used when compiling the files
  737.      that are being installed.  One reason this is necessary is that
  738.      some versions of Make have bugs and recompile files gratuitously
  739.      when you do this step.  If you use the same variable values, those
  740.      files will be recompiled properly.
  741.  
  742.      For example, if you have built the stage 2 compiler, you can use
  743.      the following command:
  744.  
  745.           make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST"
  746.  
  747.      This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1',
  748.      `cpp' and `libgcc.a' in the directory
  749.      `/gnu/lib/gcc-lib/TARGET/VERSION', which is where the compiler
  750.      driver program looks for them.  Here TARGET is the target machine
  751.      type specified when you ran `configure', and VERSION is the
  752.      version number of GNU CC.  This naming scheme permits various
  753.      versions and/or cross-compilers to coexist.
  754.  
  755.      This also copies the driver program `xgcc' into `/gnu/bin/gcc', so
  756.      that it appears in typical execution search paths.
  757.  
  758.      On some systems, this command causes recompilation of some files.
  759.      This is usually due to bugs in `make'.  You should either ignore
  760.      this problem, or use GNU Make.
  761.  
  762.      *Warning: there is a bug in `alloca' in the Sun library.  To avoid
  763.      this bug, be sure to install the executables of GNU CC that were
  764.      compiled by GNU CC.  (That is, the executables from stage 2 or 3,
  765.      not stage 1.)  They use `alloca' as a built-in function and never
  766.      the one in the library.*
  767.  
  768.      (It is usually better to install GNU CC executables from stage 2
  769.      or 3, since they usually run faster than the ones compiled with
  770.      some other compiler.)
  771.  
  772.  16. Install the Objective C library (if you are installing the
  773.      Objective C compiler).  Here is the command to do this:
  774.  
  775.           make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  776.  
  777.  17. If you're going to use C++, it's likely that you need to also
  778.      install the libg++ distribution.  It should be available from the
  779.      same place where you got the GNU C distribution.  Just as GNU C
  780.      does not distribute a C runtime library, it also does not include
  781.      a C++ run-time library.  All I/O functionality, special class
  782.      libraries, etc., are available in the libg++ distribution.
  783.  
  784. 
  785. File: gcc.info,  Node: Other Dir,  Next: Cross-Compiler,  Up: Installation
  786.  
  787. Compilation in a Separate Directory
  788. ===================================
  789.  
  790.    If you wish to build the object files and executables in a directory
  791. other than the one containing the source files, here is what you must
  792. do differently:
  793.  
  794.   1. Make sure you have a version of Make that supports the `VPATH'
  795.      feature.  (GNU Make supports it, as do Make versions on most BSD
  796.      systems.)
  797.  
  798.   2. If you have ever run `configure' in the source directory, you must
  799.      undo the configuration.  Do this by running:
  800.  
  801.           make distclean
  802.  
  803.   3. Go to the directory in which you want to build the compiler before
  804.      running `configure':
  805.  
  806.           mkdir gcc-sun3
  807.           cd gcc-sun3
  808.  
  809.      On systems that do not support symbolic links, this directory must
  810.      be on the same file system as the source code directory.
  811.  
  812.   4. Specify where to find `configure' when you run it:
  813.  
  814.           ../gcc/configure ...
  815.  
  816.      This also tells `configure' where to find the compiler sources;
  817.      `configure' takes the directory from the file name that was used to
  818.      invoke it.  But if you want to be sure, you can specify the source
  819.      directory with the `--srcdir' option, like this:
  820.  
  821.           ../gcc/configure --srcdir=../gcc sun3
  822.  
  823.      The directory you specify with `--srcdir' need not be the same as
  824.      the one that `configure' is found in.
  825.  
  826.    Now, you can run `make' in that directory.  You need not repeat the
  827. configuration steps shown above, when ordinary source files change.  You
  828. must, however, run `configure' again when the configuration files
  829. change, if your system does not support symbolic links.
  830.  
  831. 
  832. File: gcc.info,  Node: Cross-Compiler,  Next: PA Install,  Prev: Other Dir,  Up: Installation
  833.  
  834. Building and Installing a Cross-Compiler
  835. ========================================
  836.  
  837.    GNU CC can function as a cross-compiler for many machines, but not
  838. all.
  839.  
  840.    * Cross-compilers for the Mips as target using the Mips assembler
  841.      currently do not work, because the auxiliary programs
  842.      `mips-tdump.c' and `mips-tfile.c' can't be compiled on anything
  843.      but a Mips.  It does work to cross compile for a Mips if you use
  844.      the GNU assembler and linker.
  845.  
  846.    * Cross-compilers between machines with different floating point
  847.      formats have not all been made to work.  GNU CC now has a floating
  848.      point emulator with which these can work, but each target machine
  849.      description needs to be updated to take advantage of it.
  850.  
  851.    * Cross-compilation between machines of different word sizes has not
  852.      really been addressed yet.
  853.  
  854.    Since GNU CC generates assembler code, you probably need a
  855. cross-assembler that GNU CC can run, in order to produce object files.
  856. If you want to link on other than the target machine, you need a
  857. cross-linker as well.  You also need header files and libraries suitable
  858. for the target machine that you can install on the host machine.
  859.  
  860. * Menu:
  861.  
  862. * Steps of Cross::      Using a cross-compiler involves several steps
  863.                           that may be carried out on different machines.
  864. * Configure Cross::     Configuring a cross-compiler.
  865. * Tools and Libraries:: Where to put the linker and assembler, and the C library.
  866. * Cross Headers::       Finding and installing header files
  867.                           for a cross-compiler.
  868. * Cross Runtime::       Supplying arithmetic runtime routines (`libgcc1.a').
  869. * Build Cross::         Actually compiling the cross-compiler.
  870.  
  871. 
  872. File: gcc.info,  Node: Steps of Cross,  Next: Configure Cross,  Up: Cross-Compiler
  873.  
  874. Steps of Cross-Compilation
  875. --------------------------
  876.  
  877.    To compile and run a program using a cross-compiler involves several
  878. steps:
  879.  
  880.    * Run the cross-compiler on the host machine to produce assembler
  881.      files for the target machine.  This requires header files for the
  882.      target machine.
  883.  
  884.    * Assemble the files produced by the cross-compiler.  You can do this
  885.      either with an assembler on the target machine, or with a
  886.      cross-assembler on the host machine.
  887.  
  888.    * Link those files to make an executable.  You can do this either
  889.      with a linker on the target machine, or with a cross-linker on the
  890.      host machine.  Whichever machine you use, you need libraries and
  891.      certain startup files (typically `crt....o') for the target
  892.      machine.
  893.  
  894.    It is most convenient to do all of these steps on the same host
  895. machine, since then you can do it all with a single invocation of GNU
  896. CC.  This requires a suitable cross-assembler and cross-linker.  For
  897. some targets, the GNU assembler and linker are available.
  898.  
  899. 
  900. File: gcc.info,  Node: Configure Cross,  Next: Tools and Libraries,  Prev: Steps of Cross,  Up: Cross-Compiler
  901.  
  902. Configuring a Cross-Compiler
  903. ----------------------------
  904.  
  905.    To build GNU CC as a cross-compiler, you start out by running
  906. `configure'.  You must specify two different configurations, the host
  907. and the target.  Use the `--host=HOST' option for the host and
  908. `--target=TARGET' to specify the target type.  For example, here is how
  909. to configure for a cross-compiler that runs on a hypothetical Intel 386
  910. system and produces code for an HP 68030 system running BSD:
  911.  
  912.      configure --target=m68k-hp-bsd4.3 --host=i386-bozotheclone-bsd4.3
  913.  
  914. 
  915. File: gcc.info,  Node: Tools and Libraries,  Next: Cross Headers,  Prev: Configure Cross,  Up: Cross-Compiler
  916.  
  917. Tools and Libraries for a Cross-Compiler
  918. ----------------------------------------
  919.  
  920.    If you have a cross-assembler and cross-linker available, you should
  921. install them now.  Put them in the directory `/gnu/TARGET/bin'.  Here
  922. is a table of the tools you should put in this directory:
  923.  
  924. `as'
  925.      This should be the cross-assembler.
  926.  
  927. `ld'
  928.      This should be the cross-linker.
  929.  
  930. `ar'
  931.      This should be the cross-archiver: a program which can manipulate
  932.      archive files (linker libraries) in the target machine's format.
  933.  
  934. `ranlib'
  935.      This should be a program to construct a symbol table in an archive
  936.      file.
  937.  
  938.    The installation of GNU CC will find these programs in that
  939. directory, and copy or link them to the proper place to for the
  940. cross-compiler to find them when run later.
  941.  
  942.    The easiest way to provide these files is to build the Binutils
  943. package and GAS.  Configure them with the same `--host' and `--target'
  944. options that you use for configuring GNU CC, then build and install
  945. them.  They install their executables automatically into the proper
  946. directory.  Alas, they do not support all the targets that GNU CC
  947. supports.
  948.  
  949.    If you want to install libraries to use with the cross-compiler,
  950. such as a standard C library, put them in the directory
  951. `/gnu/TARGET/lib'; installation of GNU CC copies all all the files in
  952. that subdirectory into the proper place for GNU CC to find them and
  953. link with them.  Here's an example of copying some libraries from a
  954. target machine:
  955.  
  956.      ftp TARGET-MACHINE
  957.      lcd /gnu/TARGET/lib
  958.      cd /lib
  959.      get libc.a
  960.      cd /usr/lib
  961.      get libg.a
  962.      get libm.a
  963.      quit
  964.  
  965. The precise set of libraries you'll need, and their locations on the
  966. target machine, vary depending on its operating system.
  967.  
  968.    Many targets require "start files" such as `crt0.o' and `crtn.o'
  969. which are linked into each executable; these too should be placed in
  970. `/gnu/TARGET/lib'.  There may be several alternatives for `crt0.o', for
  971. use with profiling or other compilation options.  Check your target's
  972. definition of `STARTFILE_SPEC' to find out what start files it uses.
  973. Here's an example of copying these files from a target machine:
  974.  
  975.      ftp TARGET-MACHINE
  976.      lcd /gnu/TARGET/lib
  977.      prompt
  978.      cd /lib
  979.      mget *crt*.o
  980.      cd /usr/lib
  981.      mget *crt*.o
  982.      quit
  983.  
  984. 
  985. File: gcc.info,  Node: Cross Runtime,  Next: Build Cross,  Prev: Cross Headers,  Up: Cross-Compiler
  986.  
  987. `libgcc.a' and Cross-Compilers
  988. ------------------------------
  989.  
  990.    Code compiled by GNU CC uses certain runtime support functions
  991. implicitly.  Some of these functions can be compiled successfully with
  992. GNU CC itself, but a few cannot be.  These problem functions are in the
  993. source file `libgcc1.c'; the library made from them is called
  994. `libgcc1.a'.
  995.  
  996.    When you build a native compiler, these functions are compiled with
  997. some other compiler-the one that you use for bootstrapping GNU CC.
  998. Presumably it knows how to open code these operations, or else knows how
  999. to call the run-time emulation facilities that the machine comes with.
  1000. But this approach doesn't work for building a cross-compiler.  The
  1001. compiler that you use for building knows about the host system, not the
  1002. target system.
  1003.  
  1004.    So, when you build a cross-compiler you have to supply a suitable
  1005. library `libgcc1.a' that does the job it is expected to do.
  1006.  
  1007.    To compile `libgcc1.c' with the cross-compiler itself does not work.
  1008. The functions in this file are supposed to implement arithmetic
  1009. operations that GNU CC does not know how to open code, for your target
  1010. machine.  If these functions are compiled with GNU CC itself, they will
  1011. compile into infinite recursion.
  1012.  
  1013.    On any given target, most of these functions are not needed.  If GNU
  1014. CC can open code an arithmetic operation, it will not call these
  1015. functions to perform the operation.  It is possible that on your target
  1016. machine, none of these functions is needed.  If so, you can supply an
  1017. empty library as `libgcc1.a'.
  1018.  
  1019.    Many targets need library support only for multiplication and
  1020. division.  If you are linking with a library that contains functions for
  1021. multiplication and division, you can tell GNU CC to call them directly
  1022. by defining the macros `MULSI3_LIBCALL', and the like.  These macros
  1023. need to be defined in the target description macro file.  For some
  1024. targets, they are defined already.  This may be sufficient to avoid the
  1025. need for libgcc1.a; if so, you can supply an empty library.
  1026.  
  1027.    Some targets do not have floating point instructions; they need other
  1028. functions in `libgcc1.a', which do floating arithmetic.  Recent
  1029. versions of GNU CC have a file which emulates floating point.  With a
  1030. certain amount of work, you should be able to construct a floating
  1031. point emulator that can be used as `libgcc1.a'.  Perhaps future
  1032. versions will contain code to do this automatically and conveniently.
  1033. That depends on whether someone wants to implement it.
  1034.  
  1035.    If your target system has another C compiler, you can configure GNU
  1036. CC as a native compiler on that machine, build just `libgcc1.a' with
  1037. `make libgcc1.a' on that machine, and use the resulting file with the
  1038. cross-compiler.  To do this, execute the following on the target
  1039. machine:
  1040.  
  1041.      cd TARGET-BUILD-DIR
  1042.      configure --host=sparc --target=sun3
  1043.      make libgcc1.a
  1044.  
  1045. And then this on the host machine:
  1046.  
  1047.      ftp TARGET-MACHINE
  1048.      binary
  1049.      cd TARGET-BUILD-DIR
  1050.      get libgcc1.a
  1051.      quit
  1052.  
  1053.    Another way to provide the functions you need in `libgcc1.a' is to
  1054. define the appropriate `perform_...' macros for those functions.  If
  1055. these definitions do not use the C arithmetic operators that they are
  1056. meant to implement, you should be able to compile them with the
  1057. cross-compiler you are building.  (If these definitions already exist
  1058. for your target file, then you are all set.)
  1059.  
  1060.    To build `libgcc1.a' using the perform macros, use
  1061. `LIBGCC1=libgcc1.a OLDCC=./xgcc' when building the compiler.
  1062. Otherwise, you should place your replacement library under the name
  1063. `libgcc1.a' in the directory in which you will build the
  1064. cross-compiler, before you run `make'.
  1065.  
  1066. 
  1067. File: gcc.info,  Node: Cross Headers,  Next: Cross Runtime,  Prev: Tools and Libraries,  Up: Cross-Compiler
  1068.  
  1069. Cross-Compilers and Header Files
  1070. --------------------------------
  1071.  
  1072.    If you are cross-compiling a standalone program or a program for an
  1073. embedded system, then you may not need any header files except the few
  1074. that are part of GNU CC (and those of your program).  However, if you
  1075. intend to link your program with a standard C library such as `libc.a',
  1076. then you probably need to compile with the header files that go with
  1077. the library you use.
  1078.  
  1079.    The GNU C compiler does not come with these files, because (1) they
  1080. are system-specific, and (2) they belong in a C library, not in a
  1081. compiler.
  1082.  
  1083.    If the GNU C library supports your target machine, then you can get
  1084. the header files from there (assuming you actually use the GNU library
  1085. when you link your program).
  1086.  
  1087.    If your target machine comes with a C compiler, it probably comes
  1088. with suitable header files also.  If you make these files accessible
  1089. from the host machine, the cross-compiler can use them also.
  1090.  
  1091.    Otherwise, you're on your own in finding header files to use when
  1092. cross-compiling.
  1093.  
  1094.    When you have found suitable header files, put them in
  1095. `/gnu/TARGET/include', before building the cross compiler.  Then
  1096. installation will run fixincludes properly and install the corrected
  1097. versions of the header files where the compiler will use them.
  1098.  
  1099.    Provide the header files before you build the cross-compiler, because
  1100. the build stage actually runs the cross-compiler to produce parts of
  1101. `libgcc.a'.  (These are the parts that *can* be compiled with GNU CC.)
  1102. Some of them need suitable header files.
  1103.  
  1104.    Here's an example showing how to copy the header files from a target
  1105. machine.  On the target machine, do this:
  1106.  
  1107.      (cd /usr/include; tar cf - .) > tarfile
  1108.  
  1109.    Then, on the host machine, do this:
  1110.  
  1111.      ftp TARGET-MACHINE
  1112.      lcd /gnu/TARGET/include
  1113.      get tarfile
  1114.      quit
  1115.      tar xf tarfile
  1116.  
  1117.