https://api.dandelioncloud.cn/article/details/1487329970564485121

 —build=编译该软件所使用的平台
 —host=该软件将运行的平台
 —target=该软件所处理的目标平台

具体到不同的交叉编译器 —build —host —target 后面跟随的内容也不一样 ,需要使用arm-linux- gcc -v 查看版本信息 以确定

该命令给出了很多重要信息:

  1. nicholas@nicholas-virtual-machine:~/cmake-3.8.0$ arm-linux-gnueabihf-gcc -v
  2. Using built-in specs.
  3. COLLECT_GCC=arm-linux-gnueabihf-gcc
  4. COLLECT_LTO_WRAPPER=/home/nicholas/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../libexec/gcc/arm-linux-gnueabihf/4.8.3/lto-wrapper
  5. Target: arm-linux-gnueabihf
  6. Configured with: /home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/src/gcc-linaro-4.8-2014.03/configure
  7. --build=x86_64-build_unknown-linux-gnu
  8. --host=x86_64-build_unknown-linux-gnu
  9. --target=arm-linux-gnueabihf
  10. --prefix=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/install
  11. --with-sysroot=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/install/arm-linux-gnueabihf/libc
  12. --enable-languages=c,c++,fortran
  13. --disable-multilib
  14. --enable-multiarch
  15. --with-arch=armv6
  16. --with-tune=arm1176jz-s
  17. --with-fpu=vfp
  18. --with-float=hard
  19. --with-pkgversion='crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03'
  20. --with-bugurl=https://bugs.launchpad.net/gcc-linaro
  21. --enable-__cxa_atexit --enable-libmudflap
  22. --enable-libgomp --enable-libssp
  23. --with-gmp=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static
  24. --with-mpfr=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static
  25. --with-mpc=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static
  26. --with-isl=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static
  27. --with-cloog=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static
  28. --with-libelf=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static
  29. --enable-threads=posix
  30. --disable-libstdcxx-pch
  31. --enable-linker-build-id
  32. --enable-plugin
  33. --enable-gold
  34. --with-local-prefix=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/install/arm-linux-gnueabihf/libc
  35. --enable-c99
  36. --enable-long-long --with-float=hard
  37. Thread model: posix
  38. gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03)

下面是4412的交叉编译器的版本信息:

  1. nicholas@nicholas-virtual-machine:/$ arm-none-linux-gnueabi-gcc -v
  2. Using built-in specs.
  3. Target: arm-none-linux-gnueabi
  4. Configured with: /scratch/julian/2009q3-respin-linux-lite/src/gcc-4.4/configure
  5. --build=i686-pc-linux-gnu
  6. --host=i686-pc-linux-gnu
  7. --target=arm-none-linux-gnueabi
  8. --enable-threads
  9. --disable-libmudflap
  10. --disable-libssp
  11. --disable-libstdcxx-pch
  12. --enable-extra-sgxxlite-multilibs
  13. --with-arch=armv5te
  14. --with-gnu-as
  15. --with-gnu-ld
  16. --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}}}'
  17. --enable-languages=c,c++
  18. --enable-shared
  19. --disable-lto
  20. --enable-symvers=gnu
  21. --enable-__cxa_atexit
  22. --with-pkgversion='Sourcery G++ Lite 2009q3-67'
  23. --with-bugurl=https://support.codesourcery.com/GNUToolchain/
  24. --disable-nls
  25. --prefix=/opt/codesourcery
  26. --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc
  27. --with-build-sysroot=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/libc
  28. --with-gmp=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
  29. --with-mpfr=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
  30. --with-ppl=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
  31. --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
  32. --with-cloog=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
  33. --disable-libgomp
  34. --enable-poison-system-directories
  35. --with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin
  36. --with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin
  37. Thread model: posix
  38. gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67)

