在Mac OS上使用AVR-GCC进行编译时出现Clang错误

问题描述 投票:0回答:1

我正在尝试使用通过macports安装的avr-gcc为AVR交叉编译程序。在终端中:

avr-gcc -O1   -DF_CPU=1000000UL -DBAUD=9600 -I.  -I/opt/local/avr/include/ -Wl,-Map,main.map -mmcu=atmega328p main.c -c

导致错误:

clang: error: unknown argument: '-mgcc-isr'
clang: error: unknown argument: '-mno-skip-bug'

上面的交叉编译曾经可以工作,但是在更新到Catalina并重新安装avr-gcc之后,出现了一些混乱。在谷歌搜索中,我发现使用较新版本的Clang,如果Clang无法识别命令行参数,则会引发错误。这些建议说使用-Wno-error = gcc-isr之类的东西。所以我的命令变成:

avr-gcc -O1  -Wno-error=gcc-isr -DF_CPU=1000000UL -DBAUD=9600 -I.  -I/opt/local/avr/include/ -Wl,-Map,main.map -mmcu=atmega328p main.c -c

其结果是:

cc1: error: ‘-Werror=gcc-isr’: no option -Wgcc-isr

似乎在Clang和avr-gcc之间变得有些混乱。虽然我不确定在使用avr-gcc时为什么会调用Clang。有人知道这里发生了什么吗?

clang avr-gcc
1个回答
0
投票

[好吧,我不确定为什么用avr-gcc调用clang,但是我确实设法通过以下方式卸载来编译代码:(1)avr-gcc和(2)avr-binutils通过macports使用:

sudo port uninstall avr-binutils
sudo port uninstall avr-libc (I uninstalled this because it depends on avr-gcc)
sudo port uninstall avr-gcc

然后我使用]重新安装了它>

sudo port install avr-gcc

问我是否要安装avr-binutils。然后,我重新安装了avr-libc。这些是直接步骤。当我问我是否要安装avr-binutils时,我按了'N'来弄错了。因此,我添加了:

sudo port clean avr-binutils

清除该错误。清除所有内容后,即可执行上述步骤。再次,这仅通过重新安装交叉编译软件就消除了错误,但是我仍然认为原始问题存在一些潜在的误解。

© www.soinside.com 2019 - 2024. All rights reserved.