Next: , Up: Manual Configuration   [Contents][Index]

8.3.6.1 Specifying target triplets

configure can usually guess the canonical name for the type of system it’s running on. To do so it runs a script called config.guess, which infers the name using the uname command or symbols predefined by the C preprocessor.

Alternately, the user can specify the system type with command line arguments to configure (see System Type). Doing so is necessary when cross-compiling. In the most complex case of cross-compiling, three system types are involved. The options to specify them are:

--build=build-type

The type of system on which the package is being configured and compiled. It defaults to the result of running config.guess. Specifying a build-type that differs from host-type enables cross-compilation mode.

--host=host-type

The type of system on which the package runs. By default it is the same as the build machine. Specifying a host-type that differs from build-type, when build-type was also explicitly specified, enables cross-compilation mode.

--target=target-type

The type of system for which any compiler tools in the package produce code. By default, it is the same as host.

For ordinary packages the target is meaningless and should not be used. The target is for use by a package creating a compiler or similar, and indicates what the created compiler should generate code for, if it can cross-compile. It generally selects various hard-coded CPU and system conventions, since usually the compiler or tools under construction themselves determine how the target works.

If you mean to override the result of config.guess, use --build, not --host, since the latter enables cross-compilation. For historical reasons, whenever you specify --host, be sure to specify --build too; this will be fixed in the future. So, to enter cross-compilation mode, use a command like this

./configure --build=i686-pc-linux-gnu --host=m68k-coff

Note that if you do not specify --host, configure fails if it can’t run the code generated by the specified compiler. For example, configuring as follows fails:

./configure CC=m68k-coff-gcc

When cross-compiling, configure will warn about any tools (compilers, linkers, assemblers) whose name is not prefixed with the host type. This is an aid to users performing cross-compilation. Continuing the example above, if a cross-compiler named cc is used with a native pkg-config, then libraries found by pkg-config will likely cause subtle build failures; but using the names m68k-coff-cc and m68k-coff-pkg-config avoids any confusion. Avoiding the warning is as simple as creating the correct symlinks naming the cross tools.

configure recognizes short aliases for many system types; for example, ‘decstation’ can be used instead of ‘mips-dec-ultrix4.2’. configure runs a script called config.sub to canonicalize system type aliases.

This section omits the description of the obsolete interface; see Hosts and Cross-Compilation.

Next: , Up: Manual Configuration   [Contents][Index]