下面是树莓派端输入gcc -v的输出

  1. root@raspberrypi:~# gcc -v
  2. Using built-in specs.
  3. COLLECT_GCC=gcc
  4. COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/6/lto-wrapper
  5. Target: arm-linux-gnueabihf
  6. Configured with: ../src/configure -v
  7. --with-pkgversion='Raspbian 6.3.0-18+rpi1+deb9u1'
  8. --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs
  9. --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++
  10. --prefix=/usr
  11. --program-suffix=-6
  12. --program-prefix=arm-linux-gnueabihf-
  13. --enable-shared
  14. --enable-linker-build-id
  15. --libexecdir=/usr/lib
  16. --without-included-gettext
  17. --enable-threads=posix
  18. --libdir=/usr/lib
  19. --enable-nls
  20. --with-sysroot=/
  21. --enable-clocale=gnu
  22. --enable-libstdcxx-debug
  23. --enable-libstdcxx-time=yes
  24. --with-default-libstdcxx-abi=new
  25. --enable-gnu-unique-object
  26. --disable-libitm
  27. --disable-libquadmath
  28. --enable-plugin --with-system-zlib
  29. --disable-browser-plugin
  30. --enable-java-awt=gtk
  31. --enable-gtk-cairo
  32. --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-armhf/jre
  33. --enable-java-home
  34. --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-armhf
  35. --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-armhf
  36. --with-arch-directory=arm
  37. --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
  38. --with-target-system-zlib
  39. --enable-objc-gc=auto
  40. --enable-multiarch
  41. --disable-sjlj-exceptions
  42. --with-arch=armv6
  43. --with-fpu=vfp
  44. --with-float=hard
  45. --enable-checking=release
  46. --build=arm-linux-gnueabihf
  47. --host=arm-linux-gnueabihf
  48. --target=arm-linux-gnueabihf
  49. Thread model: posix
  50. gcc 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中经常能看到该参数,但实际上绝大多数软件包都是不需要该参数的。
     从这个参数的含义来看,说明其处理的目标只有在不同平台下表现为不同的时候才有作用,而这些文件通常都跟目标平台 的指令系统直接或间接有关:比如可执行文件,对于不同平台下使用的可执行文件的编码可以是完全不同的,因此必须使用 对应能处理该编码的程序才能正确处理,而如果错误的使用则可能导致程序错误或者破坏文件,对于这样要处理不同平台下会 出现不同编码的软件,我们就应当对它指定目标平台,以免另其错误处理;而对于文本文件,对于不同的平台同样的内容表达的 含义都是相同的,因此我们不需要专门针对平台来处理,这样的软件我们就可以不必对它指定需要处理的平台了。

  1. 我们来总结一下:

    build:自动测试在用平台名称,若无法检测出来则需要指定。
    host:若无指定,自动使用build的结果。
    build和host相同时表示本地编译,若不相同则表示交叉编译。
    target:表示需要处理的目标平台名称,若无指定使用host相同名称,gcc、binutils等于平台指令相关软件有此参数,多数软件此参数无用处。

  1. 综合的例子:
  2. 我们需要在x86下编译一个运行于arm上的编译器gcc,这个gcc产生mips平台的目标代码。那么我们的配置方式是:
  3. --build=x86 --host=arm --target=mips
  4. (仅是示意,方便理解,具体写法请google)

