linux上编译程序时由于arm-none-eabi-gcc版本过老出现警告

一.问题描述:

当使用make进行程序编译的时候出现如下警告,原因是用于编译的arm-none-eabi版本过老的缘故

nickcong@nickcong-Inspiron-3537:~/crazyflie-firmware$ sudo make

CLEAN_VERSION

VTMPL version.c

CC version.o

LD cf2.elf

/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail

/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-ctype_.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail

/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-errno.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail

/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-__call_atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail

COPY cf2.hex

COPY cf2.bin

DFUse cf2.dfu

Crazyflie 2.0 build!

Build 43:a626925d4b07 (2017.06-43) MODIFIED

Version extracted from git

Crazyloader build!

text     data     bss     dec     hex    filename

139808     2592     63240     205640     32348    cf2.elf

虽然程序能顺利编译通过,但是对于有一点强迫症的我来说,还是不舒服,根据论坛的办法去解决但是总是有点问题

下面记录一下每一步的解决过程与碰到的问题

1.如果直接在终端上

sudo apt-get install gcc-arm-none-eabi

则在repo服务器上下载的还是4.9.3,不是官网上最新的

 

二.试错过程

后面决定直接在

GNU Arm Embedded Toolchain上下载,网址:下载链接

按照网上的办法下载下来解压后,添加环境变量后还是有警告

仔细看一遍警告

2.1分析

warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-strncmp.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail

它一直使用的是 /usr/lib/gcc下的/arm-none-eabi/4.9.3

当我键入which arm-none-eabi-gcc显示

/usr/bin/gcc-arm-none-eabi-7-2017-q4-major/bin//arm-none-eabi-gcc

 

因此后面手动把

/usr/lib/gcc下的/arm-none-eabi/4.9.3给删除了,事实证明我是手贱,在一次编译的时候直接报错,后面

幸亏依靠新立得才重新还原了回去,

虽然还是有警告,但是总比报错好

 

三、最后的解决办法:

最后的问题是出在Makefile上,在Makefile里CROSS_COMPILE ?=arm-none-eabi-,它可能是使用默认路径,因此需要

把编译的路径修改一下,最后修改为CROSS_COMPILE ?= /home/nickcong/gun_tools_2017/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-

 

大功告成!

解决的思路来自于思路链接

你可能感兴趣的:(嵌入式)