Installing GCC: Configuration - GNU Project (2022)

Like most GNU software, GCC must be configured before it can be built.This document describes the recommended configuration procedurefor both native and cross targets.

We use srcdir to refer to the toplevel source directory forGCC; we use objdir to refer to the toplevel build/object directory.

If you obtained the sources by cloning the repository, srcdirmust refer to the top gcc directory, the one where theMAINTAINERS file can be found, and not its gccsubdirectory, otherwise the build will fail.

If either srcdir or objdir is located on an automounted NFSfile system, the shell’s built-in pwd command will returntemporary pathnames. Using these can lead to various sorts of buildproblems. To avoid this issue, set the PWDCMD environmentvariable to an automounter-aware pwd command, e.g.,pawd or ‘amq -w’, during the configuration and buildphases.

First, we highly recommend that GCC be built into aseparate directory from the sources which does not residewithin the source tree. This is how we generally build GCC; buildingwhere srcdir == objdir should still work, but doesn’tget extensive testing; building where objdir is a subdirectoryof srcdir is unsupported.

If you have previously built GCC in the same directory for adifferent target machine, do ‘make distclean’ to delete all filesthat might be invalid. One of the files this deletes is Makefile;if ‘make distclean’ complains that Makefile does not existor issues a message like “don’t know how to make distclean” it probablymeans that the directory is already suitably clean. However, with therecommended method of building in a separate objdir, you shouldsimply use a different objdir for each target.

Second, when configuring a native system, either cc orgcc must be in your path or you must set CC inyour environment before running configure. Otherwise the configurationscripts may fail.

If you will be distributing binary versions of GCC, with modificationsto the source code, you should use the options described in thissection to make clear that your version contains modifications.

Specify the host, build and target machine configurations. You do thiswhen you run the configure script.

The build machine is the system which you are using, thehost machine is the system where you want to run the resultingcompiler (normally the build machine), and the target machine isthe system for which you want the compiler to generate code.

If you are building a compiler to produce code for the machine it runson (a native compiler), you normally do not need to specify any operandsto configure; it will try to guess the type of machine you are onand use that as the build, host and target machines. So you don’t needto specify a configuration when building a native compiler unlessconfigure cannot figure out what your configuration is or guesseswrong.

In those cases, specify the build machine’s configuration namewith the --host option; the host and target will default to bethe same as the host machine.

A configuration name may be canonical or it may be more or lessabbreviated (config.sub script produces canonical versions).

A canonical configuration name has three parts, separated by dashes.It looks like this: ‘cpu-company-system’.

Use options to override several configure time options forGCC. A list of supported options follows; ‘configure--help’ may list other options, but those not listed below may notwork and should not normally be used.

Note that each --enable option has a corresponding--disable option and that each --with option has acorresponding --without option.

--prefix=dirname

Specify the toplevel installationdirectory. This is the recommended way to install the tools into a directoryother than the default. The toplevel installation directory defaults to/usr/local.

We highly recommend against dirname being the same or asubdirectory of objdir or vice versa. If specifying a directorybeneath a user’s home directory tree, some shells will not expanddirname correctly if it contains the ‘~’ metacharacter; use$HOME instead.

The following standard autoconf options are supported. Normally youshould not need to use these options.

--exec-prefix=dirname

Specify the toplevel installation directory for architecture-dependentfiles. The default is prefix.

--bindir=dirname

Specify the installation directory for the executables called by users(such as gcc and g++). The default isexec-prefix/bin.

--libdir=dirname

Specify the installation directory for object code libraries andinternal data files of GCC. The default is exec-prefix/lib.

--libexecdir=dirname

Specify the installation directory for internal executables of GCC.The default is exec-prefix/libexec.

--with-slibdir=dirname

Specify the installation directory for the shared libgcc library. Thedefault is libdir.

--datarootdir=dirname

Specify the root of the directory tree for read-only architecture-independentdata files referenced by GCC. The default is prefix/share.

--infodir=dirname

Specify the installation directory for documentation in info format.The default is datarootdir/info.

--datadir=dirname

Specify the installation directory for some architecture-independentdata files referenced by GCC. The default is datarootdir.

--docdir=dirname

Specify the installation directory for documentation files (otherthan Info) for GCC. The default is datarootdir/doc.

--htmldir=dirname

Specify the installation directory for HTML documentation files.The default is docdir.

--pdfdir=dirname

Specify the installation directory for PDF documentation files.The default is docdir.

--mandir=dirname

Specify the installation directory for manual pages. The default isdatarootdir/man. (Note that the manual pages are only extractsfrom the full GCC manuals, which are provided in Texinfo format. The manpagesare derived by an automatic conversion process from parts of the fullmanual.)

--with-gxx-include-dir=dirname

Specifythe installation directory for G++ header files. The default dependson other configuration options, and differs between cross and nativeconfigurations.

--with-specs=specs

Specify additional command line driver SPECS.This can be useful if you need to turn on a non-standard feature bydefault without modifying the compiler’s source code, for instance--with-specs=%{!fcommon:%{!fno-common:-fno-common}}.See “Spec Files” in the main manual

--program-prefix=prefix

GCC supports some transformations of the names of its programs wheninstalling them. This option prepends prefix to the names ofprograms 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=suffix

Appends suffix to the names of programs to install in bindir(see above). For example, specifying --program-suffix=-3.1would result in ‘gcc’ being installed as/usr/local/bin/gcc-3.1.

--program-transform-name=pattern

Applies the ‘sed’ script pattern to be applied to the namesof programs to install in bindir (see above). pattern has toconsist of one or more basic ‘sed’ editing commands, separated bysemicolons. For example, if you want the ‘gcc’ program name to betransformed to the installed program /usr/local/bin/myowngcc andthe ‘g++’ program name to be transformed to/usr/local/bin/gspecial++ without changing other program names,you could use the pattern--program-transform-name='s/^gcc$/myowngcc/; s/^g++$/gspecial++/'to achieve this effect.

All three options can be combined and used together, resulting in morecomplex conversion patterns. As a basic rule, prefix (andsuffix) are prepended (appended) before further transformationscan happen with a special transformation script pattern.

As currently implemented, this option only takes effect for nativebuilds; cross compiler binaries’ names are not transformed even when atransformation is explicitly asked for by one of these options.

For native builds, some of the installed programs are also installedwith the target alias in front of their name, as in‘i686-pc-linux-gnu-gcc’. All of the above transformations happenbefore the target alias is prepended to the name—so, specifying--program-prefix=foo- and program-suffix=-3.1, theresulting binary would be installed as/usr/local/bin/i686-pc-linux-gnu-foo-gcc-3.1.

As a last shortcoming, none of the installed Ada programs aretransformed yet, which will be fixed in some time.

--with-local-prefix=dirname

Specify theinstallation directory for local include files. The default is/usr/local. Specify this option if you want the compiler tosearch directory dirname/include for locally installedheader files instead of /usr/local/include.

You should specify --with-local-prefix only if yoursite has a different convention (not /usr/local) for where to putsite-specific files.

The default value for --with-local-prefix is /usr/localregardless of the value of --prefix. Specifying--prefix has no effect on which directory GCC searches forlocal header files. This may seem counterintuitive, but actually it islogical.

The purpose of --prefix is to specify where to installGCC. The local header files in /usr/local/include—if you putany in that directory—are not part of GCC. They are part of otherprograms—perhaps many others. (GCC installs its own header files inanother directory which is based on the --prefix value.)

Both the local-prefix include directory and the GCC-prefix includedirectory are part of GCC’s “system include” directories. Although thesetwo directories are not fixed, they need to be searched in the properorder for the correct processing of the include_next directive. Thelocal-prefix include directory is searched before the GCC-prefixinclude directory. Another characteristic of system include directoriesis that pedantic warnings are turned off for headers in these directories.

Some autoconf macros add -I directory options to thecompiler command line, to ensure that directories containing installedpackages’ headers are searched. When directory is one of GCC’ssystem include directories, GCC will ignore the option so that systemdirectories continue to be processed in the correct order. Thismay result in a search order different from what was specified but thedirectory will still be searched.

GCC automatically searches for ordinary libraries usingGCC_EXEC_PREFIX. Thus, when the same installation prefix isused for both GCC and packages, GCC will automatically search forboth headers and libraries. This provides a configuration that iseasy to use. GCC behaves in a manner similar to that when it isinstalled as a system compiler in /usr.

Sites that need to install multiple versions of GCC may not want touse the above simple configuration. It is possible to use the--program-prefix, --program-suffix and--program-transform-name options to install multiple versionsinto a single directory, but it may be simpler to use different prefixesand the --with-local-prefix option to specify the location of thesite-specific files for each version. It will then be necessary forusers to specify explicitly the location of local site libraries(e.g., with LIBRARY_PATH).

