【问题标题】:avr-gcc 8.1.0 uses `as` instead of `avr-as`avr-gcc 8.1.0 使用 `as` 而不是 `avr-as`
【发布时间】:2018-07-28 14:32:40
【问题描述】:

我想为一个新项目使用最新版本的 avr-gcc (8.1.0),这在 ubuntu 的包管理器中不可用。所以我使用这个站点的构建脚本自己编译了它: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 version 8.1.0 (GCC)”。

(我使用eclipse氧气作为IDE,所以以下命令是自动生成的,请原谅臃肿的命令) - 编译我的项目时使用

    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++ 输出:

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«

【问题讨论】:

  • 听起来像是一些有缺陷的假设——你想要一个单独的 AVR-GCC / libc / avrdude 基础设施。您希望保留 AVR 工具链,直到(您至少进入一个新的 shell 级别)并适当地设置您的 PATH / LIBRARY_PATH。这是my 安装。
  • 感谢 Brett 的链接,一旦我有时间再做这个项目,我会看看你的解决方案。

标签: gcc g++ avr avr-gcc


【解决方案1】:

勇敢,您可能刚刚破坏了您的安装。

  • 如果您不能 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。您可以从 configure 的内容(前 100 行)以及相应的 config.log 中看到这一点。

【讨论】:

  • 感谢您提供有用的信息。与此同时,我已经升级了我的机器的操作系统,只安装了新的 g++ 版本,所以乱七八糟的就没有了。但无论如何我接受了你的回答,因为这个问题真的很老,你的回答似乎对任何有类似问题的人都有帮助...... ;)
猜你喜欢
  • 1970-01-01
  • 2015-12-01
  • 2013-03-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多