一.使用交叉编译器编译

1.安装交叉编译工具链

2.导出环境变量

[ubuntu @tmp]$ export PATH=$PATH:/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-poky-linux   //导出编译工具链的路径
[ubuntu @tmp]$ export CC="aarch64-poky-linux-gcc -march=armv8-a -mtune=cortex-a57.cortex-a53 --sysroot=/usr/local/oecore-x86_64/sysroots/aarch64-poky-linux" //编译时要指定sysroot
[ubuntu @tmp]$ $CC test.c -o test //编译

注意:Android上面的编译方法不是这样的。

[ubuntu @Yocto]$ . scripts/oesdk_app.sh
[ubuntu @Yocto]$ $CC -v
Using built-in specs.
COLLECT_GCC=aarch64-poky-linux-gcc
COLLECT_LTO_WRAPPER=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/7.2./lto-wrapper
Target: aarch64-poky-linux
Configured with: ../../../../../../work-shared/gcc-7.2.-r0/gcc-7.2./configure
--build=x86_64-linux
--host=x86_64-oesdk-linux
--target=aarch64-poky-linux
--prefix=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr
--exec_prefix=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr
--bindir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-poky-linux
--sbindir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-poky-linux
--libexecdir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/aarch64-poky-linux
--datadir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/share
--sysconfdir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/etc
--sharedstatedir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/com
--localstatedir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/var
--libdir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/lib/aarch64-poky-linux
--includedir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/include
--oldincludedir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/include
--infodir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/share/info
--mandir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/share/man
--disable-silent-rules
--disable-dependency-tracking
--with-libtool-sysroot=/home/user10/g6s/build/tmp/work/x86_64-nativesdk-oesdk-linux/gcc-cross-canadian-aarch64/7.2.-r0/recipe-sysroot
--with-gnu-ld
--enable-shared
--enable-languages=c,c++
--enable-threads=posix
--enable-multilib
--enable-c99
--enable-long-long
--enable-symvers=gnu
--enable-libstdcxx-pch
--program-prefix=aarch64-poky-linux-
--without-local-prefix
--enable-lto
--enable-libssp
--enable-libitm
--disable-bootstrap
--disable-libmudflap
--with-system-zlib
--with-linker-hash-style=gnu
--enable-linker-build-id
--with-ppl=no
--with-cloog=no
--enable-checking=release
--enable-cheaders=c_global
--without-isl
--with-gxx-include-dir=/not/exist/usr/include/c++/7.2.
--with-build-time-tools=/home/user10/g6s/build/tmp/work/x86_64-nativesdk-oesdk-linux/gcc-cross-canadian-aarch64/7.2.-r0/recipe-sysroot-native/usr/aarch64-poky-linux/bin
--with-sysroot=/not/exist
--with-build-sysroot=/home/user10/g6s/build/tmp/work/x86_64-nativesdk-oesdk-linux/gcc-cross-canadian-aarch64/7.2.-r0/recipe-sysroot
--without-long-double-
--enable-poison-system-directories
--with-mpfr=/home/user1/g6p/build/tmp/work/x86_64-nativesdk-oesdk-linux/gcc-cross-canadian-aarch64/7.2.-r0/recipe-sysroot
--with-mpc=/home/user1/g6p/build/tmp/work/x86_64-nativesdk-oesdk-linux/gcc-cross-canadian-aarch64/7.2.-r0/recipe-sysroot
--enable-nls
--enable-initfini-array
--enable-__cxa_atexit
Thread model: posix
gcc version 7.2. (GCC)