The same value can be used for both --with-local-prefix and--prefix provided it is not /usr. This can be usedto avoid the default search of /usr/local/include.

Do not specify /usr as the --with-local-prefix!The directory you use for --with-local-prefix must notcontain any of the system’s standard header files. If it did containthem, certain programs would be miscompiled (including GNU Emacs, oncertain targets), because this would override and nullify the headerfile corrections made by the fixincludes script.

Indications are that people who use this option use it based on mistakenideas of what it is for. People use it as if it specified where toinstall part of GCC. Perhaps they make this assumption becauseinstalling GCC creates the directory.

--with-gcc-major-version-only

Specifies that GCC should use only the major number rather thanmajor.minor.patchlevel in filesystem paths.

--with-native-system-header-dir=dirname

Specifies that dirname is the directory that contains native systemheader files, rather than /usr/include. This option is most usefulif you are creating a compiler that should be isolated from the systemas much as possible. It is most commonly used with the--with-sysroot option and will cause GCC to searchdirname inside the system root specified by that option.

--enable-shared[=package[,…]]

Build shared versions of libraries, if shared libraries are supported onthe target platform. Unlike GCC 2.95.x and earlier, shared librariesare enabled by default on all platforms that support shared libraries.

If a list of packages is given as an argument, build shared librariesonly for the listed packages. For other packages, only static librarieswill 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 asargument, only --enable-shared does.

(Video) Installing GCC on Windows 10 in 2021 Made Easy

Contrast with --enable-host-shared, which affects hostcode.

--enable-host-shared

Specify that the host code should be built into position-independentmachine 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 targetlibraries.

--with-gnu-as

Specify that the compiler should assume that theassembler it finds is the GNU assembler. However, this does not modifythe rules to find an assembler and will result in confusion if theassembler found is not actually the GNU assembler. (Confusion may alsoresult if the compiler finds the GNU assembler but has not beenconfigured with --with-gnu-as.) If you have more than oneassembler installed on your system, you may want to use this option inconnection with --with-as=pathname or--with-build-time-tools=pathname.

The following systems are the only ones where it makes a differencewhether you use the GNU assembler. On any other system,--with-gnu-as has no effect.

  • hppa1.0-any-any
  • hppa1.1-any-any
  • sparc-sun-solaris2.any
  • sparc64-any-solaris2.any
--with-as=pathname

Specify that the compiler should use the assembler pointed to bypathname, rather than the one found by the standard rules to findan assembler, which are:

  • Unless GCC is being built with a cross compiler, check thelibexec/gcc/target/version directory.libexec defaults to exec-prefix/libexec;exec-prefix defaults to prefix, whichdefaults to /usr/local unless overridden by the--prefix=pathname switch described above. targetis the target system triple, such as ‘sparc-sun-solaris2.7’, andversion denotes the GCC version, such as 3.0.
  • If the target system is the same that you are building on, checkoperating system specific directories (e.g. /usr/ccs/bin onSolaris 2).
  • Check in the PATH for a tool whose name is prefixed by thetarget system triple.
  • Check in the PATH for a tool whose name is not prefixed by thetarget system triple, if the host and target system triple arethe same (in other words, we use a host tool if it can be used forthe target as well).

You may want to use --with-as if no assembleris installed in the directories listed above, or if you have multipleassemblers installed and want to choose one that is not found by theabove rules.

--with-gnu-ld

Same as --with-gnu-asbut for the linker.

--with-ld=pathname

Same as --with-asbut for the linker.

--with-dsymutil=pathname

Same as --with-asbut for the debug linker (only used on Darwin platforms so far).

--with-tls=dialect

Specify the default TLS dialect, for systems were there is a choice.For ARM targets, possible values for dialect are gnu orgnu2, which select between the original GNU dialect and the GNU TLSdescriptor-based dialect.

--enable-multiarch

Specify whether to enable or disable multiarch support. The default isto check for glibc start files in a multiarch location, and enable itif 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 athttps://wiki.debian.org/Multiarch.

--enable-sjlj-exceptions

Force use of the setjmp/longjmp-based scheme for exceptions.‘configure’ ordinarily picks the correct value based on the platform.Only use this option if you are sure you need a different setting.

--enable-vtable-verify

Specify whether to enable or disable the vtable verification feature.Enabling this feature causes libstdc++ to be built with its virtual callsin verifiable mode. This means that, when linked with libvtv, everyvirtual call in libstdc++ will verify the vtable pointer through which thecall 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 itsvirtual calls in verifiable mode at all. However the libvtv library willstill be built (see --disable-libvtv to turn off building libvtv).--disable-vtable-verify is the default.

--disable-gcov

Specify that the run-time library used for coverage analysisand associated host tools should not be built.

--disable-multilib

Specify that multiple targetlibraries to support different target variants, callingconventions, etc. should not be built. The default is to build apredefined 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-list

Specify what multilibs to build. list is a comma separated list ofvalues, possibly consisting of a single value. Currently only implementedfor aarch64*-*-*, arm*-*-*, loongarch64-*-*, riscv*-*-*, sh*-*-* andx86-64-*-linux*. The accepted values and meaning for each target is givenbelow.

aarch64*-*-*

list is a comma separated list of ilp32, and lp64to enable ILP32 and LP64 run-time libraries, respectively. Iflist is empty, then there will be no multilibs and only thedefault run-time library will be built. If list isdefault or –with-multilib-list= is not specified, then thedefault set of libraries is selected based on the value of--target.

arm*-*-*

list is a comma separated list of aprofile andrmprofile to build multilibs for A or R and M architectureprofiles respectively. Note that, due to some limitation of the currentmultilib framework, using the combined aprofile,rmprofilemultilibs selects in some cases a less optimal multilib than when usingthe multilib profile for the architecture targetted. The special valuedefault is also accepted and is equivalent to omitting theoption, i.e., only the default run-time library will be enabled.

list may instead contain @name, to use the multilibconfiguration Makefile fragment name in gcc/config/arm inthe source tree (it is part of the corresponding sources, after all).It is recommended, but not required, that files used for this purpose tobe named starting with t-ml-, to make their intended purposeself-evident, in line with GCC conventions. Such files enable custom,user-chosen multilib lists to be configured. Whether multiple suchfiles can be used together depends on the contents of the suppliedfiles. See gcc/config/arm/t-multilib and its supplementarygcc/config/arm/t-*profile files for an example of what suchMakefile fragments might look like for this version of GCC. The macrosexpected to be defined in these fragments are not stable across GCCreleases, so make sure they define the MULTILIB-related macrosexpected by the version of GCC you are building.See “Target Makefile Fragments” in the internals manual.

The table below gives the combination of ISAs, architectures, FPUs andfloating-point ABIs for which multilibs are built for each predefinedprofile. The union of these options is considered when specifying bothaprofile and rmprofile.

Optionaprofilermprofile
ISAs-marm and -mthumb-mthumb
Architecturesdefault architecture
-march=armv7-a
-march=armv7ve
-march=armv8-a
default architecture
-march=armv6s-m
-march=armv7-m
-march=armv7e-m
-march=armv8-m.base
-march=armv8-m.main
-march=armv7
FPUsnone
-mfpu=vfpv3-d16
-mfpu=neon
-mfpu=vfpv4-d16
-mfpu=neon-vfpv4
-mfpu=neon-fp-armv8
none
-mfpu=vfpv3-d16
-mfpu=fpv4-sp-d16
-mfpu=fpv5-sp-d16
-mfpu=fpv5-d16
floating-point ABIs-mfloat-abi=soft
-mfloat-abi=softfp
-mfloat-abi=hard
-mfloat-abi=soft
-mfloat-abi=softfp
-mfloat-abi=hard
loongarch*-*-*

list is a comma-separated list of the following ABI identifiers:lp64d[/base] lp64f[/base] lp64d[/base], where the/base suffix may be omitted, to enable their respective run-timelibraries. If list is empty or default,or if --with-multilib-list is not specified, then the default ABIas specified by --with-abi or implied by --target is selected.

riscv*-*-*

list is a single ABI name. The target architecture must be eitherrv32gc or rv64gc. This will build a single multilib for thespecified architecture and ABI pair. If --with-multilib-list is notgiven, then a default set of multilibs is selected based on the value of--target. This is usually a large set of multilibs.

sh*-*-*

list is a comma separated list of CPU names. These must be of theform sh* or m* (in which case they match the compiler optionfor that processor). The list should not contain any endian options -these are handled by --with-endian.

If list is empty, then there will be no multilibs for extraprocessors. The multilib for the secondary endian remains enabled.

