一.使用交叉编译器编译

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. 字王·国标二级字库汉字GB内码un码三合一对照表2016版

    国标二级字库汉字GB内码un码三合一对照表 字王2016版 汉字内码表,是制作字库的基础,简单.便利的版本很少,根据实战经验,特此制作这个三合一版本的汉字.GB内码.Unicode码对照表: l 提供 ...

  2. .net webform 把word转为html

    首先添加引用 引用命名空间 using Microsoft.Office.Interop.Word; using System; using System.Collections.Generic; u ...

  3. CentOS7 忘了root密码怎么办

    今天打开很久没开机的另2台虚拟机,发现不记得root密码了. 于是参考了google搜索到的第一个答案,https://www.unixmen.com/reset-root-password-cent ...

  4. UVA 11019 Matrix Matcher(二维hash + 尺取)题解

    题意:在n*m方格中找有几个x*y矩阵. 思路:二维hash,总体思路和一维差不太多,先把每行hash,变成一维的数组,再对这个一维数组hash变成二维hash.之前还在想怎么快速把一个矩阵的hash ...

  5. luogu p1101 单词方阵

    https://www.luogu.org/problem/show?pid=1101 很恶心的代码  就是八个方向都搜索 #include<bits/stdc++.h> using na ...

  6. luogu p3366 最小生成树模板

    倒腾了一个小时  自己也没去看网上的 总算自己能写出来模板了 kruskal //最小生成树 每次找最短的边 #include<bits/stdc++.h> using namespace ...

  7. 如何创建.babelrc文件?

    方法一: 根目录下,创建  .babelrc.  文件名就可以了! 方法二: git进入根目录,输入   type>.babelrc  ,回车即可!

  8. UVa 1662 Brackets Removal

    https://vjudge.net/problem/UVA-1662 题意: 给出一个序列,判断序列中哪些括号是可以去掉的,只可以改变符号.输出括号最少的序列. 思路: 感觉这道题目就是写起来繁琐了 ...

  9. UVa 10375 选择与除法(唯一分解定理)

    https://vjudge.net/problem/UVA-10375 题意: 输入整数p,q,r,s,计算C(p,q)/C(r,s). 思路: 先打个素数表,然后用一个数组e来保存每个素数所对应的 ...

  10. Codeforces Round #307 (Div. 2) C. GukiZ hates Boxes 二分

    C. GukiZ hates Boxes time limit per test 2 seconds memory limit per test 256 megabytes input standar ...