host ,build,target in configure

在linux平台上,下载了个源码包,准备编译的时候,配置的时候 用到了configure脚本文件,其中有几参数

--prefix=/home/soft/ 说明这个包产生的文件会安装到哪个路径下(一般先生成makefile,makefile会用到这个参数的),再make ,make install (把编译出的文件相当于拷贝到/home/soft 下)

--build=i*86-linux 就是说这个源码包在哪个系统上面被编译,一般在pc上是x86的机器,

--host=arm-linux 说明这个编译出来的exe是在哪个系统上运行的,一般交叉编译编译的时候,制定这项和build就够了。(如果在x86上编译产生在别的平台上运行的编译工具如gcc除外,在这样的情况下,你编译出的gcc,所生成的文件能够运行在哪个平台,就应该用--target 来制定了)

--target=arm-linux 说明编译出的工具,能够产生这个平台上运行的exe文件。

有几个文章很好:

1

If build, host, and target are all the same, this is called a native. If build and host are the same but target is different, this is called a cross. If build, host, and target are all different this is called a canadian (for obscure reasons dealing with Canada's political party and the background of the person working on the build at that time). If host and target are the same, but build is different, you are using a cross-compiler to build a native for a different system. Some people call this a host-x-host, crossed native, or cross-built native. If build and target are the same, but host is different, you are using a cross compiler to build a cross compiler that produces code for the machine you're building on. This is rare, so there is no common way of describing it. There is a proposal to call this a crossback.

http://blog.csdn.net/zhanglianpin/article/details/6621345

http://wifihack.net/blog/2008/08/gnu-configure-%E4%B8%AD%E7%9A%84-build-target%E5%92%8Chost-%E7%9A%84%E5%8C%BA%E5%88%AB/

4 一个有关的例子:

  在交叉编译的时候总是使用configure --host=arm-linux 嘿嘿 但是在CONFIGURE中有很多的测试程序是不可以在HOST上运行的就会出现: error: cannot run test program while cross compiling
类似的错误,可以使用CACHEFILE解决这个问题,还要谢谢ABSURD兄的文章给我的指导。
我是这样解决的第一步:记录下错误的地方如:checking abstract socket namespace... configure: error: cannot run test program while cross compiling
注意到abstract socket namespace在configure中查找abstract socket可以看到类似这样的结构
echo "$as_me:$LINENO: checking abstract socket namespace" >&5
echo $ECHO_N "checking abstract socket namespace... $ECHO_C" >&6
if test "${ac_cv_have_abstract_sockets+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
其中ac_cv_have_abstract_sockets是我们要查找的变量
使用echo ac_cv_have_abstract_sockets=yes>arm-linux.cache
然后
./configure --host=arm-linux --cache-file=arm-linux.cache
 K这样就搞定了 
再次感谢http://blog.csdn.net/absurd兄!

posted @ 2012-07-12 15:30  Colourman  阅读(260)  评论(0编辑  收藏  举报