As a special case, if an entry in the list starts with a !(exclamation point), then it is added to the list of excluded multilibs.Entries of this sort should be compatible with ‘MULTILIB_EXCLUDES’(once the leading ! has been stripped).

If --with-multilib-list is not given, then a default set ofmultilibs is selected based on the value of --target. This isusually the complete set of libraries, but some targets imply a morespecialized subset.

Example 1: to configure a compiler for SH4A only, but supporting bothendians, with little endian being the default:

--with-cpu=sh4a --with-endian=little,big --with-multilib-list=

Example 2: to configure a compiler for both SH4A and SH4AL-DSP, but withonly little endian SH4AL:

--with-cpu=sh4a --with-endian=little,big \--with-multilib-list=sh4al,!mb/m4al
x86-64-*-linux*

list is a comma separated list of m32, m64 andmx32 to enable 32-bit, 64-bit and x32 run-time libraries,respectively. If list is empty, then there will be no multilibsand only the default run-time library will be enabled.

If --with-multilib-list is not given, then only 32-bit and64-bit run-time libraries will be enabled.

--with-multilib-generator=config

Specify what multilibs to build. config is a semicolon separated list ofvalues, possibly consisting of a single value. Currently only implementedfor riscv*-*-elf*. The accepted values and meanings are given below.

Every config is constructed with four components: architecture string, ABI,reuse rule with architecture string and reuse rule with sub-extension.

Example 1: Add multi-lib suppport for rv32i with ilp32.

rv32i-ilp32--

Example 2: Add multi-lib suppport for rv32i with ilp32 and rv32imafd with ilp32.

rv32i-ilp32--;rv32imafd-ilp32--

Example 3: Add multi-lib suppport for rv32i with ilp32; rv32im with ilp32 andrv32ic with ilp32 will reuse this multi-lib set.

rv32i-ilp32-rv32im-c

Example 4: Add multi-lib suppport for rv64ima with lp64; rv64imaf with lp64,rv64imac with lp64 and rv64imafc with lp64 will reuse this multi-lib set.

rv64ima-lp64--f,c,fc

--with-multilib-generator have an optional configuration argument--cmodel=val for code model, this option will expand with otherconfig options, val is a comma separated list of possible code model,currently we support medlow and medany.

Example 5: Add multi-lib suppport for rv64ima with lp64; rv64ima with lp64 andmedlow code model

rv64ima-lp64--;--cmodel=medlow

Example 6: Add multi-lib suppport for rv64ima with lp64; rv64ima with lp64 andmedlow code model; rv64ima with lp64 and medany code model

rv64ima-lp64--;--cmodel=medlow,medany
--with-endian=endians

Specify what endians to use.Currently only implemented for sh*-*-*.

(Video) Building GCC-9.1.0 from Source

endians may be one of the following:

big

Use big endian exclusively.

little

Use little endian exclusively.

big,little

Use big endian by default. Provide a multilib for little endian.

little,big

Use little endian by default. Provide a multilib for big endian.

--enable-threads

Specify that the targetsupports threads. This affects the Objective-C compiler and runtimelibrary, 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) threadingmodel available will be configured for use. Beware that on somesystems, GCC has not been taught what threading models are generallyavailable for the system. In this case, --enable-threads is analias for --enable-threads=single.

--disable-threads

Specify that threading support should be disabled for the system.This is an alias for --enable-threads=single.

--enable-threads=lib

Specify thatlib is the thread support library. This affects the Objective-Ccompiler and runtime library, and exception handling for other languageslike C++. The possibilities for lib are:

aix

AIX thread support.

dce

DCE thread support.

lynx

LynxOS thread support.

mipssde

MIPS SDE thread support.

no

This is an alias for ‘single’.

posix

Generic POSIX/Unix98 thread support.

rtems

RTEMS thread support.

single

Disable thread support, should work for all platforms.

tpf

TPF thread support.

vxworks

VxWorks thread support.

win32

Microsoft Win32 API thread support.

--enable-tls

Specify that the target supports TLS (Thread Local Storage). Usuallyconfigure can correctly determine if TLS is supported. In cases whereit guesses incorrectly, TLS can be explicitly enabled or disabled with--enable-tls or --disable-tls. This can happen ifthe assembler supports TLS but the C library does not, or if theassumptions made by the configure test are incorrect.

--disable-tls

Specify that the target does not support TLS.This is an alias for --enable-tls=no.

--disable-tm-clone-registry

Disable TM clone registry in libgcc. It is enabled in libgcc by default.This option helps to reduce code size for embedded targets which donot use transactional memory.

--with-cpu=cpu
--with-cpu-32=cpu
--with-cpu-64=cpu

Specify which cpu variant the compiler should generate code for by default.cpu will be used as the default value of the -mcpu= switch.This option is only supported on some targets, including ARC, ARM, i386, M68k,PowerPC, and SPARC. It is mandatory for ARC. The --with-cpu-32 and--with-cpu-64 options specify separate default CPUs for32-bit and 64-bit modes; these options are only supported for aarch64, i386,x86-64, PowerPC, and SPARC.

--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

These 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 valuesof the arguments depend on the target.

--with-mode=mode

Specify if the compiler should default to -marm or -mthumb.This option is only supported on ARM targets.

--with-stack-offset=num

This option sets the default for the -mstack-offset=num option,and will thus generally also control the setting of this option forlibraries. This option is only supported on Epiphany targets.

--with-fpmath=isa

This options sets -mfpmath=sse by default and specifies the defaultISA for floating-point arithmetics. You can select either ‘sse’ whichenables -msse2 or ‘avx’ which enables -mavx by default.This option is only supported on i386 and x86-64 targets.

--with-fp-32=mode

On MIPS targets, set the default value for the -mfp option when usingthe o32 ABI. The possibilities for mode are:

32

Use the o32 FP32 ABI extension, as with the -mfp32 command-lineoption.

xx

Use the o32 FPXX ABI extension, as with the -mfpxx command-lineoption.

64

Use the o32 FP64 ABI extension, as with the -mfp64 command-lineoption.

In the absence of this configuration option the default is to use the o32FP32 ABI extension.

--with-odd-spreg-32

On MIPS targets, set the -modd-spreg option by default when usingthe o32 ABI.

--without-odd-spreg-32

On MIPS targets, set the -mno-odd-spreg option by default when usingthe o32 ABI. This is normally used in conjunction with--with-fp-32=64 in order to target the o32 FP64A ABI extension.

--with-nan=encoding

On MIPS targets, set the default encoding convention to use for thespecial not-a-number (NaN) IEEE 754 floating-point data. Thepossibilities for encoding are:

legacy

Use the legacy encoding, as with the -mnan=legacy command-lineoption.

2008

Use the 754-2008 encoding, as with the -mnan=2008 command-lineoption.

To use this configuration option you must have an assembler versioninstalled that supports the -mnan= command-line option too.In the absence of this configuration option the default convention isthe legacy encoding, as when neither of the -mnan=2008 and-mnan=legacy command-line options has been used.

--with-divide=type

Specify how the compiler should generate code for checking fordivision by zero. This option is only supported on the MIPS target.The possibilities for type are:

traps

Division by zero checks use conditional traps (this is the default onsystems that support conditional traps).

breaks

Division by zero checks use the break instruction.

--with-llsc

On MIPS targets, make -mllsc the default when no-mno-llsc option is passed. This is the default forLinux-based targets, as the kernel will emulate them if the ISA doesnot provide them.

--without-llsc

On MIPS targets, make -mno-llsc the default when no-mllsc option is passed.

--with-synci

On MIPS targets, make -msynci the default when no-mno-synci option is passed.

--without-synci

On MIPS targets, make -mno-synci the default when no-msynci option is passed. This is the default.

--with-lxc1-sxc1

On MIPS targets, make -mlxc1-sxc1 the default when no-mno-lxc1-sxc1 option is passed. This is the default.

--without-lxc1-sxc1

On MIPS targets, make -mno-lxc1-sxc1 the default when no-mlxc1-sxc1 option is passed. The indexed load/storeinstructions are not directly a problem but can lead to unexpectedbehaviour when deployed in an application intended for a 32-bit addressspace but run on a 64-bit processor. The issue is seen because allknown MIPS 64-bit Linux kernels execute o32 and n32 applicationswith 64-bit addressing enabled which affects the overflow behaviourof the indexed addressing mode. GCC will assume that ordinary32-bit arithmetic overflow behaviour is the same whether performedas an addu instruction or as part of the address calculationin lwxc1 type instructions. This assumption holds true in apure 32-bit environment and can hold true in a 64-bit environment ifthe address space is accurately set to be 32-bit for o32 and n32.

