今天学习GDB的过程中, 发现了了一个configure的问题,就是configure中 build, target, host 到底代表什么意思. 在网上搜索到了这篇文档:
Reference:
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开发板上的编译编译器gcc,而这个gcc编译器, 可以编译出运行在mips平台上的程序, 那么target就是mips了. 不知道我的解释是否正确, 假如大家看到了这篇帖子, 觉得不对, 批评指正.
阅读(925) | 评论(0) | 转发(0) |