[转帖]configure 各种配置
https://api.dandelioncloud.cn/article/details/1487329970564485121
—build=编译该软件所使用的平台
—host=该软件将运行的平台
—target=该软件所处理的目标平台
具体到不同的交叉编译器 —build —host —target 后面跟随的内容也不一样 ,需要使用arm-linux- gcc -v 查看版本信息 以确定

该命令给出了很多重要信息:
nicholas@nicholas-virtual-machine:~/cmake-3.8.0$ arm-linux-gnueabihf-gcc -vUsing built-in specs.COLLECT_GCC=arm-linux-gnueabihf-gccCOLLECT_LTO_WRAPPER=/home/nicholas/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../libexec/gcc/arm-linux-gnueabihf/4.8.3/lto-wrapperTarget: arm-linux-gnueabihfConfigured with: /home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/src/gcc-linaro-4.8-2014.03/configure--build=x86_64-build_unknown-linux-gnu--host=x86_64-build_unknown-linux-gnu--target=arm-linux-gnueabihf--prefix=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/install--with-sysroot=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/install/arm-linux-gnueabihf/libc--enable-languages=c,c++,fortran--disable-multilib--enable-multiarch--with-arch=armv6--with-tune=arm1176jz-s--with-fpu=vfp--with-float=hard--with-pkgversion='crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03'--with-bugurl=https://bugs.launchpad.net/gcc-linaro--enable-__cxa_atexit --enable-libmudflap--enable-libgomp --enable-libssp--with-gmp=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static--with-mpfr=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static--with-mpc=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static--with-isl=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static--with-cloog=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static--with-libelf=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static--enable-threads=posix--disable-libstdcxx-pch--enable-linker-build-id--enable-plugin--enable-gold--with-local-prefix=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/install/arm-linux-gnueabihf/libc--enable-c99--enable-long-long --with-float=hardThread model: posixgcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03)
下面是4412的交叉编译器的版本信息:
nicholas@nicholas-virtual-machine:/$ arm-none-linux-gnueabi-gcc -vUsing built-in specs.Target: arm-none-linux-gnueabiConfigured with: /scratch/julian/2009q3-respin-linux-lite/src/gcc-4.4/configure--build=i686-pc-linux-gnu--host=i686-pc-linux-gnu--target=arm-none-linux-gnueabi--enable-threads--disable-libmudflap--disable-libssp--disable-libstdcxx-pch--enable-extra-sgxxlite-multilibs--with-arch=armv5te--with-gnu-as--with-gnu-ld--with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables} %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}'--enable-languages=c,c++--enable-shared--disable-lto--enable-symvers=gnu--enable-__cxa_atexit--with-pkgversion='Sourcery G++ Lite 2009q3-67'--with-bugurl=https://support.codesourcery.com/GNUToolchain/--disable-nls--prefix=/opt/codesourcery--with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc--with-build-sysroot=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/libc--with-gmp=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--with-mpfr=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--with-ppl=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'--with-cloog=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--disable-libgomp--enable-poison-system-directories--with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin--with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/binThread model: posixgcc version 4.4.1 (Sourcery G++ Lite 2009q3-67)
下面是树莓派端输入gcc -v的输出
root@raspberrypi:~# gcc -vUsing built-in specs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/6/lto-wrapperTarget: arm-linux-gnueabihfConfigured with: ../src/configure -v--with-pkgversion='Raspbian 6.3.0-18+rpi1+deb9u1'--with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++--prefix=/usr--program-suffix=-6--program-prefix=arm-linux-gnueabihf---enable-shared--enable-linker-build-id--libexecdir=/usr/lib--without-included-gettext--enable-threads=posix--libdir=/usr/lib--enable-nls--with-sysroot=/--enable-clocale=gnu--enable-libstdcxx-debug--enable-libstdcxx-time=yes--with-default-libstdcxx-abi=new--enable-gnu-unique-object--disable-libitm--disable-libquadmath--enable-plugin --with-system-zlib--disable-browser-plugin--enable-java-awt=gtk--enable-gtk-cairo--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-armhf/jre--enable-java-home--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-armhf--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-armhf--with-arch-directory=arm--with-ecj-jar=/usr/share/java/eclipse-ecj.jar--with-target-system-zlib--enable-objc-gc=auto--enable-multiarch--disable-sjlj-exceptions--with-arch=armv6--with-fpu=vfp--with-float=hard--enable-checking=release--build=arm-linux-gnueabihf--host=arm-linux-gnueabihf--target=arm-linux-gnueabihfThread model: posixgcc version 6.3.0 20170516 (Raspbian 6.3.0-18+rpi1+deb9u1)
///
交叉编译中的build、host和target
build、host和target
在交叉编译中比较常见的一些参数就是build、host和target了,正确的理解这三者的含义对于交叉编译是非常重要的,下面就此进行解释
—build=编译该软件所使用的平台
—host=该软件将运行的平台
—target=该软件所处理的目标平台
我们以 gcc 为例子来 讲解 这三者的作用
在gcc编译中我们使用
./configure —build=编译平台 —host=运行平台 —target=目标平台 [各种编译参数]
来配置gcc的源代码,以让其编译出我们需要的gcc编译器。
那么在这组配置参数中:
—build:
表示目前我们正在运行的平台名称是什么,如果当前我们是在intel的pentium机器中编译该系统,那么我们的—build就可能是 i686-pc-linux-gnu,当然如果我们在其它种类的机器上编译那么这个build就应该是那个机器所对应的平台名称。
该参数在不指定的情况下将自动尝试猜测目前平台的名称。
—host:
表示我们把这个编译好的gcc在什么样的平台下运行,在交叉编译过程中这个需要我们来指定,因为机器自己是不能知道我们心里是怎么想的,那 么我们可以明确的告诉它,我们要做出来的程序是运行在“龙芯”上的,但是目前还不能直接指定“龙芯”,因此我们这里指定为mips64el- unknown-linux-gnu(如果你省点事情那么就用这个名字好了,如果你想用个有个性的名字,那么请你想明白它的含义再动手,并且做好后面的过 程需要多出一些手续的麻烦的心理准备)。
—host也可以不指定,那么host将自动使用build来定义自己,不过那将不再是交叉编译。
注:—build和—host在不同的时候就被配置文件认定为交叉编译方式。
—target:
该参数的目的是让配置程序知道这个软件被编译后使用来处理什么平台上的文件的。
target这个参数只有在为数不多的几个包中有用处,虽然在./configure —help中经常能看到该参数,但实际上绝大多数软件包都是不需要该参数的。
从这个参数的含义来看,说明其处理的目标只有在不同平台下表现为不同的时候才有作用,而这些文件通常都跟目标平台 的指令系统直接或间接有关:比如可执行文件,对于不同平台下使用的可执行文件的编码可以是完全不同的,因此必须使用 对应能处理该编码的程序才能正确处理,而如果错误的使用则可能导致程序错误或者破坏文件,对于这样要处理不同平台下会 出现不同编码的软件,我们就应当对它指定目标平台,以免另其错误处理;而对于文本文件,对于不同的平台同样的内容表达的 含义都是相同的,因此我们不需要专门针对平台来处理,这样的软件我们就可以不必对它指定需要处理的平台了。
我们来总结一下:
build:自动测试在用平台名称,若无法检测出来则需要指定。
host:若无指定,自动使用build的结果。
build和host相同时表示本地编译,若不相同则表示交叉编译。
target:表示需要处理的目标平台名称,若无指定使用host相同名称,gcc、binutils等于平台指令相关软件有此参数,多数软件此参数无用处。
综合的例子:我们需要在x86下编译一个运行于arm上的编译器gcc,这个gcc产生mips平台的目标代码。那么我们的配置方式是:--build=x86 --host=arm --target=mips(仅是示意,方便理解,具体写法请google)
[转帖]configure 各种配置的更多相关文章
- Linux 下configure 参数配置与软件的安装与卸载
Linux环境下的软件安装,并不是一件容易的事情:如果通过源代码编译后在安装,当然事情就更为复杂一些:现在安装各种软件的教程都非常普遍:但万变不离其中,对基础知识的扎实掌握,安装各种软件的问题就迎刃而 ...
- php编译安装configure完全配置够日常所用功能
php编译安装configure完全配置够日常所用功能 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/p ...
- qt configure参数配置介绍
======================================全文是按照./configure -help来翻译的==================================== ...
- PHP安装之configure的配置参数
1.生成环境安装配置如下 要求安装如下库: imagickgdmysqlmysqlimysqlndphalconPharsoapsocketsxwebxsvczipzlib 具体查看 vim php- ...
- Nginx Configure时配置
Configure Arguments Configure arguments common for nginx binaries from pre-built packages for stable ...
- 指定特殊的安装目录用configure进行配置
linux - Make install, but not to default directories? - Stack Overflow I want to run 'make install' ...
- [转帖]springboot2.0配置连接池(hikari、druid)
springboot2.0配置连接池(hikari.druid) 原文链接:https://www.cnblogs.com/blog5277/p/10660689.html 原文作者:博客园--曲高终 ...
- [转帖]Centos7防火墙配置rich-rule实现IP端口限制访问
Centos7防火墙配置rich-rule实现IP端口限制访问 2019-02-18 18:05:35 sunny05296 阅读数 2143 收藏 更多 分类专栏: Linux 版权声明:本文 ...
- [转帖]Kubernetes - nginx-ingress 配置跳坑指南
Kubernetes - nginx-ingress 配置跳坑指南 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https:// ...
- [转帖]nginx location配置详细解释
nginx location配置详细解释 http://outofmemory.cn/code-snippet/742/nginx-location-configuration-xiangxi-exp ...
随机推荐
- 斯坦福 UE4 C++ ActionRoguelike游戏实例教程 16.优化交互,实现看到物体时出现交互提示
斯坦福课程 UE4 C++ ActionRoguelike游戏实例教程 0.绪论 概述 本篇文章对应Lecture 18 – Creating Buffs, World Interaction, 73 ...
- 斯坦福 UE4 C++ ActionRoguelike游戏实例教程 07.在C++中使用UMG
斯坦福 UE4 C++ ActionRoguelike游戏实例教程 07.在C++中使用UMG 斯坦福课程 UE4 C++ ActionRoguelike游戏实例教程 0.绪论 概述 本篇文章的目标是 ...
- 讲真,你知道Python咋来的吗?
摘要:什么是Python?它怎么诞生的?它跟C语言.shell语言有什么区别?语言环境是怎么样的?这些你都知道吗? Python诞生在一个圣诞节 Python诞生于1989年的一个圣诞节,其创作者Gu ...
- 实践GoF的设计模式:代理模式
摘要: 代理模式为一个对象提供一种代理以控制对该对象的访问. 本文分享自华为云社区<[Go实现]实践GoF的23种设计模式:代理模式>,作者:元闰子 . 简介 GoF 对代理模式(Prox ...
- 云小课丨SA基线检查:给云服务来一次全面“体检”
摘要:随着企业上云进程的加快,由于云服务配置不合理.不合规等引发的安全风险与日俱增.如果没有加以重视并做及时的诊断处置,将会对企业云上业务带来巨大的安全隐患. 本文分享自华为云社区<云小课丨安全 ...
- MySQL 是如何实现RC事务隔离级别的
摘要:Read Committed,事务运行期间,只要别的事务修改数据并提交,即可读到人家修改的数据,所以会有不可重复读.幻读问题. 本文分享自华为云社区<MySQL RC事务隔离级别的实现&g ...
- Kubernetes(K8S) 配置管理 Secret 介绍
Secret 作用:加密数据(base64)存在 etcd 里面,让 Pod 容器以挂载 Volume 方式进行访问 场景:凭证 [root@k8smaster ~]# echo -n 'admin' ...
- 熔断、限流、降级 —— SpringCloud Alibaba Sentinel
Sentinel 简介 Sentinel 是阿里中间件团队开源的,面向分布式服务架构的高可用流量防护组件,主要以流量为切入点,从限流.流量整形.熔断降级.系统负载保护.热点防护等多个维度来帮助开发者保 ...
- EasyUI DataGrid 没有数据
//判断后台返回数据是否没数据,没数据DataGrid添加一行 $(this).datagrid('appendRow', { itemid: '<div style="text-al ...
- 0x61 图论-最短路
B题 Telephone Lines https://ac.nowcoder.com/acm/contest/1055/B 中文题面:https://www.luogu.com.cn/problem/ ...