--with-madd4

On MIPS targets, make -mmadd4 the default when no-mno-madd4 option is passed. This is the default.

--without-madd4

On MIPS targets, make -mno-madd4 the default when no-mmadd4 option is passed. The madd4 instructionfamily can be problematic when targeting a combination of cores thatimplement these instructions differently. There are two known coresthat implement these as fused operations instead of unfused (whereunfused is normally expected). Disabling these instructions is theonly way to ensure compatible code is generated; this will incura performance penalty.

--with-mips-plt

On MIPS targets, make use of copy relocations and PLTs.These features are extensions to the traditionalSVR4-based MIPS ABIs and require support from GNU binutilsand the runtime C library.

--with-stack-clash-protection-guard-size=size

On certain targets this option sets the default stack clash protection guardsize as a power of two in bytes. On AArch64 size is required to be either12 (4KB) or 16 (64KB).

--with-isa-spec=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 ISA-spec-string are:

2.2

Produce code conforming to version 2.2.

20190608

Produce code conforming to version 20190608.

20191213

Produce code conforming to version 20191213.

(Video) [Environment Setup 8] Compile programs from source code using GCC, GNU Make, and CMake

In the absence of this configuration option the default version is 20191213.

--enable-__cxa_atexit

Define if you want to use __cxa_atexit, rather than atexit, toregister C++ destructors for local statics and global objects.This is essential for fully standards-compliant handling ofdestructors, but requires __cxa_atexit in libc. This option is currentlyonly available on systems with GNU libc. When enabled, this will cause-fuse-cxa-atexit to be passed by default.

--enable-gnu-indirect-function

Define if you want to enable the ifunc attribute. This option iscurrently only available on systems with GNU libc on certain targets.

--enable-target-optspace

Specify that targetlibraries should be optimized for code space instead of code speed.This is the default for the m32r platform.

--with-cpp-install-dir=dirname

Specify that the user visible cpp program should be installedin prefix/dirname/cpp, in addition to bindir.

--enable-comdat

Enable COMDAT group support. This is primarily used to override theautomatically detected value.

--enable-initfini-array

Force the use of sections .init_array and .fini_array(instead of .init and .fini) for constructors anddestructors. Option --disable-initfini-array has theopposite effect. If neither option is specified, the configure scriptwill try to guess whether the .init_array and.fini_array sections are supported and, if they are, use them.

--enable-link-mutex

When building GCC, use a mutex to avoid linking the compilers formultiple languages at the same time, to avoid thrashing on buildsystems with limited free memory. The default is not to use such a mutex.

--enable-link-serialization

When building GCC, use make dependencies to serialize linking the compilers formultiple languages, to avoid thrashing on buildsystems with limited free memory. The default is not to add suchdependencies and thus with parallel make potentially link differentcompilers concurrently. If the argument is a positive integer, allowthat number of concurrent link processes for the large binaries.

--enable-maintainer-mode

The build rules that regenerate the Autoconf and Automake output files aswell as the GCC master message catalog gcc.pot are normallydisabled. This is because it can only be rebuilt if the complete sourcetree is present. If you have changed the sources and want to rebuild thecatalog, configuring with --enable-maintainer-mode will enablethis. Note that you need a recent version of the gettext toolsto do so.

--disable-bootstrap

For a native build, the default configuration is to performa 3-stage bootstrap of the compiler when ‘make’ is invoked,testing that GCC can compile itself correctly. If you want to disablethis process, you can configure with --disable-bootstrap.

--enable-bootstrap

In special cases, you may want to perform a 3-stage buildeven if the target and host triplets are different.This is possible when the host can run code compiled forthe target (e.g. host is i686-linux, target is i486-linux).Starting from GCC 4.2, to do this you have to configure explicitlywith --enable-bootstrap.

--enable-generated-files-in-srcdir

Neither the .c and .h files that are generated from Bison and flex nor theinfo manuals and man pages that are built from the .texi files are presentin the repository development tree. When building GCC from that development tree,or from one of our snapshots, those generated files are placed in yourbuild directory, which allows for the source to be in a readonlydirectory.

If you configure with --enable-generated-files-in-srcdir then thosegenerated files will go into the source directory. This is mainly intendedfor generating release or prerelease tarballs of the GCC sources, since itis not a requirement that the users of source releases to have flex, Bison,or makeinfo.

--enable-version-specific-runtime-libs

Specifythat runtime libraries should be installed in the compiler specificsubdirectory (libdir/gcc) rather than the usual places. Inaddition, ‘libstdc++’’s include files will be installed intolibdir unless you overruled it by using--with-gxx-include-dir=dirname. Using this option isparticularly useful if you intend to use several versions of GCC inparallel. The default is ‘yes’ for ‘libada’, and ‘no’ forthe remaining libraries.

--with-aix-soname=‘aix’, ‘svr4’ or ‘both

Traditional AIX shared library versioning (versioned Shared Objectfiles as members of unversioned Archive Library files named‘lib.a’) causes numerous headaches for package managers. However,Import Files as members of Archive Library files allow forfilename-based versioning of shared libraries as seen on Linux/SVR4,where this is called the "SONAME". But as they prevent static linking,Import Files may be used with Runtime Linking only, where thelinker does search for ‘libNAME.so’ before ‘libNAME.a’ libraryfilenames with the ‘-lNAME’ linker flag.

For detailed information please refer to the AIXldCommand reference.

As long as shared library creation is enabled, upon:

--with-aix-soname=aix
--with-aix-soname=both

A (traditional AIX) Shared Archive Library file is created:

  • using the ‘libNAME.a’ filename scheme
  • with the Shared Object file as archive member named ‘libNAME.so.V’ (except for ‘libgcc_s’, where the Shared Object file is named ‘shr.o’ for backwards compatibility), which
    • - is used for runtime loading from inside the ‘libNAME.a’ file
    • - is used for dynamic loading via dlopen("libNAME.a(libNAME.so.V)", RTLD_MEMBER)
    • - is used for shared linking
    • - is used for static linking, so no separate Static Archive Library file is needed
--with-aix-soname=both
--with-aix-soname=svr4

A (second) Shared Archive Library file is created:

  • using the ‘libNAME.so.V’ filename scheme
  • with the Shared Object file as archive member named ‘shr.o’, which
    • - is created with the -G linker flag
    • - has the F_LOADONLY flag set
    • - is used for runtime loading from inside the ‘libNAME.so.V’ file
    • - is used for dynamic loading via dlopen("libNAME.so.V(shr.o)", RTLD_MEMBER)
  • with the Import File as archive member named ‘shr.imp’, which
    • - refers to ‘libNAME.so.V(shr.o)’ as the "SONAME", to be recorded in the Loader Section of subsequent binaries
    • - indicates whether ‘libNAME.so.V(shr.o)’ is 32 or 64 bit
    • - lists all the public symbols exported by ‘lib.so.V(shr.o)’, eventually decorated with the weak’ Keyword
    • - is necessary for shared linking against ‘lib.so.V(shr.o)

A symbolic link using the ‘libNAME.so’ filename scheme is created:

  • pointing to the ‘libNAME.so.VShared Archive Library file
  • to permit the ld Command to find ‘lib.so.V(shr.imp)’ via the ‘-lNAME’ argument (requires Runtime Linking to be enabled)
  • to permit dynamic loading of ‘lib.so.V(shr.o)’ without the need to specify the version number via dlopen("libNAME.so(shr.o)", RTLD_MEMBER)

As long as static library creation is enabled, upon:

--with-aix-soname=svr4

A Static Archive Library is created:

  • using the ‘libNAME.a’ filename scheme
  • with all the Static Object files as archive members, which
    • - are used for static linking

While the aix-soname=‘svr4’ option does not create Shared Objectfiles as members of unversioned Archive Library files any more, packagemanagers still are responsible totransfer Shared Object filesfound as member of a previously installed unversioned Archive Libraryfile into the newly installed Archive Library file with the samefilename.

WARNING: Creating Shared Object files with Runtime Linkingenabled may bloat the TOC, eventually leading to TOC overflow errors,requiring the use of either the -Wl,-bbigtoc linker flag (seen tobreak with the GDB debugger) or some of the TOC-related compiler flags,see “RS/6000 and PowerPC Options” in the main manual.

--with-aix-soname is currently supported by ‘libgcc_s’ only, sothis option is still experimental and not for normal use yet.

Default is the traditional behavior --with-aix-soname=‘aix.

--enable-languages=lang1,lang2,…

Specify that only a particular subset of compilers andtheir runtime libraries should be built. For a list of valid values forlangN you can issue the following command in thegcc directory of your GCC source tree:

