ARM GCC:冲突的CPU架构

时间:2018-05-03 09:45:41

标签: c++ c gcc arm

在升级到ubuntu 18.04后,我无法再编译我的应用程序。我正在使用mbed-cli和st核板。这是命令mbed compile

的输出
[Warning] test.c@1926,32: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
Link: sensors
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 13/1
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc.a(lib_a-setjmp.o): Conflicting CPU architectures 13/1
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc.a(lib_a-setjmp.o)
collect2: error: ld returned 1 exit status
[ERROR] /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 13/1
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc.a(lib_a-setjmp.o): Conflicting CPU architectures 13/1
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc.a(lib_a-setjmp.o)
collect2: error: ld returned 1 exit status

[mbed] ERROR: "/usr/bin/python" returned error code 1.
[mbed] ERROR: Command "/usr/bin/python -u /home/user/examples/mbed-os/tools/make.py -t GCC_ARM -m nucleo_f411re --source . --build ./BUILD/nucleo_f411re/GCC_ARM" in "/home/user/examples"

2 个答案:

答案 0 :(得分:5)

这是Ubuntu 18.04的特定问题。它已经被提出here

解决方法是从PPA安装arm-none-eabi-gcc。以下是说明:

  • 删除已安装的一个:

    sudo apt remove gcc-arm-none-eabi
    
  • 从PPA安装一个:

    sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
    sudo apt-get update
    sudo apt-get install gcc-arm-embedded
    

答案 1 :(得分:3)

不幸的是,我无法评论OlivierM的回答,但有重要的补充。

如OlivierM之前所述,您应该删除已安装的软件并从嵌入式存储库中安装新的软件,但是如果您从主代表安装了gcc-arm-none-eabi,它还将安装binutils-arm-none-eabi,这将与gcc-arm嵌入冲突。

  • 所以您应该删除gcc-arm-none-eabi和binutils-arm-none-eabi:

    sudo apt-get remove binutils-arm-none-eabi
    sudo apt-get remove gcc-arm-none-eabi
    
  • 现在从PPA安装:

    sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
    sudo apt-get update
    sudo apt-get install gcc-arm-embedded