GCC is a comprehensive compiler software developed by GNU that supports a wide range of programming languages.
As with all GNU software, GCC requires configuration before it can be built. This documentation outlines the configuration process for both native and cross targets. The toplevel source directory for GCC is referred to as srcdir, while the toplevel build/object directory is referred to as objdir.
It's important to note that if the sources were acquired via CVS, srcdir must be the top gcc directory where the MAINTAINERS can be found, and not the gcc subdirectory. Failure to do so may result in a failed build. It's also advised to avoid using temporary pathnames returned by the shell's built-in pwd command when either srcdir or objdir is located on an automounted NFS file system. The PWDCMD environment variable should be set to an automounter-aware pwd command (such as pawd or `amq -w') during the configuration and build phases to prevent build problems.
It's highly recommended to build GCC in a separate directory than the sources, one that doesn't reside within the source tree. While building where srcdir and objdir are the same may work, it doesn't undergo extensive testing. Building where objdir is a subdirectory of srcdir is also unsupported. Furthermore, if GCC has been previously built in the same directory for another target machine, `make distclean' should be used to delete all invalid files. Makefile is one of the files that will be deleted; if `make distclean' complains that Makefile doesn't exist or issues a message like "don't know how to make distclean," the directory is already suitably clean. Different objdirs should be used for each target when building using the recommended method of building in a separate objdir.
When configuring a native system, either cc or gcc must be in the path or CC must be set in the environment before running configure. Otherwise, the configuration scripts may fail. Additionally, the bootstrap compiler and resulting GCC must be link-compatible, or the bootstrap will fail with linker errors about incompatible object file formats. Several multilibed targets are affected by this requirement; visit host/target specific installation notes for more information.
To configure GCC, first, create a separate directory for the build called objdir, and then navigate to this directory using command-line prompts. Finally, type srcdir/configure [options] [target] to complete the configuration process. Note that for configuring a native compiler, target specification is unnecessary, as GCC can automatically determine the correct value for target for nearly all native systems. For configuring a cross compiler, target must be specified as --target=target, with target being m68k-coff, sh-elf, etc. Specifying only target implies that the host defaults to target.
Version 4.4.2: N/A