grep ^language= */config-lang.in

Currently, you can use any of the following:all, default, ada, c, c++, d,fortran, go, jit, lto, 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 thedefault languages available in the gcc sub-tree will be configured.Ada, D, Go, Jit, and Objective-C++ are not default languages. LTO is not adefault language, but is built by default because --enable-lto isenabled by default. The other languages are default languages. Ifall is specified, then all available languages are built. Anexception is jit language, which requires--enable-host-shared to be included with all.

--enable-stage1-languages=lang1,lang2,…

Specify that a particular subset of compilers and their runtimelibraries should be built with the system C compiler during stage 1 ofthe bootstrap process, rather than only in later stages with thebootstrapped C compiler. The list of valid values is the same as for--enable-languages, and the option all will select allof the languages enabled by --enable-languages. This option isprimarily useful for GCC development; for instance, when a developmentversion of the compiler cannot bootstrap due to compiler bugs, or whenone is debugging front ends other than the C front end. When thisoption is used, one can then build the target libraries for thespecified languages with the stage-1 compiler by using makestage1-bubble all-target, or run the testsuite on the stage-1 compilerfor the specified languages using make stage1-start check-gcc.

--disable-libada

Specify that the run-time libraries and tools used by GNAT should notbe built. This can be useful for debugging, or for compatibility withprevious Ada build procedures, when it was required to explicitlydo a ‘make -C gcc gnatlib_and_tools’.

--disable-libsanitizer

Specify that the run-time libraries for the various sanitizers shouldnot be built.

--disable-libssp

Specify that the run-time libraries for stack smashing protectionshould not be built or linked against. On many targets library supportis provided by the C library instead.

--disable-libquadmath

Specify that the GCC quad-precision math library should not be built.On some systems, the library is required to be linkable when buildingthe Fortran front end, unless --disable-libquadmath-supportis used.

--disable-libquadmath-support

Specify that the Fortran front end and libgfortran do not addsupport for libquadmath on systems supporting it.

--disable-libgomp

Specify that the GNU Offloading and Multi Processing Runtime Libraryshould not be built.

--disable-libvtv

Specify that the run-time libraries used by vtable verificationshould not be built.

--with-dwarf2

Specify that the compiler shoulduse DWARF 2 debugging information as the default.

--with-advance-toolchain=at

On 64-bit PowerPC Linux systems, configure the compiler to use theheader files, library files, and the dynamic linker from the AdvanceToolchain release at instead of the default versions that areprovided by the Linux distribution. In general, this option isintended for the developers of GCC, and it is not intended for generaluse.

--enable-targets=all
--enable-targets=target_list

Some GCC targets, e.g. powerpc64-linux, build bi-arch compilers.These are compilers that are able to generate either 64-bit or 32-bitcode. Typically, the corresponding 32-bit target, e.g.powerpc-linux for powerpc64-linux, only generates 32-bit code. Thisoption enables the 32-bit target to be a bi-arch compiler, which isuseful when you want a bi-arch compiler that defaults to 32-bit, andyou 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-pie

Turn on -fPIE and -pie by default.

--enable-secureplt

This option enables -msecure-plt by default for powerpc-linux.See “RS/6000 and PowerPC Options” in the main manual

--enable-default-ssp

Turn on -fstack-protector-strong by default.

--enable-cld

This option enables -mcld by default for 32-bit x86 targets.See “i386 and x86-64 Options” in the main manual

--enable-large-address-aware

The --enable-large-address-aware option arranges for MinGWexecutables to be linked using the --large-address-awareoption, that enables the use of more than 2GB of memory. If GCC isconfigured with this option, its effects can be reversed by passing the-Wl,--disable-large-address-aware option to the so-configuredcompiler driver.

--enable-win32-registry
--enable-win32-registry=key
--disable-win32-registry

The --enable-win32-registry option enables Microsoft Windows-hosted GCCto 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 distributorswho use custom installers are encouraged to provide a different key,perhaps one comprised of vendor name and GCC version number, toavoid conflict with existing installations. This feature is enabledby default, and can be disabled by --disable-win32-registryoption. This option has no effect on the other hosts.

--nfp

Specify that the machine does not have a floating point unit. Thisoption only applies to ‘m68k-sun-sunosn’. On any othersystem, --nfp has no effect.

--enable-werror
--disable-werror
--enable-werror=yes
--enable-werror=no

When you specify this option, it controls whether certain files in thecompiler are built with -Werror in bootstrap stage2 and later.If you don’t specify it, -Werror is turned on for the maindevelopment trunk. However it defaults to off for release branches andfinal releases. The specific files which get -Werror arecontrolled by the Makefiles.

--enable-checking
--disable-checking
--enable-checking=list

This option controls performing internal consistency checks in the compiler.It does not change the generated code, but adds error checking of therequested complexity. This slows down the compiler and may only workproperly if you are building the compiler with GCC.

When the option is not specified, the active set of checks depends on context.Namely, bootstrap stage 1 defaults to ‘--enable-checking=yes’, buildsfrom release branches or release archives default to‘--enable-checking=release’, and otherwise‘--enable-checking=yes,extra’ is used. When the option isspecified without a list, the result is the same as‘--enable-checking=yes’. Likewise, ‘--disable-checking’ isequivalent to ‘--enable-checking=no’.

The categories of checks available in list are ‘yes’ (most commonchecks ‘assert,misc,gc,gimple,rtlflag,runtime,tree,types’), ‘no’(no checks at all), ‘all’ (all but ‘valgrind’), ‘release’(cheapest checks ‘assert,runtime’) or ‘none’ (same as ‘no’).‘release’ checks are always on and to disable them‘--disable-checking’ or ‘--enable-checking=no[,<other checks>]’must be explicitly requested. Disabling assertions makes the compiler andruntime slightly faster but increases the risk of undetected internal errorscausing wrong code to be generated.

Individual checks can be enabled with these flags: ‘assert’, ‘df’,‘extra’, ‘fold’, ‘gc’, ‘gcac’, ‘gimple’,‘misc’, ‘rtl’, ‘rtlflag’, ‘runtime’, ‘tree’,‘types’ and ‘valgrind’. ‘extra’ extends ‘misc’checking with extra checks that might affect code generation and shouldtherefore not differ between stage1 and later stages in bootstrap.

The ‘valgrind’ check requires the external valgrind simulator,available from https://valgrind.org. The ‘rtl’ checks areexpensive and the ‘df’, ‘gcac’ and ‘valgrind’ checks are veryexpensive.

(Video) How to Install MinGW (GCC/G++) Compiler in Windows 10

--disable-stage1-checking
--enable-stage1-checking
--enable-stage1-checking=list

This option affects only bootstrap build. If no --enable-checkingoption is specified the stage1 compiler is built with ‘yes’ checkingenabled, otherwise the stage1 checking flags are the same as specified by--enable-checking. To build the stage1 compiler withdifferent checking options use --enable-stage1-checking.The list of checking options is the same as for --enable-checking.If your system is too slow or too small to bootstrap a released compilerwith checking for stage1 enabled, you can use ‘--disable-stage1-checking’to disable checking for the stage1 compiler.

--enable-coverage
--enable-coverage=level

With this option, the compiler is built to collect self coverageinformation, every time it is run. This is for internal developmentpurposes, and only works when the compiler is being built with gcc. Thelevel argument controls whether the compiler is built optimized ornot, values are ‘opt’ and ‘noopt’. For coverage analysis youwant to disable optimization, for performance analysis you want toenable optimization. When coverage is enabled, the default level iswithout optimization.

--enable-gather-detailed-mem-stats

When this option is specified more detailed information on memoryallocation is gathered. This information is printed when using-fmem-report.

--enable-valgrind-annotations

Mark selected memory related operations in the compiler when run undervalgrind to suppress false positives.

--enable-nls
--disable-nls

The --enable-nls option enables Native Language Support (NLS),which lets GCC output diagnostics in languages other than AmericanEnglish. Native Language Support is enabled by default if not doing acanadian cross build. The --disable-nls option disables NLS.

--with-included-gettext

If NLS is enabled, the --with-included-gettext option causes the buildprocedure to prefer its copy of GNU gettext.

--with-catgets

If NLS is enabled, and if the host lacks gettext but has theinferior catgets interface, the GCC build procedure normallyignores catgets and instead uses GCC’s copy of the GNUgettext library. The --with-catgets option causes thebuild procedure to use the host’s catgets in this situation.

--with-libiconv-prefix=dir

Search for libiconv header files in dir/include andlibiconv library files in dir/lib.

--enable-obsolete

Enable configuration for an obsoleted system. If you attempt toconfigure GCC for a system (build, host, or target) which has beenobsoleted, and you do not specify this flag, configure will halt with anerror message.

