📄 install-old.texi
字号:
@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@node Installation
@chapter Installing GNU CC
@cindex installing GNU CC
Note most of this information is out of date and superseded by the
new GCC install manual @file{gcc/doc/install.texi}. It is
provided for historical reference only.
@menu
* Configuration Files:: Files created by running @code{configure}.
* Configurations:: Configurations Supported by GNU CC.
* Cross-Compiler:: Building and installing a cross-compiler.
* VMS Install:: See below for installation on VMS.
* Collect2:: How @code{collect2} works; how it finds @code{ld}.
* Header Dirs:: Understanding the standard header file directories.
@end menu
Here is the procedure for installing GNU CC on a GNU or Unix system.
See @ref{VMS Install}, for VMS systems.
@enumerate
@item
If you have chosen a configuration for GNU CC which requires other GNU
tools (such as GAS or the GNU linker) instead of the standard system
tools, install the required tools in the build directory under the names
@file{as}, @file{ld} or whatever is appropriate. This will enable the
compiler to find the proper tools for compilation of the program
@file{enquire}.
Alternatively, you can do subsequent compilation using a value of the
@code{PATH} environment variable such that the necessary GNU tools come
before the standard system tools.
@item
Specify the host, build and target machine configurations. You do this
when you run the @file{configure} script.
The @dfn{build} machine is the system which you are using, the
@dfn{host} machine is the system where you want to run the resulting
compiler (normally the build machine), and the @dfn{target} machine is
the system for which you want the compiler to generate code.
If you are building a compiler to produce code for the machine it runs
on (a native compiler), you normally do not need to specify any operands
to @file{configure}; it will try to guess the type of machine you are on
and use that as the build, host and target machines. So you don't need
to specify a configuration when building a native compiler unless
@file{configure} cannot figure out what your configuration is or guesses
wrong.
In those cases, specify the build machine's @dfn{configuration name}
with the @option{--host} option; the host and target will default to be
the same as the host machine. (If you are building a cross-compiler,
see @ref{Cross-Compiler}.)
Here is an example:
@smallexample
./configure --host=sparc-sun-sunos4.1
@end smallexample
A configuration name may be canonical or it may be more or less
abbreviated.
A canonical configuration name has three parts, separated by dashes.
It looks like this: @samp{@var{cpu}-@var{company}-@var{system}}.
(The three parts may themselves contain dashes; @file{configure}
can figure out which dashes serve which purpose.) For example,
@samp{m68k-sun-sunos4.1} specifies a Sun 3.
You can also replace parts of the configuration by nicknames or aliases.
For example, @samp{sun3} stands for @samp{m68k-sun}, so
@samp{sun3-sunos4.1} is another way to specify a Sun 3.
You can specify a version number after any of the system types, and some
of the CPU types. In most cases, the version is irrelevant, and will be
ignored. So you might as well specify the version if you know it.
See @ref{Configurations}, for a list of supported configuration names and
notes on many of the configurations. You should check the notes in that
section before proceeding any further with the installation of GNU CC.
@item
When running @code{configure}, you may also need to specify certain
additional options that describe variant hardware and software
configurations. These are @option{--with-gnu-as}, @option{--with-gnu-ld},
@option{--with-stabs} and @option{--nfp}.
@table @samp
@item --with-gnu-as
If you will use GNU CC with the GNU assembler (GAS), you should declare
this by using the @option{--with-gnu-as} option when you run
@file{configure}.
Using this option does not install GAS. It only modifies the output of
GNU CC to work with GAS. Building and installing GAS is up to you.
Conversely, if you @emph{do not} wish to use GAS and do not specify
@option{--with-gnu-as} when building GNU CC, it is up to you to make sure
that GAS is not installed. GNU CC searches for a program named
@code{as} in various directories; if the program it finds is GAS, then
it runs GAS. If you are not sure where GNU CC finds the assembler it is
using, try specifying @option{-v} when you run it.
The systems where it makes a difference whether you use GAS are@*
@samp{hppa1.0-@var{any}-@var{any}}, @samp{hppa1.1-@var{any}-@var{any}},
@samp{i386-@var{any}-sysv}, @samp{i386-@var{any}-isc},@*
@samp{i860-@var{any}-bsd}, @samp{m68k-bull-sysv},@*
@samp{m68k-hp-hpux}, @samp{m68k-sony-bsd},@*
@samp{m68k-altos-sysv}, @samp{m68000-hp-hpux},@*
@samp{m68000-att-sysv}, @samp{@var{any}-lynx-lynxos},
and @samp{mips-@var{any}}).
On any other system, @option{--with-gnu-as} has no effect.
On the systems listed above (except for the HP-PA, for ISC on the
386, and for @samp{mips-sgi-irix5.*}), if you use GAS, you should also
use the GNU linker (and specify @option{--with-gnu-ld}).
@item --with-gnu-ld
Specify the option @option{--with-gnu-ld} if you plan to use the GNU
linker with GNU CC.
This option does not cause the GNU linker to be installed; it just
modifies the behavior of GNU CC to work with the GNU linker.
@c Specifically, it inhibits the installation of @code{collect2}, a program
@c which otherwise serves as a front-end for the system's linker on most
@c configurations.
@item --with-stabs
On MIPS based systems and on Alphas, you must specify whether you want
GNU CC to create the normal ECOFF debugging format, or to use BSD-style
stabs passed through the ECOFF symbol table. The normal ECOFF debug
format cannot fully handle languages other than C. BSD stabs format can
handle other languages, but it only works with the GNU debugger GDB.
Normally, GNU CC uses the ECOFF debugging format by default; if you
prefer BSD stabs, specify @option{--with-stabs} when you configure GNU
CC.
No matter which default you choose when you configure GNU CC, the user
can use the @option{-gcoff} and @option{-gstabs+} options to specify explicitly
the debug format for a particular compilation.
@option{--with-stabs} is meaningful on the ISC system on the 386, also, if
@option{--with-gas} is used. It selects use of stabs debugging
information embedded in COFF output. This kind of debugging information
supports C++ well; ordinary COFF debugging information does not.
@option{--with-stabs} is also meaningful on 386 systems running SVR4. It
selects use of stabs debugging information embedded in ELF output. The
C++ compiler currently (2.6.0) does not support the DWARF debugging
information normally used on 386 SVR4 platforms; stabs provide a
workable alternative. This requires gas and gdb, as the normal SVR4
tools can not generate or interpret stabs.
@end table
@end enumerate
@node Configuration Files
@section Files Created by @code{configure}
Here we spell out what files will be set up by @code{configure}. Normally
you need not be concerned with these files.
@itemize @bullet
@item
@ifset INTERNALS
A file named @file{config.h} is created that contains a @samp{#include}
of the top-level config file for the machine you will run the compiler
on (@pxref{Config}). This file is responsible for defining information
about the host machine. It includes @file{tm.h}.
@end ifset
@ifclear INTERNALS
A file named @file{config.h} is created that contains a @samp{#include}
of the top-level config file for the machine you will run the compiler
on (@pxref{Config,,The Configuration File, gcc.info, Using and Porting
GCC}). This file is responsible for defining information about the host
machine. It includes @file{tm.h}.
@end ifclear
The top-level config file is located in the subdirectory @file{config}.
Its name is always @file{xm-@var{something}.h}; usually
@file{xm-@var{machine}.h}, but there are some exceptions.
If your system does not support symbolic links, you might want to
set up @file{config.h} to contain a @samp{#include} command which
refers to the appropriate file.
@item
A file named @file{tconfig.h} is created which includes the top-level config
file for your target machine. This is used for compiling certain
programs to run on that machine.
@item
A file named @file{tm.h} is created which includes the
machine-description macro file for your target machine. It should be in
the subdirectory @file{config} and its name is often
@file{@var{machine}.h}.
@item
The command file @file{configure} also constructs the file
@file{Makefile} by adding some text to the template file
@file{Makefile.in}. The additional text comes from files in the
@file{config} directory, named @file{t-@var{target}} and
@file{x-@var{host}}. If these files do not exist, it means nothing
needs to be added for a given target or host.
@end itemize
@node Configurations
@section Configurations Supported by GNU CC
@cindex configurations supported by GNU CC
Here are the possible CPU types:
@quotation
@c gmicro, fx80, spur and tahoe omitted since they don't work.
1750a, a29k, alpha, arm, avr, c@var{n}, clipper, dsp16xx, elxsi, fr30, h8300,
hppa1.0, hppa1.1, i370, i386, i486, i586, i686, i786, i860, i960, m32r,
m68000, m68k, m6811, m6812, m88k, mcore, mips, mipsel, mips64, mips64el,
mn10200, mn10300, ns32k, pdp11, powerpc, powerpcle, romp, rs6000, sh, sparc,
sparclite, sparc64, v850, vax, we32k.
@end quotation
Here are the recognized company names. As you can see, customary
abbreviations are used rather than the longer official names.
@c What should be done about merlin, tek*, dolphin?
@quotation
acorn, alliant, altos, apollo, apple, att, bull,
cbm, convergent, convex, crds, dec, dg, dolphin,
elxsi, encore, harris, hitachi, hp, ibm, intergraph, isi,
mips, motorola, ncr, next, ns, omron, plexus,
sequent, sgi, sony, sun, tti, unicom, wrs.
@end quotation
The company name is meaningful only to disambiguate when the rest of
the information supplied is insufficient. You can omit it, writing
just @samp{@var{cpu}-@var{system}}, if it is not needed. For example,
@samp{vax-ultrix4.2} is equivalent to @samp{vax-dec-ultrix4.2}.
Here is a list of system types:
@quotation
386bsd, aix, acis, amigaos, aos, aout, aux, bosx, bsd, clix, coff, ctix, cxux,
dgux, dynix, ebmon, ecoff, elf, esix, freebsd, hms, genix, gnu, linux,
linux-gnu, hiux, hpux, iris, irix, isc, luna, lynxos, mach, minix, msdos, mvs,
netbsd, newsos, nindy, ns, osf, osfrose, ptx, riscix, riscos, rtu, sco, sim,
solaris, sunos, sym, sysv, udi, ultrix, unicos, uniplus, unos, vms, vsta,
vxworks, winnt, xenix.
@end quotation
@noindent
You can omit the system type; then @file{configure} guesses the
operating system from the CPU and company.
You can add a version number to the system type; this may or may not
make a difference. For example, you can write @samp{bsd4.3} or
@samp{bsd4.4} to distinguish versions of BSD. In practice, the version
number is most needed for @samp{sysv3} and @samp{sysv4}, which are often
treated differently.
@samp{linux-gnu} is the canonical name for the GNU/Linux target; however
GNU CC will also accept @samp{linux}. The version of the kernel in use is
not relevant on these systems. A suffix such as @samp{libc1} or @samp{aout}
distinguishes major versions of the C library; all of the suffixed versions
are obsolete.
If you specify an impossible combination such as @samp{i860-dg-vms},
then you may get an error message from @file{configure}, or it may
ignore part of the information and do the best it can with the rest.
@file{configure} always prints the canonical name for the alternative
that it used. GNU CC does not support all possible alternatives.
Often a particular model of machine has a name. Many machine names are
recognized as aliases for CPU/company combinations. Thus, the machine
name @samp{sun3}, mentioned above, is an alias for @samp{m68k-sun}.
Sometimes we accept a company name as a machine name, when the name is
popularly used for a particular machine. Here is a table of the known
machine names:
@quotation
3300, 3b1, 3b@var{n}, 7300, altos3068, altos,
apollo68, att-7300, balance,
convex-c@var{n}, crds, decstation-3100,
decstation, delta, encore,
fx2800, gmicro, hp7@var{nn}, hp8@var{nn},
hp9k2@var{nn}, hp9k3@var{nn}, hp9k7@var{nn},
hp9k8@var{nn}, iris4d, iris, isi68,
m3230, magnum, merlin, miniframe,
mmax, news-3600, news800, news, next,
pbd, pc532, pmax, powerpc, powerpcle, ps2, risc-news,
rtpc, sun2, sun386i, sun386, sun3,
sun4, symmetry, tower-32, tower.
@end quotation
@noindent
Remember that a machine name specifies both the cpu type and the company
name.
If you want to install your own homemade configuration files, you can
use @samp{local} as the company name to access them. If you use
configuration @samp{@var{cpu}-local}, the configuration name
without the cpu prefix
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -