Installing GCC

Now that GCC has been built (and optionally tested), you can install it with

cd objdir && make install

We strongly recommend to install into a target directory where there is no previous version of GCC present. Also, the GNAT runtime should not be stripped, as this would break certain features of the debugger that depend on this debugging information (catching Ada exceptions for instance).

That step completes the installation of GCC; user level binaries can be found in prefix/bin where prefix is the value you specified with the --prefix to configure (or /usr/local by default). (If you specified --bindir, that directory will be used instead; otherwise, if you specified --exec-prefix, exec-prefix/bin will be used.) Headers for the C++ library are installed in prefix/include; libraries in libdir (normally prefix/lib); internal parts of the compiler in libdir/gcc and libexecdir/gcc; documentation in info format in infodir (normally prefix/info).

When installing cross-compilers, GCC’s executables are not only installed into bindir, that is, exec-prefix/bin, but additionally into exec-prefix/target-alias/bin, if that directory exists. Typically, such tooldirs hold target-specific binutils, including assembler and linker.

Installation into a temporary staging area or into a chroot jail can be achieved with the command

make DESTDIR=path-to-rootdir install

where path-to-rootdir is the absolute path of a directory relative to which all installation paths will be interpreted. Note that the directory specified by DESTDIR need not exist yet; it will be created if necessary.

There is a subtle point with tooldirs and DESTDIR: If you relocate a cross-compiler installation with e.g. ‘DESTDIR=rootdir’, then the directory rootdir/exec-prefix/target-alias/bin will be filled with duplicated GCC executables only if it already exists, it will not be created otherwise. This is regarded as a feature, not as a bug, because it gives slightly more control to the packagers using the DESTDIR feature.

You can install stripped programs and libraries with

make install-strip

If you are bootstrapping a released version of GCC then please quickly review the build status page for your release, available from http://gcc.gnu.org/buildstat.html. If your system is not listed for the version of GCC that you built, send a note to gcc@gcc.gnu.org indicating that you successfully built and installed GCC. Include the following information:

We’d also like to know if the host/target specific installation notes didn’t include your host/target information or if that information is incomplete or out of date. Send a note to gcc@gcc.gnu.org detailing how the information should be changed.

If you find a bug, please report it following the bug reporting guidelines.

If you want to print the GCC manuals, do ‘cd objdir; make dvi’. You will need to have texi2dvi (version at least 4.7) and TeX installed. This creates a number of .dvi files in subdirectories of objdir; these may be converted for printing with programs such as dvips. Alternately, by using ‘make pdf’ in place of ‘make dvi’, you can create documentation in the form of .pdf files; this requires texi2pdf, which is included with Texinfo version 4.8 and later. You can also buy printed manuals from the Free Software Foundation, though such manuals may not be for the most recent version of GCC.

If you would like to generate online HTML documentation, do ‘cd objdir; make html’ and HTML will be generated for the gcc manuals in objdir/gcc/HTML.


Return to the GCC Installation page