All support for systems which have been obsoleted in one release of GCCis removed entirely in the next major release, unless someone stepsforward to maintain the port.

--enable-decimal-float
--enable-decimal-float=yes
--enable-decimal-float=no
--enable-decimal-float=bid
--enable-decimal-float=dpd
--disable-decimal-float

Enable (or disable) support for the C decimal floating point extensionthat is in the IEEE 754-2008 standard. This is enabled by default onlyon PowerPC, i386, and x86_64 GNU/Linux systems. Other systems may alsosupport it, but require the user to specifically enable it. You canoptionally control which decimal floating point format is used (either‘bid’ or ‘dpd’). The ‘bid’ (binary integer decimal)format is default on i386 and x86_64 systems, and the ‘dpd’(densely packed decimal) format is default on PowerPC systems.

--enable-fixed-point
--disable-fixed-point

Enable (or disable) support for C fixed-point arithmetic.This option is enabled by default for some targets (such as MIPS) whichhave hardware-support for fixed-point operations. On other targets, youmay enable this option manually.

--with-long-double-128

Specify if long double type should be 128-bit by default on selectedGNU/Linux architectures. If using --without-long-double-128,long double will be by default 64-bit, the same as double type.When neither of these configure options are used, the default will be128-bit long double when built against GNU C Library 2.4 and later,64-bit long double otherwise.

--with-long-double-format=ibm
--with-long-double-format=ieee

Specify whether long double uses the IBM extended double formator the IEEE 128-bit floating point format on PowerPC Linux systems.This configuration switch will only work on little endian PowerPCLinux systems and on big endian 64-bit systems where the default cpuis at least power7 (i.e. --with-cpu=power7,--with-cpu=power8, or --with-cpu=power9 is used).

If you use the --with-long-double-64 configuration option,the --with-long-double-format=ibm and--with-long-double-format=ieee options are ignored.

The default long double format is to use IBM extended double.Until all of the libraries are converted to use IEEE 128-bit floatingpoint, it is not recommended to use--with-long-double-format=ieee.

--enable-fdpic

On SH Linux systems, generate ELF FDPIC code.

--with-gmp=pathname
--with-gmp-include=pathname
--with-gmp-lib=pathname
--with-mpfr=pathname
--with-mpfr-include=pathname
--with-mpfr-lib=pathname
--with-mpc=pathname
--with-mpc-include=pathname
--with-mpc-lib=pathname

If you want to build GCC but do not have the GMP library, the MPFRlibrary and/or the MPC library installed in a standard location anddo not have their sources present in the GCC source tree then youcan explicitly specify the directory where they are installed(‘--with-gmp=gmpinstalldir’,‘--with-mpfr=mpfrinstalldir’,‘--with-mpc=mpcinstalldir’). The--with-gmp=gmpinstalldir option is shorthand for--with-gmp-lib=gmpinstalldir/lib and--with-gmp-include=gmpinstalldir/include. Likewise the--with-mpfr=mpfrinstalldir option is shorthand for--with-mpfr-lib=mpfrinstalldir/lib and--with-mpfr-include=mpfrinstalldir/include, also the--with-mpc=mpcinstalldir option is shorthand for--with-mpc-lib=mpcinstalldir/lib and--with-mpc-include=mpcinstalldir/include. If theseshorthand assumptions are not correct, you can use the explicitinclude and lib options directly. You might also need to ensure theshared libraries can be found by the dynamic linker when building andusing GCC, for example by setting the runtime shared library pathvariable (LD_LIBRARY_PATH on GNU/Linux and Solaris systems).

These flags are applicable to the host platform only. When buildinga cross compiler, they will not be used to configure target libraries.

--with-isl=pathname
--with-isl-include=pathname
--with-isl-lib=pathname

If you do not have the isl library installed in a standard location and youwant to build GCC, you can explicitly specify the directory where it isinstalled (‘--with-isl=islinstalldir’). The--with-isl=islinstalldir option is shorthand for--with-isl-lib=islinstalldir/lib and--with-isl-include=islinstalldir/include. If thisshorthand assumption is not correct, you can use the explicitinclude and lib options directly.

These flags are applicable to the host platform only. When buildinga cross compiler, they will not be used to configure target libraries.

--with-stage1-ldflags=flags

This option may be used to set linker flags to be used when linkingstage 1 of GCC. These are also used when linking GCC if configured with--disable-bootstrap. If --with-stage1-libs is not set to avalue, then the default is ‘-static-libstdc++ -static-libgcc’, ifsupported.

--with-stage1-libs=libs

This option may be used to set libraries to be used when linking stage 1of GCC. These are also used when linking GCC if configured with--disable-bootstrap.

--with-boot-ldflags=flags

This option may be used to set linker flags to be used when linkingstage 2 and later when bootstrapping GCC. If –with-boot-libsis not is set to a value, then the default is‘-static-libstdc++ -static-libgcc’.

--with-boot-libs=libs

This option may be used to set libraries to be used when linking stage 2and later when bootstrapping GCC.

--with-debug-prefix-map=map

Convert source directory names using -fdebug-prefix-map whenbuilding runtime libraries. ‘map’ is a space-separatedlist of maps of the form ‘old=new’.

--enable-linker-build-id

Tells GCC to pass --build-id option to the linker for all finallinks (links performed without the -r or --relocatableoption), if the linker supports it. If you specify--enable-linker-build-id, but your linker does notsupport --build-id option, a warning is issued and the--enable-linker-build-id option is ignored. The default is off.

--with-linker-hash-style=choice

Tells GCC to pass --hash-style=choice option to thelinker for all final links. choice can be one of‘sysv’, ‘gnu’, and ‘both’ where ‘sysv’ is the default.

--enable-gnu-unique-object
--disable-gnu-unique-object

Tells GCC to use the gnu_unique_object relocation for C++ templatestatic data members and inline function local statics. Enabled bydefault for a toolchain with an assembler that accepts it andGLIBC 2.11 or above, otherwise disabled.

--with-diagnostics-color=choice

Tells GCC to use choice as the default for -fdiagnostics-color=option (if not used explicitly on the command line). choicecan 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_COLORSis present and non-empty in the environment of the compiler, and-fdiagnostics-color=never otherwise.

--with-diagnostics-urls=choice

Tells GCC to use choice as the default for -fdiagnostics-urls=option (if not used explicitly on the command line). choicecan 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_URLSor TERM_URLS is present and non-empty in the environment of thecompiler, and -fdiagnostics-urls=never otherwise.

--enable-lto
--disable-lto

Enable support for link-time optimization (LTO). This is enabled bydefault, and may be disabled using --disable-lto.

--enable-linker-plugin-configure-flags=FLAGS
--enable-linker-plugin-flags=FLAGS

By default, linker plugins (such as the LTO plugin) are built for thehost system architecture. For the case that the linker has adifferent (but run-time compatible) architecture, these flags can bespecified to build plugins that are compatible to the linker. Forexample, if you are building GCC for a 64-bit x86_64(‘x86_64-pc-linux-gnu’) host system, but have a 32-bit x86GNU/Linux (‘i686-pc-linux-gnu’) linker executable (which isexecutable on the former system), you can configure GCC as follows forgetting compatible linker plugins:

% srcdir/configure \ --host=x86_64-pc-linux-gnu \ --enable-linker-plugin-configure-flags=--host=i686-pc-linux-gnu \ --enable-linker-plugin-flags='CC=gcc\ -m32\ -Wl,-rpath,[...]/i686-pc-linux-gnu/lib'
--with-plugin-ld=pathname

Enable an alternate linker to be used at link-time optimization (LTO)link time when -fuse-linker-plugin is enabled.This linker should have plugin support such as gold starting withversion 2.20 or GNU ld starting with version 2.21.See -fuse-linker-plugin for details.

--enable-canonical-system-headers
--disable-canonical-system-headers

Enable system header path canonicalization for libcpp. This canproduce shorter header file paths in diagnostics and dependency outputfiles, but these changed header paths may conflict with some compilationenvironments. Enabled by default, and may be disabled using--disable-canonical-system-headers.

--with-glibc-version=major.minor

Tell GCC that when the GNU C Library (glibc) is used on the target itwill be version major.minor or later. Normally this canbe detected from the C library’s header files, but this option may beneeded when bootstrapping a cross toolchain without the header filesavailable for building the initial bootstrap compiler.

If GCC is configured with some multilibs that use glibc and some thatdo not, this option applies only to the multilibs that use glibc.However, such configurations may not work well as not all the relevantconfiguration in GCC is on a per-multilib basis.

--enable-as-accelerator-for=target