[转帖]configure 各种配置的更多相关文章

  1. Linux 下configure 参数配置与软件的安装与卸载

    Linux环境下的软件安装,并不是一件容易的事情:如果通过源代码编译后在安装,当然事情就更为复杂一些:现在安装各种软件的教程都非常普遍:但万变不离其中,对基础知识的扎实掌握,安装各种软件的问题就迎刃而 ...

  2. php编译安装configure完全配置够日常所用功能

    php编译安装configure完全配置够日常所用功能 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/p ...

  3. qt configure参数配置介绍

    ======================================全文是按照./configure -help来翻译的==================================== ...

  4. PHP安装之configure的配置参数

    1.生成环境安装配置如下 要求安装如下库: imagickgdmysqlmysqlimysqlndphalconPharsoapsocketsxwebxsvczipzlib 具体查看 vim php- ...

  5. Nginx Configure时配置

    Configure Arguments Configure arguments common for nginx binaries from pre-built packages for stable ...

  6. 指定特殊的安装目录用configure进行配置

    linux - Make install, but not to default directories? - Stack Overflow I want to run 'make install' ...

  7. [转帖]springboot2.0配置连接池(hikari、druid)

    springboot2.0配置连接池(hikari.druid) 原文链接:https://www.cnblogs.com/blog5277/p/10660689.html 原文作者:博客园--曲高终 ...

  8. [转帖]Centos7防火墙配置rich-rule实现IP端口限制访问

    Centos7防火墙配置rich-rule实现IP端口限制访问 2019-02-18 18:05:35 sunny05296 阅读数 2143  收藏 更多 分类专栏: Linux   版权声明:本文 ...

  9. [转帖]Kubernetes - nginx-ingress 配置跳坑指南

    Kubernetes - nginx-ingress 配置跳坑指南 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https:// ...

  10. [转帖]nginx location配置详细解释

    nginx location配置详细解释 http://outofmemory.cn/code-snippet/742/nginx-location-configuration-xiangxi-exp ...

随机推荐

  1. 2023“强网杯”部分WP

    强网先锋 SpeedUp 题目 我的解答: 分析代码可知是求2的27次方的阶乘的每一位的和. 使用在线网址直接查看:https://oeis.org/A244060/list 然后sha256加密 f ...

  2. vscode 启动go

    { "version": "0.2.0", "configurations": [ { "name": "La ...

  3. SaaS 营销怎么做?几点思考

    按大部分 SaaS 公司组织架构,梳理了这 4 大业务部门(产品.市场.销售.服务-客户成功)的职责和客户价值链条.如图: 根据客户价值体验地图,分为两块过程: 客户营销过程 客户成功过程 针对 Sa ...

  4. 华为云API Explorer:自动化运维的得力助手

    华为云API Explorer为开发者提供一站式API解决方案统一平台,集成华为云服务所有开放API,支持全量快速检索.可视化调试.帮助文档.代码示例等能力,帮助开发者快速学习API,使用API开发代 ...

  5. 解读分布式调度平台Airflow在华为云MRS中的实践

    摘要:Airflow是一个使用Python语言编写的分布式调度平台,通过DAG(Directed acyclic graph 有向无环图)来管理任务. 本文分享自华为云社区<分布式调度平台Air ...

  6. Vue 应用程序性能优化:代码压缩、加密和混淆配置详解

    ​ 简介在 Vue 应用程序的开发中,代码压缩.加密和混淆是优化应用程序性能和提高安全性的重要步骤. Vue CLI 是一个功能强大的开发工具,它提供了方便的配置选项来实现这些功能.本文将介绍如何使用 ...

  7. Solon 开发进阶,四、启动参数说明

    Solon 开发进阶 一.插件扩展机制 二.体外扩展机制 三.常用配置说明 四.启动参数说明 五.全局异常订阅 启动参数,在应用启动后会被静态化(为了内部更高效的利用).比如,想通过体外扩展加载配置, ...

  8. Spring Boot实战:静态资源无法访问

    发现  static 或 public 下面的图片无法访问 spring: profiles: active: dev resources: static-locations: classpath:/ ...

  9. 【AI 安全探索】AI 流行的时代,我们应该担心什么?

    视频地址:https://www.bilibili.com/video/BV1eg4y1Q7N5/ 是未来危机,还是眼下的问题? Sasha Luccioni 是 Hugging Face 团队的道德 ...

  10. 正确理解c# default关键字

    背景 最近QA测试一个我开发的一个Web API时,我意识到之前对C#的default的理解一直是想当然的.具体情况是这样,这个API在某些条件下要返回模型的默认值,写法类似于下面这样 [HttpGe ...