If you have previously built GCC in the same directory for a different target machine, do ‘make distclean’ to delete all files that might be invalid. One of the files this deletes is Makefile; if ‘make distclean’ complains that Makefile does not exist or issues a message like “don’t know how to make distclean” it probably means that the directory is already suitably clean. However, with the recommended method of building in a separate objdir, you should simply use a different objdir for each target.
% mkdir objdir % cd objdir % srcdir/configure [options] [target]
Note that each --enable option has a corresponding --disable option and that each --with option has a corresponding --without option.
--prefix=dirnameSpecify the toplevel installation directory. This is the recommended way to install the tools into a directory other than the default. The toplevel installation directory defaults to /usr/local.
We highly recommend against dirname being the same or a
subdirectory of objdir or vice versa. If specifying a directory
beneath a user’s home directory tree, some shells will not expand
dirname correctly if it contains the ‘~’ metacharacter; use
$HOME instead.
--program-prefix=prefixGCC supports some transformations of the names of its programs when installing them. This option prepends prefix to the names of programs to install in bindir (see above). For example, specifying --program-prefix=foo- would result in ‘gcc’ being installed as /usr/local/bin/foo-gcc.
--program-suffix=suffixAppends suffix to the names of programs to install in bindir (see above). For example, specifying --program-suffix=-3.1 would result in ‘gcc’ being installed as /usr/local/bin/gcc-3.1.
--with-gcc-major-version-onlySpecifies that GCC should use only the major number rather than major.minor.patchlevel in filesystem paths.
--enable-shared[=package[,…]]Build shared versions of libraries, if shared libraries are supported on the target platform. Unlike GCC 2.95.x and earlier, shared libraries are enabled by default on all platforms that support shared libraries.
If a list of packages is given as an argument, build shared libraries only for the listed packages. For other packages, only static libraries will be built. Package names currently recognized in the GCC tree are ‘libgcc’ (also known as ‘gcc’), ‘libstdc++’ (not ‘libstdc++-v3’), ‘libffi’, ‘zlib’, ‘boehm-gc’, ‘ada’, ‘libada’, ‘libgo’, ‘libobjc’, and ‘libphobos’. Note ‘libiberty’ does not support shared libraries at all.
Use --disable-shared to build only static libraries. Note that --disable-shared does not accept a list of package names as argument, only --enable-shared does.
Contrast with --enable-host-shared, which affects host code.
--enable-host-sharedSpecify that the host code should be built into position-independent machine code (with -fPIC), allowing it to be used within shared libraries, but yielding a slightly slower compiler.
This option is required when building the libgccjit.so library.
Contrast with --enable-shared, which affects target libraries.
--enable-versioned-jitSpecify that the ‘libgccjit’ library is built with a soname matching the GCC major version.
--enable-host-pieSpecify that the host executables should be built into position-independent executables (with -fPIE and -pie), yielding a slightly slower compiler (but faster than --enable-host-shared). Position-independent executables are loaded at random addresses each time they are executed, therefore provide additional protection against Return Oriented Programming (ROP) attacks.
--enable-host-pie may be used with --enable-host-shared, in which case -fPIC is used when compiling, and -pie when linking.
--enable-multiarchSpecify whether to enable or disable multiarch support. The default is to check for glibc start files in a multiarch location, and enable it if the files are found. The auto detection is enabled for native builds, and for cross builds configured with --with-sysroot, and without --with-native-system-header-dir. More documentation about multiarch can be found at https://wiki.debian.org/Multiarch.
--enable-vtable-verifySpecify whether to enable or disable the vtable verification feature. Enabling this feature causes libstdc++ to be built with its virtual calls in verifiable mode. This means that, when linked with libvtv, every virtual call in libstdc++ will verify the vtable pointer through which the call will be made before actually making the call. If not linked with libvtv, the verifier will call stub functions (in libstdc++ itself) and do nothing. If vtable verification is disabled, then libstdc++ is not built with its virtual calls in verifiable mode at all. However the libvtv library will still be built (see --disable-libvtv to turn off building libvtv). --disable-vtable-verify is the default.
--enable-libgdiagnosticsSpecify whether to build libgdiagnostics, a shared library exposing
GCC’s diagnostics capabilities via a C API, and a C++ wrapper API adding
“syntactic sugar”.
This option requires --enable-host-shared on non-Windows hosts.
This option also enables sarif-replay, a command-line tool for
viewing SARIF files. sarif-replay takes
one or more .sarif files as input and attempts to replay any
diagnostics within them to stderr (via libgdiagnostics) in the style
of GCC’s diagnostics.
--disable-gcovSpecify that the run-time library used for coverage analysis and associated host tools should not be built.
--disable-multilibSpecify that multiple target libraries to support different target variants, calling conventions, etc. should not be built. The default is to build a predefined set of them.
Some targets provide finer-grained control over which multilibs are built (e.g., --disable-softfloat):
arm-*-*fpu, 26bit, underscore, interwork, biendian, nofmult.
m68*-*-*softfloat, m68881, m68000, m68020.
mips*-*-*single-float, biendian, softfloat.
msp430-*-*no-exceptions
powerpc*-*-*, rs6000*-*-*aix64, pthread, softfloat, powercpu, powerpccpu, powerpcos, biendian, sysv, aix.
--with-multilib-list=list--without-multilib-listSpecify what multilibs to build. list is a comma separated list of values, possibly consisting of a single value. Currently only implemented for aarch64*-*-*, amdgcn*-*-*, arm*-*-*, loongarch*-*-*, nvptx-*, riscv*-*-*, sh*-*-* and x86-64-*-linux*. The accepted values and meaning for each target is given below.
aarch64*-*-*list is a comma separated list of ilp32, and lp64
to enable ILP32 and LP64 run-time libraries, respectively. If
list is empty, then there will be no multilibs and only the
default run-time library will be built. If list is
default or –with-multilib-list= is not specified, then the
default set of libraries is selected based on the value of
--target.
amdgcn*-*-*list is a comma separated list of ISA names (allowed values:
gfx900, gfx902, gfx904, gfx906, gfx908,
gfx909, gfx90a, gfx90c, gfx942, gfx950,
gfx9-generic, gfx9-4-generic, gfx1030, gfx1031,
gfx1032, gfx1033, gfx1034, gfx1035, gfx1036,
gfx10-3-generic, gfx1100, gfx1101, gfx1102,
gfx1103, gfx1150, gfx1151, gfx1152, gfx1153,
gfx11-generic). It ought not include the name of the default
ISA, specified via --with-arch. If list is empty, then there
will be no multilibs and only the default run-time library will be built. If
list is default or --with-multilib-list= is not
specified, then the default set of libraries is selected.
x86-64-*-linux*list is a comma separated list of m32, m64 and
mx32 to enable 32-bit, 64-bit and x32 run-time libraries,
respectively. If list is empty, then there will be no multilibs
and only the default run-time library will be enabled.
If --with-multilib-list is not given, then only 32-bit and 64-bit run-time libraries will be enabled.
--enable-threadsSpecify that the target supports threads. This affects the Objective-C compiler and runtime library, and exception handling for other languages like C++. On some systems, this is the default.
In general, the best (and, in many cases, the only known) threading model available will be configured for use. Beware that on some systems, GCC has not been taught what threading models are generally available for the system. In this case, --enable-threads is an alias for --enable-threads=single.
--enable-threads=libSpecify that lib is the thread support library. This affects the Objective-C compiler and runtime library, and exception handling for other languages like C++. The possibilities for lib are:
noThis is an alias for ‘single’.
posixGeneric POSIX/Unix98 thread support.
singleDisable thread support, should work for all platforms.
win32Microsoft Win32 API thread support.
--enable-tlsSpecify that the target supports TLS (Thread Local Storage). Usually configure can correctly determine if TLS is supported. In cases where it guesses incorrectly, TLS can be explicitly enabled or disabled with --enable-tls or --disable-tls. This can happen if the assembler supports TLS but the C library does not, or if the assumptions made by the configure test are incorrect.
--disable-tm-clone-registryDisable TM clone registry in libgcc. It is enabled in libgcc by default. This option helps to reduce code size for embedded targets which do not use transactional memory.
--with-schedule=cpu--with-arch=cpu--with-arch-32=cpu--with-arch-64=cpu--with-tune=cpu--with-tune-32=cpu--with-tune-64=cpu--with-abi=abi--with-fpu=type--with-float=type--with-simd=typeThese configure options provide default values for the -mschedule=, -march=, -mtune=, -mabi=, and -mfpu= options and for -mhard-float or -msoft-float. As with --with-cpu, which switches will be accepted and acceptable values of the arguments depend on the target.
--with-mode=modeSpecify if the compiler should default to -marm or -mthumb. This option is only supported on ARM targets.
--with-stack-clash-protection-guard-size=sizeOn certain targets this option sets the default stack clash protection guard size as a power of two in bytes. On AArch64 size is required to be either 12 (4KB) or 16 (64KB).
--enable-__cxa_atexitDefine if you want to use __cxa_atexit, rather than atexit,
to register C++ destructors for local statics and global objects.
This is essential for fully standards-compliant handling of
destructors, but requires __cxa_atexit in libc. This option is
currently only available on systems with GNU libc. When enabled, this
will cause -fuse-cxa-atexit to be passed by default.
--enable-gnu-indirect-functionDefine if you want to enable the ifunc attribute. This option is
currently only available on systems with GNU libc on certain targets.
--enable-target-optspaceSpecify that target libraries should be optimized for code space instead of code speed. This is the default for the m32r platform.
--enable-initfini-arrayForce the use of sections .init_array and .fini_array
(instead of .init and .fini) for constructors and
destructors. Option --disable-initfini-array has the
opposite effect. If neither option is specified, the configure script
will try to guess whether the .init_array and
.fini_array sections are supported and, if they are, use them.
--disable-bootstrapFor a native build, the default configuration is to perform a 3-stage bootstrap of the compiler when ‘make’ is invoked, testing that GCC can compile itself correctly. If you want to disable this process, you can configure with --disable-bootstrap.
--enable-bootstrapIn special cases, you may want to perform a 3-stage build even if the target and host triplets are different. This is possible when the host can run code compiled for the target (e.g. host is i686-linux, target is i486-linux). Starting from GCC 4.2, to do this you have to configure explicitly with --enable-bootstrap.
--with-darwin-extra-rpathThis is provided to allow distributions to add a single additional runpath on Darwin / macOS systems. This allows for cases where the installed GCC library directories are then symlinked to a common directory outside of the GCC installation.
--enable-languages=lang1,lang2,…Specify that only a particular subset of compilers and
their runtime libraries should be built. For a list of valid values for
langN you can issue the following command in the
gcc directory of your GCC source tree:
grep ^language= */config-lang.in
Currently, you can use any of the following:
all, default, ada, c, c++,
cobol, d, fortran, go, jit,
lto, m2, objc, obj-c++.
Building the Ada compiler has special requirements, see below.
If you do not pass this flag, or specify the option default, then the
default languages available in the gcc sub-tree will be configured.
Ada, COBOL, D, Go, Jit, Objective-C++ and Modula-2 are not default languages.
LTO is not a
default language, but is built by default because --enable-lto is
enabled by default. The other languages are default languages. If
all is specified, then all available languages are built. An
exception is jit language, which requires
--enable-host-shared to be included with all.
--disable-libadaSpecify that the run-time libraries and tools used by GNAT should not be built. This can be useful for debugging, or for compatibility with previous Ada build procedures, when it was required to explicitly do a ‘make -C gcc gnatlib_and_tools’.
--disable-libgm2Specify that the run-time libraries and tools used by Modula-2 should not be built. This can be useful for debugging.
--disable-libsanitizerSpecify that the run-time libraries for the various sanitizers should not be built.
--disable-libsspSpecify that the run-time libraries for stack smashing protection should not be built or linked against. On many targets library support is provided by the C library instead.
--disable-libquadmathSpecify that the GCC quad-precision math library should not be built. On some systems, the library is required to be linkable when building the Fortran front end, unless --disable-libquadmath-support is used.
--disable-libgompSpecify that the GNU Offloading and Multi Processing Runtime Library should not be built.
--disable-libvtvSpecify that the run-time libraries used by vtable verification should not be built.
--enable-targets=all--enable-targets=target_listSome GCC targets, e.g. powerpc64-linux, build bi-arch compilers. These are compilers that are able to generate either 64-bit or 32-bit code. Typically, the corresponding 32-bit target, e.g. powerpc-linux for powerpc64-linux, only generates 32-bit code. This option enables the 32-bit target to be a bi-arch compiler, which is useful when you want a bi-arch compiler that defaults to 32-bit, and you are building a bi-arch or multi-arch binutils in a combined tree. On mips-linux, this will build a tri-arch compiler (ABI o32/n32/64), defaulted to o32. Currently, this option only affects sparc-linux, powerpc-linux, x86-linux, mips-linux and s390-linux.
--enable-default-pieTurn on -fPIE and -pie by default.
--enable-default-sspTurn on -fstack-protector-strong by default.
--enable-large-address-awareThe --enable-large-address-aware option arranges for MinGW executables to be linked using the --large-address-aware option, that enables the use of more than 2GB of memory. If GCC is configured with this option, its effects can be reversed by passing the -Wl,--disable-large-address-aware option to the so-configured compiler driver.
--enable-win32-registry--enable-win32-registry=key--disable-win32-registryThe --enable-win32-registry option enables Microsoft Windows-hosted GCC to look up installations paths in the registry using the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation\key
key defaults to GCC version number, and can be overridden by the --enable-win32-registry=key option. Vendors and distributors who use custom installers are encouraged to provide a different key, perhaps one comprised of vendor name and GCC version number, to avoid conflict with existing installations. This feature is enabled by default, and can be disabled by --disable-win32-registry option. This option has no effect on the other hosts.
--enable-checking--enable-checking=listThis option controls performing internal consistency checks in the compiler. It does not change the generated code, but adds error checking of the requested complexity. This slows down the compiler and may only work properly if you are building the compiler with GCC.
--enable-coverage--enable-coverage=levelWith this option, the compiler is built to collect self coverage information, every time it is run. This is for internal development purposes, and only works when the compiler is being built with gcc. The level argument controls whether the compiler is built optimized or not, values are ‘opt’ and ‘noopt’. For coverage analysis you want to disable optimization, for performance analysis you want to enable optimization. When coverage is enabled, the default level is without optimization.
--enable-gather-detailed-mem-statsWhen this option is specified more detailed information on memory allocation is gathered. This information is printed when using -fmem-report.
--enable-valgrind-annotationsMark selected memory related operations in the compiler when run under valgrind to suppress false positives.
--enable-nls--disable-nlsThe --enable-nls option enables Native Language Support (NLS), which lets GCC output diagnostics in languages other than American English. Native Language Support is enabled by default if not doing a canadian cross build. The --disable-nls option disables NLS.
Note that this functionality requires either libintl (provided by GNU gettext) or C standard library that contains support for gettext (such as the GNU C Library). See –with-included-gettext, for more information on the conditions required to get gettext support.
--enable-decimal-float--enable-decimal-float=yes--enable-decimal-float=no--enable-decimal-float=bid--enable-decimal-float=dpd--disable-decimal-floatEnable (or disable) support for the C decimal floating point extension that is in the IEEE 754-2008 standard. This is enabled by default only on AArch64, PowerPC, i386, and x86_64 GNU/Linux systems. Other systems may also support it, but require the user to specifically enable it. You can optionally control which decimal floating point format is used (either ‘bid’ or ‘dpd’). The ‘bid’ (binary integer decimal) format is default on AArch64, i386 and x86_64 systems, and the ‘dpd’ (densely packed decimal) format is default on PowerPC systems.
--enable-fixed-point--disable-fixed-pointEnable (or disable) support for C fixed-point arithmetic. This option is enabled by default for some targets (such as MIPS) which have hardware-support for fixed-point operations. On other targets, you may enable this option manually.
--enable-linker-build-idTells GCC to pass --build-id option to the linker for all final links (links performed without the -r or --relocatable option), if the linker supports it. If you specify --enable-linker-build-id, but your linker does not support --build-id option, a warning is issued and the --enable-linker-build-id option is ignored. The default is off.
--with-linker-hash-style=choiceTells GCC to pass --hash-style=choice option to the linker for all final links. choice can be one of ‘sysv’, ‘gnu’, and ‘both’ where ‘sysv’ is the default.
--with-diagnostics-color=choiceTells GCC to use choice as the default for -fdiagnostics-color=
option (if not used explicitly on the command line). choice
can be one of ‘never’, ‘auto’, ‘always’, and ‘auto-if-env’
where ‘auto’ is the default. ‘auto-if-env’ makes
-fdiagnostics-color=auto the default if GCC_COLORS
is present and non-empty in the environment of the compiler, and
-fdiagnostics-color=never otherwise.
--with-diagnostics-urls=choiceTells GCC to use choice as the default for -fdiagnostics-urls=
option (if not used explicitly on the command line). choice
can be one of ‘never’, ‘auto’, ‘always’, and ‘auto-if-env’
where ‘auto’ is the default. ‘auto-if-env’ makes
-fdiagnostics-urls=auto the default if GCC_URLS
or TERM_URLS is present and non-empty in the environment of the
compiler, and -fdiagnostics-urls=never otherwise.
--enable-lto--disable-ltoEnable support for link-time optimization (LTO). This is enabled by default, and may be disabled using --disable-lto.
--enable-canonical-system-headersEnable system header path canonicalization for libcpp. This can produce shorter header file paths in diagnostics and dependency output files, but these changed header paths may conflict with some compilation environments. Enabled by default, and may be disabled using --disable-canonical-system-headers.
--with-glibc-version=major.minorTell GCC that when the GNU C Library (glibc) is used on the target it will be version major.minor or later. Normally this can be detected from the C library’s header files, but this option may be needed when bootstrapping a cross toolchain without the header files available for building the initial bootstrap compiler.
If GCC is configured with some multilibs that use glibc and some that do not, this option applies only to the multilibs that use glibc. However, such configurations may not work well as not all the relevant configuration in GCC is on a per-multilib basis.
--enable-cet--disable-cetEnable building target run-time libraries with control-flow
instrumentation, see -fcf-protection option. When
--enable-cet is specified target libraries are configured
to add -fcf-protection and, if needed, other target
specific options to a set of building options.
--enable-cet=auto is default. CET is enabled on Linux/x86 if
target binutils supports Intel CET instructions and disabled
otherwise. In this case, the target libraries are configured to get
additional -fcf-protection option.
--enable-x86-64-mfentry--disable-x86-64-mfentryEnable -mfentry by default on x86-64 to put the profiling
counter call, __fentry__, before the prologue so that -pg
can be used with -fshrink-wrap which is enabled at -O1.
This configure option is 64-bit only because __fentry__ doesn’t
support PIC in 32-bit mode.
--enable-x86-64-mfentry=auto is default. -mfentry is enabled on Linux/x86-64 by default.
--with-zstd=pathname--with-zstd-include=pathname--with-zstd-lib=pathnameIf you do not have the zstd library installed in a standard
location and you want to build GCC, you can explicitly specify the
directory where it is installed (‘--with-zstd=zstdinstalldir’).
The --with-zstd=zstdinstalldir option is shorthand for
--with-zstd-lib=zstdinstalldir/lib and
--with-zstd-include=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.