Build as offload target compiler. Specify offload host triple by target.

--enable-offload-targets=target1[=path1],…,targetN[=pathN]

Enable offloading to targets target1, …, targetN.Offload compilers are expected to be already installed. Default searchpath for them is exec-prefix, but it can be changed byspecifying paths path1, …, pathN.

% srcdir/configure \ --enable-offload-targets=x86_64-intelmicemul-linux-gnu=/path/to/x86_64/compiler,nvptx-none
--enable-offload-defaulted

Tell GCC that configured but not installed offload compilers and libgompplugins are silently ignored. Useful for distribution compilers wherethose are in separate optional packages and where the presence or absenceof those optional packages should determine the actual supported offloadingtarget set rather than the GCC configure-time selection.

--enable-cet
--disable-cet

Enable building target run-time libraries with control-flowinstrumentation, see -fcf-protection option. When--enable-cet is specified target libraries are configuredto add -fcf-protection and, if needed, other targetspecific options to a set of building options.

--enable-cet=auto is default. CET is enabled on Linux/x86 iftarget binutils supports Intel CET instructions and disabledotherwise. In this case, the target libraries are configured to getadditional -fcf-protection option.

--with-riscv-attribute=‘yes’, ‘no’ or ‘default

Generate RISC-V attribute by default, in order to record extra buildinformation in object.

The option is disabled by default. It is enabled on RISC-V/ELF (bare-metal)target if target binutils supported.

--enable-s390-excess-float-precision
--disable-s390-excess-float-precision

On s390(x) targets, enable treatment of float expressions with double precisionwhen in standards-compliant mode (e.g., when --std=c99 or-fexcess-precision=standard are given).

For a native build and cross compiles that have target headers, the option’sdefault 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 isdisabled.

--with-zstd=pathname
--with-zstd-include=pathname
--with-zstd-lib=pathname

If you do not have the zstd library installed in a standardlocation and you want to build GCC, you can explicitly specify thedirectory 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 thisshorthand assumption is not correct, you can use the explicitinclude and lib options directly.

These flags are applicable to the host platform only. When buildinga cross compiler, they will not be used to configure target libraries.

The following options only apply to building cross compilers.

Sometimes, it might be necessary to override the result of someconfigure test, for example in order to ease porting to a newsystem or work around a bug in a test. The toplevel configurescript provides three variables for this:

In order to avoid shell and make quoting issues for complexoverrides, you can pass a setting for CONFIG_SITE and setvariables in the site file.

The following options apply to the build of the Objective-C runtime library.

The following options apply to the build of the D runtime library.

FAQs

How do I download and install GNU GCC compiler? ›

Installing C/GCC Compiler for Windows
  1. Step 1: Search MinGW C Compiler on the Web. ...
  2. Step 2: Download MinGW. ...
  3. Step 3: Locate the MinGW-get-setup.exe File and Start Installation. ...
  4. Step 4: Specify Installation Preferences. ...
  5. Step 5: Download and Set up MinGW Installation Manager. ...
  6. Step 6: Select Packages Required for the Compiler.
Feb 21, 2022

Is GNU same as GCC? ›

The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free software under the GNU General Public License (GNU GPL).

How install GCC manually in Linux? ›

Install GCC the C compiler on Ubuntu 22.04 step by step instructions
  1. Open a command line terminal and install C compiler by installation of the development package build-essential : $ sudo apt update $ sudo apt install build-essential. ...
  2. Check C compiler version to verify a successful installation: $ gcc --version.
Mar 7, 2022

How do I download GNU GCC compiler for C++? ›

Go to http://www.codeblocks.org/downloads and click Binary Release. Choose the installer with GCC Compiler, e.g., codeblocks-17.12mingw-setup.exe which includes MinGW's GNU GCC compiler download and GNU GDB debugger with Code::Blocks source files.

How do I download and install gcc compiler in Windows? ›

Installing GCC on Windows 10 in 2021 Made Easy - YouTube

How do I know if gcc compiler is installed? ›

In the Command Prompt window type “gcc” and hit enter. If the output says something like “gcc: fatal error: no input files”, that is good, and you pass the test.

What does GCC stand for GNU? ›

GCC stands for “GNU Compiler Collection”. GCC is an integrated distribution of compilers for several major programming languages.

What is command of install the GCC? ›

sudo apt install build-essential. command-2. It will take some time to install all the essential packages. Command 3: After the second command it will install GCC on your Linux, to verify it is installed correctly, check the version of the GCC. gcc --version.

Should I use G ++ or GCC? ›

For c++ you should use g++. It's the same compiler (e.g. the GNU compiler collection). GCC or G++ just choose a different front-end with different default options. In a nutshell: if you use g++ the frontend will tell the linker that you may want to link with the C++ standard libraries.

What is GNU in C++? ›

GNU C++ Compiler ( g++ ) is a compiler in Linux which is used to compile C++ programs. It compiles both files with extension . c and . cpp as C++ files. The following is the compiler command to compile C++ program.

Why GCC is not working? ›

If you have not installed gcc compiler and trying to use gcc command then the error message is obvious as the functionality is not available on your computer. If you have not installed gcc compiler, then install MinGW gcc compiler on your development environment.

Where is GCC installed? ›

You need to use the which command to locate c compiler binary called gcc. Usually, it is installed in /usr/bin directory.

How do I run GCC on Linux? ›

Linux
  1. Use the vim editor. Open file using,
  2. vim file. c (file name can be anything but it should end with dot c extension) command. ...
  3. Press i to go to insert mode. Type your program. ...
  4. Press Esc button and then type :wq. It will save the file. ...
  5. gcc file.c. To Run the program: ...
  6. 6. ./ a.out. ...
  7. In file tab click new. ...
  8. In Execute tab,

What is GCC package Linux? ›

The GNU Compiler Collection, commonly known as GCC, is a set of compilers and development tools available for Linux, Windows, various BSDs, and a wide assortment of other operating systems. It includes support primarily for C and C++ and includes Objective-C, Ada, Go, Fortran, and D.

How do I find GCC version in Linux? ›

Installing GCC on Ubuntu
  1. Start by updating the packages list: sudo apt update.
  2. Install the build-essential package by typing: sudo apt install build-essential. ...
  3. To validate that the GCC compiler is successfully installed, use the gcc --version command which prints the GCC version: gcc --version.
Oct 31, 2019

How do I set GCC path in Windows 10? ›

Once Codeblocks is installed, GCC compiler also gets installed with it. However, if we want to execute C programs from command prompt, we have to add its bin directory to the PATH variable. Go to “Control Panel\System and Security\System”, Click “Advance System Settings” and then “Environment Variables”.

Is MinGW and GCC same? ›

MinGW is a compiler system based on the GNU GCC and Binutils projects that compiles and links code to be run on Win32 (Windows) systems. It provides C, C++ and Fortran compilers plus other related tools. 'MinGW' refers to the "Minimalist GNU for Windows" project.

How do I run a GCC compiler? ›

How to Compile C Program in Command Prompt?
  1. Run the command 'gcc -v' to check if you have a compiler installed. ...
  2. Create a c program and store it in your system. ...
  3. Change the working directory to where you have your C program. ...
  4. Example: >cd Desktop. ...
  5. The next step is to compile the program.
Mar 26, 2022

Where is gcc compiler path in windows? ›

Click Start and type cmd in the search field, then press Enter. In the window that appears, enter gcc and press the Enter key again. You should get a response gcc: no input files . This means that Windows could find the gcc program, which is what we want.

What version of gcc do I have installed? ›

So if you ever need to check the version of the GCC C++ compiler that you have installed on your PC, you can do it through the command prompt by typing in the single line, g++ --version, and this will return the result.

Can I use gcc on windows? ›

With the Minimalist GNU for Windows (MinGW) project, you can download and install the GNU Compiler Collection (GCC) along with several other essential GNU components to enable GNU Autotools on your Windows computer.

What is GNU means in Linux? ›

The GNU operating system is a complete free software system, upward-compatible with Unix. GNU stands for “GNU's Not Unix.” It is pronounced as one syllable with a hard g. Richard Stallman made the Initial Announcement of the GNU Project in September 1983.

What does GNU mean? ›

What is GNU in computer? ›

GNU/Linux is a Unix-like operating system made up of different OS components and services that create the Linux OS. GNU stands for GNU's not Unix, which makes the term a recursive acronym, or an acronym in which one of the letters stands for the acronym itself.

Why do we use in GCC? ›

It 'translates' the programming languages to machine language. Or to put it in another way, it converts our source code to executable instruction file for computers. GCC stands for “GNU Compiler Collection”. GCC is an integrated distribution of compilers for several major programming languages.