gcc编译器配置的更多相关文章

  1. 字符编码与gcc 编译器的编码问题

    最近在 vscode 中借助 gcc 编译器来配置 c 语言开发环境时,发现中文编码存在乱码问题.再加上最近学习到多字节字符与宽字符,搅在一起,搞得很乱,就把自己的理解写下来,供有需者参考吧. 1. ...

  2. windows下安装,配置gcc编译器

    在Windows下使用gcc编译器: 1.首先介绍下MinGW MinGW是指仅仅用自由软件来生成纯粹的Win32可运行文件的编译环境,它是Minimalist GNU on Windows的略称. ...

  3. 在CentOS 7.2下升级gcc编译器的版本

    默认情况下,CentOS 7.2预装的gcc版本是4.8.x,通过执行命令 gcc -v 可以看到,一般情况下这个版本的编译器已经满足需要了,但是某些特殊的时候为了支持C++更高的特性,需要对gcc编 ...

  4. Linux安装gcc编译器详解

    本人使用的是CentOS 6.5 64位系统,由于在安装系统的时候并没有勾选安装gcc编译器,因此需要自行安装gcc编译器. 使用yum安装gcc 对于配备了yum的Linux发行版而言,安装gcc编 ...

  5. gcc编译器与基本类型3

    C语言发展史 1969年贝尔实验室 肯尼斯·蓝·汤普逊,丹尼斯·李奇开发了B语言 ->Unix,New B语言,改名C语言83年提出C语言标准 1989年十二月正式通过C语言标准,C89标准 C ...

  6. Windows下使用GCC编译器

    1.GCC编译器的选择 Windows下最常见的安装GCC的方式有两种:Cygwin和MinGW.本文主要介绍MinGW的安装配置. 2.下载MinGW 下载地址:http://sourceforge ...

  7. redhat下升级gcc编译器

    在有网络的环境下,采用下载gcc源码进行编译的方式升级gcc版本,所以需要本身已有gcc编译器. 获取 gcc-4.9.2的包: wget http://gcc.skazkaforyou.com/re ...

  8. gcc编译器对宽字符的识别

    最早是使用VC++工具来学习C++,学的越多就越对VC挡住的我看不见的东西好奇,总想多接触一些开发环境,今日抽空摸索了一下CodeBlocks这个开源的IDE使用方法,配置的编译器是MinGW的gcc ...

  9. windows安装gcc编译器

    由于vc6.0对c语言编译不是很好,有些语句是正确的,但是编译却不能通过 所以决定在windows中安装gcc编译器来使用! http://www.cnblogs.com/cryinstall/arc ...

随机推荐

  1. Python 在字符串中处理html 和xml

    问题: 想将HTML 或者XML 实体如&entity; 或&#code; 替换为对应的文本.再者,你需要转换文本中特定的字符(比如<, >, 或&). 解决方案: ...

  2. redis入门学习记录(二)

    继第一节 redis入门学习记录(一)之后,我们来学习redis的基本使用. 接下来我们看看/usr/local/redis/bin目录下的几个文件作用是什么? redis-benchmark:red ...

  3. React 函数传参

    import React, { Component } from 'react'; import { render } from 'react-dom'; class GroceryList exte ...

  4. Python笔记 #11# 统计图定制化

    将数据可视化有许多选择: 图的类型 定制化方式 选择什么样的表现方式通常取决于: 数据 你想表达什么 1.Labels # Basic scatter plot, log scale plt.scat ...

  5. PHP设计模式_单例模式

    了解 单例设计模式用于限制特定对象只能被实例化创建一次,有且只有一个此类型的资源.例如,通过数据库句柄到数据库的连接是独占的.您希望在应用程序中共享数据库句柄,因为在保持连接打开或关闭时,它是一种开销 ...

  6. 【Rest】在Dubbo中开发REST风格的远程调用(RESTful Remoting)

    目录 概述 REST的优点 应用场景 快速入门 标准Java REST API:JAX-RS简介 REST服务提供端详解 HTTP POST/GET的实现 Annotation放在接口类还是实现类 J ...

  7. [调参]CV炼丹技巧/经验

    转自:https://www.zhihu.com/question/25097993 我和@杨军类似, 也是半路出家. 现在的工作内容主要就是使用CNN做CV任务. 干调参这种活也有两年时间了. 我的 ...

  8. Codeforces Round #394 (Div. 2) E. Dasha and Puzzle(dfs)

    http://codeforces.com/contest/761/problem/E 题意:给出一棵树,现在要把这棵树上的结点放置在笛卡尔坐标上,使得每一条边与x轴平行或者与y轴平行.输出可行解,即 ...

  9. Android中的自定义注解(反射实现-运行时注解)

    预备知识: Java注解基础 Java反射原理 Java动态代理 一.布局文件的注解 我们在Android开发的时候,总是会写到setContentView方法,为了避免每次都写重复的代码,我们需要使 ...

  10. CSS的三种样式表和优先级

    1.外部样式表当样式需要应用于很多页面时,外部样式表将是理想的选择.在使用外部样式表的情况下,你可以通过改变一个文件来改变整个站点的外观.每个页面使用 <link> 标签链接到样式表. & ...