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