How do I install GCC on Windows 11? ›

How to Install MinGW (GCC/G++) Compiler in Windows 11 - YouTube

Is G ++ a GCC? ›

Difference between gcc and g++

Both are the compilers in Linux to compile and run C and C++ programs. Initially gcc was the GNU C Compiler but now a day's GCC (GNU Compiler Collections) provides many compilers, two are: gcc and g++. gcc is used to compile C program while g++ is used to compile C++ program.

Why is GCC written in C++? ›

It's nearly a superset of C90, which GCC was then written in. The C subset of C++ is as efficient as C. C++ "supports cleaner code in several significant cases." It never requires "uglier" code. C++ makes it harder to break interface boundaries, which leads to cleaner interfaces.

Which C++ compiler should I use? ›

Microsoft C++ Compiler (MSVC)

This is the default compiler for most Visual Studio C++ projects and is recommended if you are targeting Windows. Compiler options for the Microsoft C++ compiler.

What is option in GCC? ›

When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker. Then the output consists of object files output by the assembler.

Does GCC work for C++? ›

GCC, formerly for "GNU C Compiler", has grown over times to support many languages such as C ( gcc ), C++ ( g++ ), Objective-C, Objective-C++, Java ( gcj ), Fortran ( gfortran ), Ada ( gnat ), Go ( gccgo ), OpenMP, Cilk Plus, and OpenAcc. It is now referred to as "GNU Compiler Collection".

How do I install g ++ on Windows? ›

Installing c++/g++ on Windows
  1. Pick the drive and a folder in which you want to install g++. ...
  2. Download full.exe, an about 14 megabyte executable, to C:\full.exe by right-clicking on the link. ...
  3. Run the downloaded executable. ...
  4. Locate where the bin folder was created for the g++ installation. ...
  5. Restart your computer.

Is GCC compiler free? ›

GCC was originally written as the compiler for the GNU operating system. The GNU system was developed to be 100% free software, free in the sense that it respects the user's freedom.

How do I fix gcc error No such file or directory? ›

How to solve no such file or directory error in gcc
  1. Step 1: Go to the location of the file you want to compile using gcc and press shift, and right-click at the same time.
  2. Step 2: Click on the "Open PowerShell window here" option, and you will find the PowerShell window opened inside that directory.

How do I fix gcc No such file or directory? ›

The “gcc no such file or directory” issue occurs when the gcc is not installed in your system. To install GCC, you can use either the command “sudo apt install gcc” or the alternate command “sudo apt install build-essential” command.

What does gcc command not found mean? ›

If you get the bash: gcc: command not found error when using this command, the GCC tool is not installed correctly.

How do I install the latest version of gcc? ›

Run 'apt list --upgradable' to see them.
  1. Run the command sudo apt install build-essential to install GCC. ...
  2. Run the command gcc –version again to verify the GCC has been installed successfully. ...
  3. Get where the GCC is installed with the below command.

How do I know if C compiler is installed on Linux? ›

Check Version of Compiler

devops@devops-osetc:~$ gcc --version gcc (Ubuntu 5.4. 0-6ubuntu1~16.04.

Where is the compiler located? ›

compilers/assemblers are themselves software, and reside wherever they were installed on the computer. that also implies that you can have as many/few of each as you want.

How do I install the latest version of gcc? ›

Run 'apt list --upgradable' to see them.
  1. Run the command sudo apt install build-essential to install GCC. ...
  2. Run the command gcc –version again to verify the GCC has been installed successfully. ...
  3. Get where the GCC is installed with the below command.

How do I install gcc on Windows 11? ›

How to Install MinGW (GCC/G++) Compiler in Windows 11 - YouTube

How do I download GNU GCC compiler for code blocks? ›

Goto http://www.codeblocks.org/downloads. Click "Download the binary release". Select your operating platform (e.g., Windows 2000/XP/Vista/7). Download the installer with GCC Compiler, e.g., codeblocks-13.12mingw-setup.exe (98 MB) (which includes MinGW's GNU GCC compiler and GNU GDB debugger).

How do I download C++ compiler on Windows 10? ›

How to install C++ compiler in windows 10
  1. Video Tutorial: How To Install C++ Compiler in Windows 10.
  2. Step 1: Download MinGW Compiler for Windows 10.
  3. Step 2: Extract MinGW in Windows 10.
  4. Step 3: Setup Environment Variables in Windows 10.
  5. Step 4: Check Installed G++ Version.
Jul 2, 2021

What is command of install the gcc? ›

sudo apt install build-essential. command-2. It will take some time to install all the essential packages. Command 3: After the second command it will install GCC on your Linux, to verify it is installed correctly, check the version of the GCC. gcc --version.

Why gcc is not working? ›

If you have not installed gcc compiler and trying to use gcc command then the error message is obvious as the functionality is not available on your computer. If you have not installed gcc compiler, then install MinGW gcc compiler on your development environment.

Where is gcc installed? ›

You need to use the which command to locate c compiler binary called gcc. Usually, it is installed in /usr/bin directory.

How do you install GCC in Windows 10 using CMD? ›

Open a Command Prompt Terminal and try typing gcc --version and press Enter. gcc (MinGW.org GCC Build-2) 9.2.

How do I set GCC path in Windows 10? ›

Once Codeblocks is installed, GCC compiler also gets installed with it. However, if we want to execute C programs from command prompt, we have to add its bin directory to the PATH variable. Go to “Control Panel\System and Security\System”, Click “Advance System Settings” and then “Environment Variables”.

How do I find GCC version in Windows? ›

So if you ever need to check the version of the GCC C++ compiler that you have installed on your PC, you can do it through the command prompt by typing in the single line, g++ --version, and this will return the result.

How do I run a GCC compiler? ›

How to Compile C Program in Command Prompt?
  1. Run the command 'gcc -v' to check if you have a compiler installed. ...
  2. Create a c program and store it in your system. ...
  3. Change the working directory to where you have your C program. ...
  4. Example: >cd Desktop. ...
  5. The next step is to compile the program.
Mar 26, 2022

Is MinGW and GCC same? ›

MinGW is a compiler system based on the GNU GCC and Binutils projects that compiles and links code to be run on Win32 (Windows) systems. It provides C, C++ and Fortran compilers plus other related tools. 'MinGW' refers to the "Minimalist GNU for Windows" project.

Why is my compiler not working in Code::Blocks? ›

It is generally due to non availability of compiler or Codeblocks is not properly configured to use the compiler. Best way is to uninstall the current codeblocks and download the version with compiler included. It will be around 80–100MB in size. Install it and most probably your problem will be solved.

How do I run GCC on Windows? ›

Install GCC on Windows

Launch mingw-get to select which MinGW project applications you want to install on your computer. First, select mingw-get from your application menu to launch it. To install GCC, click the GCC and G++ package to mark GNU C and C++ compiler for installation.

How do I know if C++ is installed on Windows 10? ›

Open Add and Remove Programs and look for Microsoft Visual C++ Redistributable. The installed versions will be listed there. This screenshot is from Windows 10.

How do I get C++ compiler on Windows? ›

If you'd rather use an IDE for C++ development, you can install the devC++ compiler/IDE for windows. Download the exe file from https://bloodshed-dev-c.en.softonic.com/ and follow the instructions there to install it. Installation is pretty straightforward.

Videos

1. How to Download and Install C Cpp Toolset ( gcc g++ gdb ) in Windows 10 using mingw-w64 and msys2
(LearningLad)
2. GCC/MinGW on Windows Quick Setup Guide
(Nick Walton)
3. How to install GCC on Ubuntu 17.04
(LinuxHelp)
4. How to install MinGW w64 on Windows 10 [2022 Update] MinGW GNU Compiler for C & C++ Programming
(Geeky Script)
5. Set up visual studio code for c and c++ programming. Installing GNU G++ compiler
(Infotech Programmer)
6. Lec 1: How to Install and Set Visual Studio Code and MinGW Compiler for C and C++ | C++ Tutorials
(Jenny's lectures CS/IT NET&JRF)

Top Articles

Latest Posts

Article information

Author: Dong Thiel

Last Updated: 11/09/2022

Views: 5858

Rating: 4.9 / 5 (59 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Dong Thiel

Birthday: 2001-07-14

Address: 2865 Kasha Unions, West Corrinne, AK 05708-1071

Phone: +3512198379449

Job: Design Planner

Hobby: Graffiti, Foreign language learning, Gambling, Metalworking, Rowing, Sculling, Sewing

Introduction: My name is Dong Thiel, I am a brainy, happy, tasty, lively, splendid, talented, cooperative person who loves writing and wants to share my knowledge and understanding with you.