@settitle Installing GCC: GNU Free Documentation License
@end ifset
-@c Copyright (C) 1988-2021 Free Software Foundation, Inc.
+@c Copyright (C) 1988-2022 Free Software Foundation, Inc.
@c *** Converted to texinfo by Dean Wakerley, dean@wakerley.com
@c IMPORTANT: whenever you modify this file, run `install.texi2html' to
@c Part 2 Summary Description and Copyright
@copying
-Copyright @copyright{} 1988-2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1988-2022 Free Software Foundation, Inc.
@sp 1
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@end ifnothtml
The latest version of this document is always available at
-@uref{http://gcc.gnu.org/install/,,http://gcc.gnu.org/install/}.
+@uref{https://gcc.gnu.org/install/,,https://gcc.gnu.org/install/}.
It refers to the current development sources, instructions for
specific released versions are included with the sources.
you proceed.
Lists of successful builds for released versions of GCC are
-available at @uref{http://gcc.gnu.org/buildstat.html}.
+available at @uref{https://gcc.gnu.org/buildstat.html}.
These lists are updated as new information becomes available.
The installation procedure itself is broken into five steps.
any longer, and, if shared libraries are installed there as well, no
more binaries exist that use them.
-@ifhtml
-There are also some @uref{old.html,,old installation instructions},
-which are mostly obsolete but still contain some information which has
-not yet been merged into the main part of this manual.
-@end ifhtml
-
@html
<hr />
<p>
GCC binary (version 4.8 or later) because source code for language
frontends other than C might use GCC extensions.
-Note that to bootstrap GCC with versions of GCC earlier than 4.8, you
-may need to use @option{--disable-stage1-checking}, though
-bootstrapping the compiler with such earlier compilers is strongly
-discouraged.
-
@item C standard library and headers
In order to build GCC, the C standard library and headers must be present
@item @anchor{GNAT-prerequisite}GNAT
In order to build GNAT, the Ada compiler, you need a working GNAT
-compiler (GCC version 4.7 or later).
+compiler (GCC version 5.1 or later).
This includes GNAT tools such as @command{gnatmake} and
@command{gnatlink}, since the Ada front end is written in Ada and
by verifying that @samp{gnatls -v} lists only one explicit path in each
section.
+@item @anchor{GDC-prerequisite}GDC
+
+In order to build GDC, the D compiler, you need a working GDC
+compiler (GCC version 9.1 or later) and D runtime library,
+@samp{libphobos}, as the D front end is written in D.
+
+Versions of GDC prior to 12 can be built with an ISO C++11 compiler, which can
+then be installed and used to bootstrap newer versions of the D front end.
+
+It is strongly recommended to use an older version of GDC to build GDC. More
+recent versions of GDC than the version built are not guaranteed to work and
+will often fail during the build with compilation errors relating to
+deprecations or removed features.
+
+Note that @command{configure} does not test whether the GDC installation works
+and has a sufficiently recent version. Though the implementation of the D
+front end does not make use of any GDC-specific extensions, or novel features
+of the D language, if too old a GDC version is installed and
+@option{--enable-languages=d} is used, the build will fail.
+
+On some targets, @samp{libphobos} isn't enabled by default, but compiles
+and works if @option{--enable-libphobos} is used. Specifics are
+documented for affected targets.
+
@item A ``working'' POSIX compatible shell, or GNU bash
Necessary when running @command{configure} because some
host/target specific instructions for your platform for the exact
requirements.
+Note binutils 2.35 or newer is required for LTO to work correctly
+with GNU libtool that includes doing a bootstrap with LTO enabled.
+
@item gzip version 1.2.4 (or later) or
@itemx bzip2 version 1.0.2 (or later)
@item MPC Library version 1.0.1 (or later)
Necessary to build GCC@. It can be downloaded from
-@uref{http://www.multiprecision.org/mpc/}. If an MPC source distribution
+@uref{https://www.multiprecision.org/mpc/}. If an MPC source distribution
is found in a subdirectory of your GCC sources named @file{mpc}, it
will be built together with GCC. Alternatively, if MPC is already
installed but it is not in your default library search path, the
@file{gcc/cp/cfns.gperf} to regenerate its associated header file, e.g.@:
@file{gcc/cp/cfns.h}.
-@item DejaGnu 1.4.4
+@item DejaGnu version 1.5.3 (or later)
@itemx Expect
@itemx Tcl
@c Once Tcl 8.5 or higher is required, remove any obsolete
@cindex Downloading GCC
@cindex Downloading the Source
-GCC is distributed via @uref{http://gcc.gnu.org/git.html,,git} and via
+GCC is distributed via @uref{https://gcc.gnu.org/git.html,,git} and via
HTTPS as tarballs compressed with @command{gzip} or @command{bzip2}.
-Please refer to the @uref{http://gcc.gnu.org/releases.html,,releases web page}
+Please refer to the @uref{https://gcc.gnu.org/releases.html,,releases web page}
for information on how to obtain GCC@.
The source distribution includes the C, C++, Objective-C, Fortran,
@quotation
aarch64, aarch64_be, alpha, alpha64, amdgcn, arc, arceb, arm, armeb, avr, bfin,
bpf, cr16, cris, csky, epiphany, fido, fr30, frv, ft32, h8300, hppa, hppa2.0,
-hppa64, i486, i686, ia64, iq2000, lm32, m32c, m32r, m32rle, m68k, mcore,
-microblaze, microblazeel, mips, mips64, mips64el, mips64octeon, mips64orion,
-mips64vr, mipsel, mipsisa32, mipsisa32r2, mipsisa64, mipsisa64r2,
+hppa64, i486, i686, ia64, iq2000, lm32, loongarch64, m32c, m32r, m32rle, m68k,
+mcore, microblaze, microblazeel, mips, mips64, mips64el, mips64octeon,
+mips64orion, mips64vr, mipsel, mipsisa32, mipsisa32r2, mipsisa64, mipsisa64r2,
mipsisa64r2el, mipsisa64sb1, mipsisa64sr71k, mipstx39, mmix, mn10300, moxie,
msp430, nds32be, nds32le, nios2, nvptx, or1k, pdp11, powerpc, powerpc64,
powerpc64le, powerpcle, pru, riscv32, riscv32be, riscv64, riscv64be, rl78, rx,
-s390, s390x, sh, shle, sparc, sparc64, tic6x, tilegx, tilegxbe, tilepro, v850,
+s390, s390x, sh, shle, sparc, sparc64, tic6x, v850,
v850e, v850e1, vax, visium, x86_64, xstormy16, xtensa
@end quotation
@itemx --without-multilib-list
Specify what multilibs to build. @var{list} is a comma separated list of
values, possibly consisting of a single value. Currently only implemented
-for aarch64*-*-*, arm*-*-*, riscv*-*-*, sh*-*-* and x86-64-*-linux*. The
-accepted values and meaning for each target is given below.
+for aarch64*-*-*, arm*-*-*, loongarch64-*-*, riscv*-*-*, sh*-*-* and
+x86-64-*-linux*. The accepted values and meaning for each target is given
+below.
@table @code
@item aarch64*-*-*
@code{-mfloat-abi=hard}
@end multitable
+@item loongarch*-*-*
+@var{list} is a comma-separated list of the following ABI identifiers:
+@code{lp64d[/base]} @code{lp64f[/base]} @code{lp64d[/base]}, where the
+@code{/base} suffix may be omitted, to enable their respective run-time
+libraries. If @var{list} is empty or @code{default},
+or if @option{--with-multilib-list} is not specified, then the default ABI
+as specified by @option{--with-abi} or implied by @option{--target} is selected.
+
@item riscv*-*-*
@var{list} is a single ABI name. The target architecture must be either
@code{rv32gc} or @code{rv64gc}. This will build a single multilib for the
size as a power of two in bytes. On AArch64 @var{size} is required to be either
12 (4KB) or 16 (64KB).
+@item --with-isa-spec=@var{ISA-spec-string}
+On RISC-V targets specify the default version of the RISC-V Unprivileged
+(formerly User-Level) ISA specification to produce code conforming to.
+The possibilities for @var{ISA-spec-string} are:
+@table @code
+@item 2.2
+Produce code conforming to version 2.2.
+@item 20190608
+Produce code conforming to version 20190608.
+@item 20191213
+Produce code conforming to version 20191213.
+@end table
+In the absence of this configuration option the default version is 20191213.
+
@item --enable-__cxa_atexit
Define if you want to use __cxa_atexit, rather than atexit, to
register C++ destructors for local statics and global objects.
point, it is not recommended to use
@option{--with-long-double-format=ieee}.
-On little endian PowerPC Linux systems, if you explicitly set the
-@code{long double} type, it will build multilibs to allow you to
-select either @code{long double} format, unless you disable multilibs
-with the @code{--disable-multilib} option. At present,
-@code{long double} multilibs are not built on big endian PowerPC Linux
-systems. If you are building multilibs, you will need to configure
-the compiler using the @option{--with-system-zlib} option.
-
-If you do not set the @code{long double} type explicitly, no multilibs
-will be generated.
-
@item --enable-fdpic
On SH Linux systems, generate ELF FDPIC code.
of those optional packages should determine the actual supported offloading
target set rather than the GCC configure-time selection.
-@item --with-hsa-runtime=@var{pathname}
-@itemx --with-hsa-runtime-include=@var{pathname}
-@itemx --with-hsa-runtime-lib=@var{pathname}
-
-If you configure GCC with offloading which uses an HSA run-time such as
-AMDGCN but do not have the HSA run-time library installed in a standard
-location then you can explicitly specify the directory where they are
-installed. The @option{--with-hsa-runtime=@/@var{hsainstalldir}} option
-is a shorthand for
-@option{--with-hsa-runtime-lib=@/@var{hsainstalldir}/lib} and
-@option{--with-hsa-runtime-include=@/@var{hsainstalldir}/include}.
-
@item --enable-cet
@itemx --disable-cet
Enable building target run-time libraries with control-flow
default is derived from glibc's behavior. When glibc clamps float_t to double,
GCC follows and enables the option. For other cross compiles, the default is
disabled.
+
+@item --with-zstd=@var{pathname}
+@itemx --with-zstd-include=@var{pathname}
+@itemx --with-zstd-lib=@var{pathname}
+If you do not have the @code{zstd} library installed in a standard
+location and you want to build GCC, you can explicitly specify the
+directory where it is installed (@samp{--with-zstd=@/@var{zstdinstalldir}}).
+The @option{--with-zstd=@/@var{zstdinstalldir}} option is shorthand for
+@option{--with-zstd-lib=@/@var{zstdinstalldir}/lib} and
+@option{--with-zstd-include=@/@var{zstdinstalldir}/include}. If this
+shorthand assumption is not correct, you can use the explicit
+include and lib options directly.
+
+These flags are applicable to the host platform only. When building
+a cross compiler, they will not be used to configure target libraries.
@end table
@subheading Cross-Compiler-Specific Options
being used as the target C@tie{} library. This causes float support
functions like @code{__addsf3} to be omitted from @file{libgcc.a} on
the assumption that it will be provided by @file{libm.a}. For more
-technical details, cf. @uref{http://gcc.gnu.org/PR54461,,PR54461}.
+technical details, cf. @uref{https://gcc.gnu.org/PR54461,,PR54461}.
It is not supported for
RTEMS configurations, which currently use newlib. The option is
supported since version 4.7.2 and is the default in 4.8.0 and newer.
@uref{prerequisites.html#GNAT-prerequisite,,GNAT prerequisites}.
@end ifhtml
+@section Building the D compiler
+
+@ifnothtml
+@ref{GDC-prerequisite}.
+@end ifnothtml
+@ifhtml
+@uref{prerequisites.html#GDC-prerequisite,,GDC prerequisites}.
+@end ifhtml
+
@section Building with profile feedback
It is possible to use profile feedback to optimize the compiler itself. This
Before you install GCC, we encourage you to run the testsuites and to
compare your results with results from a similar configuration that have
been submitted to the
-@uref{http://gcc.gnu.org/ml/gcc-testresults/,,gcc-testresults mailing list}.
+@uref{https://gcc.gnu.org/ml/gcc-testresults/,,gcc-testresults mailing list}.
Some of these archived results are linked from the build status lists
-at @uref{http://gcc.gnu.org/buildstat.html}, although not everyone who
+at @uref{https://gcc.gnu.org/buildstat.html}, although not everyone who
reports a successful build runs the testsuites and submits the results.
This step is optional and may require you to download additional software,
but it can give you confidence in your new GCC installation or point out
separately.
Second, you must have the testing tools installed. This includes
-@uref{http://www.gnu.org/software/dejagnu/,,DejaGnu}, Tcl, and Expect;
+@uref{https://www.gnu.org/software/dejagnu/,,DejaGnu}, Tcl, and Expect;
the DejaGnu site has links to these.
Some optional tests also require Python3 and pytest module.
@samp{WARNING: Couldn't find tool init file} that can be ignored.
If you are testing a cross-compiler, you may want to run the testsuite
-on a simulator as described at @uref{http://gcc.gnu.org/simtest-howto.html}.
+on a simulator as described at @uref{https://gcc.gnu.org/simtest-howto.html}.
@section How can you run the testsuite on selected tests?
If you are bootstrapping a released version of GCC then please
quickly review the build status page for your release, available from
-@uref{http://gcc.gnu.org/buildstat.html}.
+@uref{https://gcc.gnu.org/buildstat.html}.
If your system is not listed for the version of GCC that you built,
send a note to
@email{gcc@@gcc.gnu.org} indicating
@item
The @uref{https://sourceware.org/cygwin/,,Cygwin} project;
@item
-The @uref{http://www.mingw.org/,,MinGW} and
-@uref{http://mingw-w64.org/doku.php,,mingw-w64} projects.
+The @uref{https://osdn.net/projects/mingw/,,MinGW} and
+@uref{https://www.mingw-w64.org/,,mingw-w64} projects.
@end itemize
@item
number of platforms.
@item
-The @uref{http://gcc.gnu.org/wiki/GFortranBinaries,,GFortran Wiki} has
+The @uref{https://gcc.gnu.org/wiki/GFortranBinaries,,GFortran Wiki} has
links to GNU Fortran binaries for several platforms.
@end itemize
@item
@uref{#c6x-x-x,,c6x-*-*}
@item
-@uref{#tilegx-x-linux,,tilegx-*-linux*}
-@item
-@uref{#tilegxbe-x-linux,,tilegxbe-*-linux*}
-@item
-@uref{#tilepro-x-linux,,tilepro-*-linux*}
-@item
@uref{#visium-x-elf, visium-*-elf}
@item
@uref{#x-x-vxworks,,*-*-vxworks*}
@end html
@anchor{cris}
@heading CRIS
-CRIS is the CPU architecture in Axis Communications ETRAX system-on-a-chip
-series. These are used in embedded applications.
+CRIS is a CPU architecture in Axis Communications systems-on-a-chip, for
+example the ETRAX series. These are used in embedded applications.
@ifnothtml
@xref{CRIS Options,, CRIS Options, gcc, Using the GNU Compiler
@end ifhtml
for a list of CRIS-specific options.
-There are a few different CRIS targets:
-@table @code
-@item cris-axis-elf
-Mainly for monolithic embedded systems. Includes a multilib for the
-@samp{v10} core used in @samp{ETRAX 100 LX}.
-@item cris-axis-linux-gnu
-A GNU/Linux port for the CRIS architecture, currently targeting
-@samp{ETRAX 100 LX} by default.
-@end table
-
-Pre-packaged tools can be obtained from
-@uref{ftp://ftp.axis.com/@/pub/@/axis/@/tools/@/cris/@/compiler-kit/}. More
-information about this platform is available at
-@uref{http://developer.axis.com/}.
-
+Use @samp{configure --target=cris-elf} to configure GCC@ for building
+a cross-compiler for CRIS.
@html
<hr />
@end html
@end html
@anchor{x-x-freebsd}
@heading *-*-freebsd*
-Support for FreeBSD 1 was discontinued in GCC 3.2. Support for
-FreeBSD 2 (and any mutant a.out variants of FreeBSD 3) was
-discontinued in GCC 4.0.
-
In order to better utilize FreeBSD base system functionality and match
the configuration of the system compiler, GCC 4.5 and above as well as
GCC 4.4 past 2010-06-20 leverage SSP support in libc (which is present
@anchor{ix86-x-linux}
@heading i?86-*-linux*
As of GCC 3.3, binutils 2.13.1 or later is required for this platform.
-See @uref{http://gcc.gnu.org/PR10877,,bug 10877} for more information.
+See @uref{https://gcc.gnu.org/PR10877,,bug 10877} for more information.
If you receive Signal 11 errors when building on GNU/Linux, then it is
possible you have a hardware problem. Further information on this can be
-found on @uref{http://www.bitwizard.nl/sig11/,,www.bitwizard.nl}.
+found on @uref{https://www.bitwizard.nl/sig11/,,www.bitwizard.nl}.
@html
<hr />
@option{--with-system-libunwind}, then you must use libunwind 0.98 or
later.
-None of the following versions of GCC has an ABI that is compatible
-with any of the other versions in this list, with the exception that
-Red Hat 2.96 and Trillian 000171 are compatible with each other:
-3.1, 3.0.2, 3.0.1, 3.0, Red Hat 2.96, and Trillian 000717.
-This primarily affects C++ programs and programs that create shared libraries.
-GCC 3.1 or later is recommended for compiling linux, the kernel.
-As of version 3.1 GCC is believed to be fully ABI compliant, and hence no
-more major ABI changes are expected.
-
@html
<hr />
@end html
GCC-produced object files into an executable that overflows the TOC@. A fix
for APAR IX75823 (OVERFLOW DURING LINK WHEN USING GCC AND -BBIGTOC) is
available from IBM Customer Support and from its
-@uref{http://techsupport.services.ibm.com/,,techsupport.services.ibm.com}
+@uref{https://techsupport.services.ibm.com/,,techsupport.services.ibm.com}
website as PTF U455193.
The AIX 4.3.2.1 linker (bos.rte.bind_cmds Level 4.3.2.1) will dump core
with a segmentation fault when invoked by any version of GCC@. A fix for
APAR IX87327 is available from IBM Customer Support and from its
-@uref{http://techsupport.services.ibm.com/,,techsupport.services.ibm.com}
+@uref{https://techsupport.services.ibm.com/,,techsupport.services.ibm.com}
website as PTF U461879. This fix is incorporated in AIX 4.3.3 and above.
The initial assembler shipped with AIX 4.3.0 generates incorrect object
files. A fix for APAR IX74254 (64BIT DISASSEMBLED OUTPUT FROM COMPILER FAILS
TO ASSEMBLE/BIND) is available from IBM Customer Support and from its
-@uref{http://techsupport.services.ibm.com/,,techsupport.services.ibm.com}
+@uref{https://techsupport.services.ibm.com/,,techsupport.services.ibm.com}
website as PTF U453956. This fix is incorporated in AIX 4.3.1 and above.
AIX provides National Language Support (NLS)@. Compilers and assemblers
Lattice Mico32 processor.
This configuration is intended for embedded systems running uClinux.
+@html
+<hr />
+@end html
+@anchor{loongarch}
+@heading LoongArch
+LoongArch processor.
+The following LoongArch targets are available:
+@table @code
+@item loongarch64-linux-gnu*
+LoongArch processor running GNU/Linux. This target triplet may be coupled
+with a small set of possible suffixes to identify their default ABI type:
+@table @code
+@item f64
+Uses @code{lp64d/base} ABI by default.
+@item f32
+Uses @code{lp64f/base} ABI by default.
+@item sf
+Uses @code{lp64s/base} ABI by default.
+@end table
+
+@item loongarch64-linux-gnu
+Same as @code{loongarch64-linux-gnuf64}, but may be used with
+@option{--with-abi=*} to configure the default ABI type.
+@end table
+
+More information about LoongArch can be found at
+@uref{https://github.com/loongson/LoongArch-Documentation}.
+
@html
<hr />
@end html
This version of GCC requires at least cctools-590.36. The
cctools-590.36 package referenced from
-@uref{http://gcc.gnu.org/ml/gcc/2006-03/msg00507.html} will not work
+@uref{https://gcc.gnu.org/ml/gcc/2006-03/msg00507.html} will not work
on systems older than 10.3.9 (aka darwin7.9.0).
@html
appropriate version is found. Solaris @command{c++filt} from the Solaris
Studio compilers does @emph{not} work.
+In order to build the GNU D compiler, GDC, a working @samp{libphobos} is
+needed. That library wasn't built by default in GCC 9--11 on SPARC, or
+on x86 when the Solaris assembler is used, but can be enabled by
+configuring with @option{--enable-libphobos}. Also, GDC 9.4.0 is
+required on x86, while GDC 9.3.0 is known to work on SPARC.
+
The versions of the GNU Multiple Precision Library (GMP), the MPFR
library and the MPC library bundled with Solaris 11.3 and later are
usually recent enough to match GCC's requirements. There are two
@item
The version of the MPFR libary included in Solaris 11.3 is too old; you
need to provide a more recent one.
+
@end itemize
@html
@heading c6x-*-*
The C6X family of processors. This port requires binutils-2.22 or newer.
-@html
-<hr />
-@end html
-@anchor{tilegx-*-linux}
-@heading tilegx-*-linux*
-The TILE-Gx processor in little endian mode, running GNU/Linux. This
-port requires binutils-2.22 or newer.
-
-@html
-<hr />
-@end html
-@anchor{tilegxbe-*-linux}
-@heading tilegxbe-*-linux*
-The TILE-Gx processor in big endian mode, running GNU/Linux. This
-port requires binutils-2.23 or newer.
-
-@html
-<hr />
-@end html
-@anchor{tilepro-*-linux}
-@heading tilepro-*-linux*
-The TILEPro processor running GNU/Linux. This port requires
-binutils-2.22 or newer.
-
@html
<hr />
@end html
@subheading Intel 64-bit versions
GCC contains support for x86-64 using the mingw-w64
-runtime library, available from @uref{http://mingw-w64.org/doku.php}.
+runtime library, available from @uref{https://www.mingw-w64.org/downloads/}.
This library should be used with the target triple x86_64-pc-mingw32.
-Presently Windows for Itanium is not supported.
-
@subheading Windows CE
Windows CE is supported as a target only on Hitachi
SuperH (sh-wince-pe), and MIPS (mips-wince-pe).