关于g:avr-gcc 8.1.0使用`as`代替`avr-as`

avr-gcc 8.1.0 uses `as` instead of `avr-as`

我想对新项目使用最新版本的avr-gcc(8.1.0),但从ubuntu的package-manager中无法使用。因此,我使用此站点的构建脚本自己编译了该文件:https://gist.github.com/zkemble/edec6914ba719bf339b1b85c1fa792dc
(我正在Ubuntu 16.04下工作,所以我设置了BUILD_WIN32=0BUILD_WIN64=0只是为了构建linux版本)。

在编译成功完成之后,我尝试通过手动复制输出文件和目录来使其可用,如下所示:(当命名相同时,替换先前存在的文件)

  • ./linux/bin/*/usr/bin/
  • ./linux/lib/gcc/avr/8.10usr/lib/gcc/avr/
  • ./linux/share/man/*/usr/share/man/
  • ./linux/libexec/usr/
  • ./libc/avr/*/usr/lib/avr/
  • ./libc/avr/include/*/usr/lib/gcc/include/

这是一种反复试验,也许某些路径是错误的,但是与旧gcc安装中的旧文件进行比较时,这似乎是合理的。 avr-g++ -v给我正确的版本" gcc版本8.1.0(GCC)"。

(我使用蚀氧作为IDE,因此以下命令是自动生成的,请原谅膨胀的命令)-使用

编译我的项目时

1
2
3
4
    avr-g++ -v -I"/media/Data/Eigene_Dateien/Valentins_Dateien/Projekte/Software/ATmighty/src/ATmighty"
    -Wall -g2 -gstabs -Os -ffunction-sections -fdata-sections -fno-exceptions
    -std=c++11 -mmcu=atmega2560 -DF_CPU=16000000UL -MMD -MP -MF"main.d" -MT"main.o"
    -c -o"main.o""/media/Data/Eigene_Dateien/Valentins_Dateien/Projekte/Software/ATmighty/src/QuickTests/main.cpp"

我收到以下错误:as: Unknown option: ??-mmcu=avr6??。 (有关完整的详细输出,请参见下面的内容。)

似乎新的avr-g++编译器没有使用正确的avr-as文件,而是使用主机默认的as汇编器。但是avr-as位于\\usr\\bin\\中,与as所在的文件夹相同。

如何设置avr-g 8.1.0-toolchain使其正常工作?我实际上想尝试一些新的avr-g功能,并且官方存储库中的默认版本确实很旧(某些4.x版本)

完整avr-g输出:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Using built-in specs.
Reading specs from /usr/bin/../lib/gcc/avr/8.1.0/device-specs/specs-atmega2560
COLLECT_GCC=avr-g++
Target: avr
Configured with: ../configure --prefix=/home/valentin/Schreibtisch/avr-gcc-8.x/linux --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --disable-libada --with-dwarf2 --disable-shared --enable-static
Thread model: single
gcc version 8.1.0 (GCC)
COLLECT_GCC_OPTIONS='-I' '/media/Data/Eigene_Dateien/Valentins_Dateien/Projekte/Software/ATmighty/src/ATmighty' '-Wall' '-g2' '-gstabs' '-Os' '-ffunction-sections' '-fdata-sections' '-fno-exceptions' '-std=c++11'  '-D' 'F_CPU=16000000UL' '-MMD' '-MP' '-MF' 'main.d' '-MT' 'main.o' '-c' '-o' 'main.o' '-v' '-specs=device-specs/specs-atmega2560' '-mmcu=avr6'
 /usr/bin/../libexec/gcc/avr/8.1.0/cc1plus -quiet -v -I /media/Data/Eigene_Dateien/Valentins_Dateien/Projekte/Software/ATmighty/src/ATmighty -imultilib avr6 -iprefix /usr/bin/../lib/gcc/avr/8.1.0/ -MMD main.d -MF main.d -MP -MT main.o -iplugindir=/usr/bin/../lib/gcc/avr/8.1.0/plugin -D__AVR_ATmega2560__ -D__AVR_DEVICE_NAME__=atmega2560 -D F_CPU=16000000UL /media/Data/Eigene_Dateien/Valentins_Dateien/Projekte/Software/ATmighty/src/QuickTests/main.cpp -iplugindir=/usr/bin/../lib/gcc/avr/8.1.0/plugin -mn-flash=4 -mno-skip-bug -quiet -dumpbase main.cpp -mmcu=avr6 -auxbase-strip main.o -g2 -gstabs -Os -Wall -std=c++11 -version -ffunction-sections -fdata-sections -fno-exceptions -mn-flash=4 -mno-skip-bug -fno-rtti -fno-enforce-eh-specs -fno-exceptions -o /tmp/ccLavHFh.s
GNU C++11 (GCC) version 8.1.0 (avr)
    compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Versions of loaded plugins:
 avr-flash-vtbl: Unknown version.
ignoring nonexistent directory"/usr/bin/../lib/gcc/avr/8.1.0/../../../../avr/include/c++/8.1.0"
ignoring nonexistent directory"/usr/bin/../lib/gcc/avr/8.1.0/../../../../avr/include/c++/8.1.0/avr/avr6"
ignoring nonexistent directory"/usr/bin/../lib/gcc/avr/8.1.0/../../../../avr/include/c++/8.1.0/backward"
ignoring nonexistent directory"/usr/bin/../lib/gcc/avr/8.1.0/../../../../avr/sys-include"
ignoring nonexistent directory"/usr/bin/../lib/gcc/avr/8.1.0/../../../../avr/include"
ignoring nonexistent directory"/usr/bin/../lib/gcc/../../lib/gcc/avr/8.1.0/../../../../avr/include/c++/8.1.0"
ignoring nonexistent directory"/usr/bin/../lib/gcc/../../lib/gcc/avr/8.1.0/../../../../avr/include/c++/8.1.0/avr/avr6"
ignoring nonexistent directory"/usr/bin/../lib/gcc/../../lib/gcc/avr/8.1.0/../../../../avr/include/c++/8.1.0/backward"
ignoring duplicate directory"/usr/bin/../lib/gcc/../../lib/gcc/avr/8.1.0/include"
ignoring duplicate directory"/usr/bin/../lib/gcc/../../lib/gcc/avr/8.1.0/include-fixed"
ignoring nonexistent directory"/usr/bin/../lib/gcc/../../lib/gcc/avr/8.1.0/../../../../avr/sys-include"
ignoring nonexistent directory"/usr/bin/../lib/gcc/../../lib/gcc/avr/8.1.0/../../../../avr/include"
#include"..." search starts here:
#include <...> search starts here:
 /media/Data/Eigene_Dateien/Valentins_Dateien/Projekte/Software/ATmighty/src/ATmighty
 /usr/bin/../lib/gcc/avr/8.1.0/include
 /usr/bin/../lib/gcc/avr/8.1.0/include-fixed
End of search list.
GNU C++11 (GCC) version 8.1.0 (avr)
    compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Versions of loaded plugins:
 avr-flash-vtbl: Unknown version.
Compiler executable checksum: 7b8fe0c14755945b805e4422187df660
COLLECT_GCC_OPTIONS='-I' '/media/Data/Eigene_Dateien/Valentins_Dateien/Projekte/Software/ATmighty/src/ATmighty' '-Wall' '-g2' '-gstabs' '-Os' '-ffunction-sections' '-fdata-sections' '-fno-exceptions' '-std=c++11'  '-D' 'F_CPU=16000000UL' '-MMD' '-MP' '-MF' 'main.d' '-MT' 'main.o' '-c' '-o' 'main.o' '-v' '-specs=device-specs/specs-atmega2560' '-mmcu=avr6'
 as -mmcu=avr6 -mgcc-isr -mno-skip-bug -o main.o /tmp/ccLavHFh.s
as: Unbekannte Option ??-mmcu=avr6??


勇敢,您可能只是粉碎了安装。

  • 例如,如果您不确定101%正在做什么,请在$ HOME中的某个位置使用--prefix。

  • 切勿将文件复制到现有安装中。除了您更喜欢混乱。

  • 始终(类似于ALWAYS)在源树之外进行配置(不支持在源树中进行配置)。

  • 解决您的问题:配置GCC --target = avr时,avr-as和avr-ld必须位于PATH中(也许其他Binutils也像avr-ranlib等。)或者,当您还在构建avr时-Binutils,您可以:configure-build-install avr-Binutils,然后使用与Binutils类似的--prefix配置GCC。如果configure找不到目标as,则仅使用as。您可以从配置启动的位置(在前100行中)以及相应的config.log中看到这一点。