Cross-compilation parameters--build, host, and target differences

Source: Internet
Author: User
Cross-compilation parameters--build, host, and Target

Build, host, and Target
Some of the more common parameters in cross-compilation are build, host, and Target, and it is important to understand the meaning of these three things correctly for cross-compilation, which is explained below.
--build= the platform used to compile the software
--host= the platform that the software will run
--target= the target platform that the software deals with

We use GCC as an example to explain the role of these three.
In GCC compilation we use the
./configure--build= Compiler platform--host= run platform--target= Target platform [various compilation parameters]
To configure GCC's source code to compile the GCC compiler we need.

So in this set of configuration parameters:
--build:
What is the name of the platform we are currently running, and if we are currently compiling the system in Intel's Pentium machine, then our--build may be i686-pc-linux-gnu, Of course if we compile on other kinds of machines then this build should be the platform name for that machine.
This parameter will automatically guess the name of the current platform without specifying the general knowledge.

--host:
That we put this compiled gcc in what kind of platform to run, in the cross-compiling process this need us to specify, because the machine itself can not know how we think, then we can clearly tell it, we want to do out of the program is running in "godson" on, but currently can not be directly designated " Godson ", so we are designated here as MIPS64EL-UNKNOWN-LINUX-GNU (if you save things then use this name well, if you want to use a personality name, then you want to understand what it means to do it again, And do a good job in the back of the process need some more formalities of trouble psychological preparation).
--host can also be unspecified, then host will automatically use build to define itself, but that will no longer be cross-compiling.
Note:--build and--host are identified as cross-compiled by the configuration file at different times.

--target:
The purpose of this parameter is to let the configuration program know what the software is compiled to use to process the files on the platform.
Target This parameter is useful only in a few packages, although this parameter is often seen in the./configure--help, but in fact most packages do not require this parameter.
From the meaning of this parameter, it is stated that the target of its processing is only useful when it behaves differently under different platforms, and these files are usually directly or indirectly related to the target platform's instruction system: executable files, for example, can be completely different from executable files used under different platforms, so you must use Corresponding to the program can handle the code can be processed correctly, and if the use of errors may lead to a program error or corrupt files, in order to deal with different platforms under the different coding software, we should specify the target platform to avoid another error processing, and for text files, The same content expression is the same for different platforms, so we don't need to do it specifically for the platform, so we don't have to specify the platform that needs to be processed.

Let's sum it up:
Build: The automatic test in the platform name, if not detected, you need to specify.
Host: Automatically uses the result of build if none is specified.
The build and host are the same when they are compiled locally, which means cross-compilation, if not the same.
Target: Indicates the desired platform name to be processed, if no specified using the same host name, GCC, binutils equals platform directive related software has this parameter, most software this parameter is useless.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.