📄 install.texi
字号:
without debugging information with @samp{make CFLAGS='-O' LIBCFLAGS='-g
-O2' LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap}. This will save
roughly 40% of disk space both for the bootstrap and the final installation.
(Libraries will still contain debugging information.)
If you wish to use non-default flags when compiling the stage2 and
stage3 compile, set @code{BOOT_CFLAGS} on the command line when doing
@samp{make bootstrap}. Non-default optimization flags are less well
tested here than the default of @samp{-g -O2}, but should still work.
In a few cases, you may find that you need to specify special flags such
as @option{-msoft-float} here to complete the bootstrap; or, if the
native compiler miscompiles the stage1 compiler, you may need to work
around this, by choosing @code{BOOT_CFLAGS} to avoid the parts of the
stage1 compiler that were miscompiled, or by using @samp{make
bootstrap4} to increase the number of stages of bootstrap.
If you used the flag @option{--enable-languages=@dots{}} to restrict
the compilers to be built, only those you've actually enabled will be
built. This will of course only build those runtime libraries, for
which the particular compiler has been built. Please note,
that re-defining LANGUAGES when calling @samp{make bootstrap}
@strong{does not} work anymore!
If the comparison of stage2 and stage3 fails, this normally indicates
that the stage 2 compiler has compiled GCC incorrectly, and is therefore
a potentially serious bug which you should investigate and report. (On
a few systems, meaningful comparison of object files is impossible; they
always appear ``different''. If you encounter this problem, you will
need to disable comparison in the @file{Makefile}.)
@section Building a cross compiler
We recommend reading the
@uref{http://www.objsw.com/CrossGCC/,,crossgcc FAQ}
for information about building cross compilers.
When building a cross compiler, it is not generally possible to do a
3-stage bootstrap of the compiler. This makes for an interesting problem
as parts of GCC can only be built with GCC.
To build a cross compiler, we first recommend building and installing a
native compiler. You can then use the native GCC compiler to build the
cross compiler.
Assuming you have already installed a native copy of GCC and configured
your cross compiler, issue the command @command{make}, which performs the
following steps:
@itemize @bullet
@item
Build host tools necessary to build the compiler such as texinfo, bison,
gperf.
@item
Build target tools for use by the compiler such as binutils (bfd,
binutils, gas, gprof, ld, and opcodes)
if they have been individually linked or moved into the top level GCC source
tree before configuring.
@item
Build the compiler (single stage only).
@item
Build runtime libraries using the compiler from the previous step.
@end itemize
Note that if an error occurs in any step the make process will exit.
@section Building in parallel
If you have a multiprocessor system you can use @samp{make bootstrap
MAKE="make -j 2" -j 2} or just @samp{make -j 2 bootstrap}
for GNU Make 3.79 and above instead of just @samp{make bootstrap}
when building GCC. You can use a bigger number instead of two if
you like. In most cases, it won't help to use a number bigger than
the number of processors in your machine.
@html
<hr>
<p>
@end html
@ifhtml
@uref{./index.html,,Return to the GCC Installation page}
@end ifhtml
@end ifset
@c ***Testing*****************************************************************
@ifnothtml
@comment node-name, next, previous, up
@node Testing, Final install, Building, Installing GCC
@end ifnothtml
@ifset testhtml
@html
<h1 align="center">Installing GCC: Testing</h1>
@end html
@ifnothtml
@chapter Installing GCC: Testing
@end ifnothtml
@cindex Testing
@cindex Installing GCC: Testing
@cindex Testsuite
@strong{Please note that this is only applicable
to current development versions of GCC and GCC 3.0 or later.
GCC 2.95.x does not come with a testsuite.}
Before you install GCC, you might wish to run the testsuite. This
step is optional and may require you to download additional software.
First, you must have @uref{download.html,,downloaded the testsuites}.
The full distribution contains testsuites; only if you downloaded the
``core'' compiler plus any front ends, you do not have the testsuites.
Second, you must have a @uref{http://www.gnu.org/software/dejagnu/,,current version of DejaGnu} installed;
dejagnu 1.3 is not sufficient.
Now you may need specific preparations:
@itemize @bullet
@item
In order to run the libio tests in GCC 2.95 and earlier versions of GCC
on targets which do not fully
support Unix/POSIX commands (e.g. Cygwin), the references to the @file{dbz}
directory have to be deleted from @file{libio/configure.in}.
@item
The following environment variables may need to be set appropriately, as in
the following example (which assumes that DejaGnu has been installed
under @file{/usr/local}):
@example
TCL_LIBRARY = /usr/local/share/tcl8.0
DEJAGNULIBS = /usr/local/share/dejagnu
@end example
On systems such as Cygwin, these paths are required to be actual
paths, not mounts or links; presumably this is due to some lack of
portability in the DejaGnu code.
If the directories where @command{runtest} and @command{expect} were
installed are in the @env{PATH}, it should not be necessary to set these
environment variables.
@end itemize
Finally, you can run the testsuite (which may take a long time):
@example
cd @var{objdir}; make -k check
@end example
The testing process will try to test as many components in the GCC
distribution as possible, including the C, C++, Objective C and Fortran
compilers as well as the C++ and Java runtime libraries.
@section How can I run the test suite on selected tests?
As a first possibility to cut down the number of tests that are run it is
possible to use @samp{make check-gcc} or @samp{make check-g++}
in the gcc subdirectory of the object directory. To further cut down the
tests the following is possible:
@example
make check-gcc RUNTESTFLAGS="execute.exp @var{other-options}"
@end example
This will run all gcc execute tests in the testsuite.
@example
make check-g++ RUNTESTFLAGS="old-deja.exp=9805* @var{other-options}"
@end example
This will run the g++ ``old-deja'' tests in the testsuite where the filename
matches @samp{9805*}.
The @file{*.exp} files are located in the testsuite directories of the GCC
source, the most important ones being @file{compile.exp},
@file{execute.exp}, @file{dg.exp} and @file{old-deja.exp}.
To get a list of the possible @file{*.exp} files, pipe the
output of @samp{make check} into a file and look at the
@samp{Running @dots{} .exp} lines.
@section How to interpret test results
After the testsuite has run you'll find various @file{*.sum} and @file{*.log}
files in the testsuite subdirectories. The @file{*.log} files contain a
detailed log of the compiler invocations and the corresponding
results, the @file{*.sum} files summarize the results. These summaries list
all the tests that have been run with a corresponding status code:
@itemize @bullet
@item
PASS: the test passed as expected
@item
XPASS: the test unexpectedly passed
@item
FAIL: the test unexpectedly failed
@item
XFAIL: the test failed as expected
@item
UNSUPPORTED: the test is not supported on this platform
@item
ERROR: the testsuite detected an error
@item
WARNING: the testsuite detected a possible problem
@end itemize
It is normal for some tests to report unexpected failures. At the
current time our testing harness does not allow fine grained control
over whether or not a test is expected to fail. We expect to fix this
problem in future releases.
@section Submitting test results
If you want to report the results to the GCC project, use the
@file{contrib/test_summary} shell script. Start it in the @var{objdir} with
@example
@var{srcdir}/contrib/test_summary -p your_commentary.txt \
-m gcc-testresults@@gcc.gnu.org |sh
@end example
This script uses the @command{Mail} program to send the results, so
make sure it is in your @env{PATH}. The file @file{your_commentary.txt} is
prepended to the testsuite summary and should contain any special
remarks you have on your results or your build environment. Please
do not edit the testsuite result block or the subject line, as these
messages are automatically parsed and presented at the
@uref{http://gcc.gnu.org/testresults/,,GCC testresults} web
page. Here you can also gather information on how specific tests
behave on different platforms and compare them with your results. A
few failing testcases are possible even on released versions and you
should look here first if you think your results are unreasonable.
@end ifset
@c ***Final install***********************************************************
@ifnothtml
@comment node-name, next, previous, up
@node Final install, , Testing, Installing GCC
@end ifnothtml
@ifset finalinstallhtml
@html
<h1 align="center">Installing GCC: Final installation</h1>
@end html
@ifnothtml
@chapter Installing GCC: Final installation
@end ifnothtml
Now that GCC has been built and tested, you can install it with
@samp{cd @var{objdir}; make install}.
That step completes the installation of GCC; user level binaries can
be found in @file{@var{prefix}/bin} where @var{prefix} is the value you
specified with the @option{--prefix} to configure (or @file{/usr/local}
by default). (If you specified @option{--bindir}, that directory will
be used instead; otherwise, if you specified @option{--exec-prefix},
@file{@var{exec-prefix}/bin} will be used.) Headers for the C++ and
Java libraries are installed in @file{@var{prefix}/include}; libraries
in @file{@var{libdir}} (normally @file{@var{prefix}/lib}); internal
parts of the compiler in @file{@var{libdir}/gcc-lib}; documentation in
info format in @file{@var{infodir}} (normally @file{@var{prefix}/info}).
If you don't mind, please quickly review the
@uref{http://gcc.gnu.org/gcc-3.0/buildstat.html,,build status page}.
If your system is not listed, send a note to
@uref{mailto:gcc@@gcc.gnu.org,,gcc@@gcc.gnu.org} indicating
that you successfully built and installed GCC.
Include the output from running @file{@var{srcdir}/config.guess}. (Do
not send us the config.guess file itself, just the one-line output from
running it!)
If you find a bug, please report it following our
@uref{../bugs.html,,bug reporting guidelines}.
If you want to print the GCC manuals, do @samp{cd @var{objdir}; make
dvi}. You will need to have @command{texi2dvi} (version at least 4.0)
and @TeX{} installed. This creates a number of @file{.dvi} files in
subdirectories of @file{@var{objdir}}; these may be converted for
printing with programs such as @command{dvips}. You can also
@uref{http://www.gnu.org/order/order.html,,buy printed manuals from the
Free Software Foundation}, though such manuals may not be for the most
recent version of GCC.
@html
<hr>
<p>
@end html
@ifhtml
@uref{./index.html,,Return to the GCC Installation page}
@end ifhtml
@end ifset
@c ***Binaries****************************************************************
@ifnothtml
@comment node-name, next, previous, up
@node Binaries, Specific, Installing GCC, Top
@end ifnothtml
@ifset binarieshtml
@html
<h1 align="center">Installing GCC: Binaries</h1>
@end html
@ifnothtml
@chapter Installing GCC: Binaries
@end ifnothtml
@cindex Binaries
@cindex Installing GCC: Binaries
We are often asked about pre-compiled versions of GCC. While we cannot
provide these for all platforms, below you'll find links to binaries for
various platforms where creating them by yourself is not easy due to various
reasons.
Please note that we did not create these binaries, nor do we
support them. If you have any problems installing them, please
contact their makers.
@itemize
@item
AIX:
@itemize
@item
@uref{http://www-frec.bull.com/docs/download.htm,,Bull's Freeware and
Shareware Archive for AIX};
@item
@uref{http://aixpdlib.seas.ucla.edu,,UCLA Software Library for AIX};
@end itemize
@item
DOS---@uref{http://www.delorie.com/djgpp/,,DJGPP};
@item
@uref{http://hpux.cae.wisc.edu/,,HP-UX Porting Center};
@item
@uref{http://www.sco.com/skunkware/devtools/index.html#gcc,,SCO
OpenServer/Unixware};
@item
Solaris (SPARC, Intel)---@uref{http://www.sunfreeware.com/,,Sunfreeware};
@item
SGI---@uref{http://freeware.sgi.com/,,SGI Freeware};
@item
Windows 95, 98, and NT:
@itemize
@item
The @uref{http://sources.redhat.com/cygwin/,,Cygwin} project;
@item
@uref{http://www.xraylith.wisc.edu/~khan/software/gnu-win32/,,GNU Win32}
related projects by Mumit Khan.
@end itemize
@item
@uref{ftp://ftp.thewrittenword.com/packages/free/by-name/gcc-2.95.2/,,The
Written Word} offers binaries for Solaris 2.5.1, 2.6, 2.7/SPARC, 2.7/Intel,
IRIX 6.2, 6.5, Digital UNIX 4.0D, HP-UX 10.20, and HP-UX 11.00.
@item
Hitachi H8/300[HS]---@uref{http://h8300-hms.sourceforge.net/,,GNU
Development Tools for the Hitachi H8/300[HS] Series}
@end itemize
In addition to those specific offerings, you can get a binary
distribution CD-ROM from the
@uref{http://www.fsf.org/order/order.html,,Free Software Foundation}.
It contains binaries for a number of platforms, and
includes not only GCC, but other stuff as well. The current CD does
not contain the latest version of GCC, but it should allow
bootstrapping the compiler. An updated version of that disk is in the
works.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -