Reference:
http://www.tcpdump.org/lists/workers/2001/11/msg00148.html
Nope. See `info standards' for the definition of $build*, $host* and
$target* macros. Basically, $build* refer to the system compilation is
being performed on, $host* refer to the system compiled binaries are to
run on and $target* refer to the system compiled binaries will handle. As
such $target* usually have a meaning a meaning for developemt tool only.
So far packages that make use of $target* I know of are binutils, gcc,
gdb and ksymoops (a Linux run-time error disassembler). Let's take
binutils as an example. I compile it in several ways, following are
examples of configure invocations:
1. `./configure --build=mipsel-linux --host=mipsel-linux
--target=mipsel-linux' will build native mipsel-linux binutils on
mipsel-linux.
2. `./configure --build=i386-linux --host=mipsel-linux
--target=mipsel-linux' will cross-build native mipsel-linux binutils on
i386-linux.
3. `./configure --build=i386-linux --host=i386-linux
--target=mipsel-linux' will build mipsel-linux cross-binutils on
i386-linux.
4. `./configure --build=mipsel-linux --host=i386-linux
--target=mipsel-linux' will cross-build mipsel-linux cross-binutils for
i386-linux on mipsel-linux.
As you see, only if $build != $host a cross-compilation is performed.
具体解释一下,build就是你正在使用的机器,host就是你编译好的程序可以运行的平台,target就是你编译的程序可以处理的平台.这个build和host比较好理解,但是target就不好办了,到底什么意思呢?一般来说,我们平时所说的交差编译用不到他target的,比如./configure --build=i386-linux,--host=arm-linux就可以了,在386的平台上编译可以运行在arm板的程序.但是,一般我们都是编译程序,而不是编译工具,如果我们编译工具,比如gcc,这个target就有用了.如果我们需要在一个我们的机器上为arm开发板编译一个可以处理mips程序的gcc,那么target就是mips了.不知道我的解释是否正确,如果大家看到了这篇帖子,觉得不对,批评指正.
/
binutils gcc
--build=${CLFS_HOST} --host=${CLFS_TARGET} --target=${CLFS_TARGET}
表示在宿主机构建,运行于目标机,用来生成目标机二进制代码的 工具链。
在宿主机构建:构建过程中有些中间程序需要运行于宿主,需要宿主自己的工具链来编译。
运行于目标机:构建生成的程序是目标机上的可执行程序。
用来生成目标机二进制代码:构建生成的程序是目标机上的本地编译工具链。
为什么需要 --build?
您可以使用 i486-linux-gnu 的系统,但使用 i686 甚至 x86_64 的内核,这种情况您就必须手工指定正确的参数,否则 autotool 会自作主张,有可能给出错误值。
为什么需要 --target?
您必须告诉配置系统工具链生成的目标代码类型,不要想当然。
还有问题,请自己动手验证,您会发现动一次手,几乎能解决您所有问题。
//
http://www.linuxsir.org/bbs/showthre...ht=host+target
--build = 软件在什么平台下编译
--host = 软件在什么平台下运行
--target = 软件为什么平台服务(仅限开发工具链)
host= 后面的参数是四个部分:
架构-厂商-内核-标准库
例如 arm-generic-linux-gnu 表示 arm 架构,generic 厂商,linux内核,gnu glibc 标准库。