1

I want to use the newest version of avr-gcc (8.1.0) for a new project, which is not available from ubuntu's package-manager. So I compiled it myself using the build-script from this site: https://gist.github.com/zkemble/edec6914ba719bf339b1b85c1fa792dc (I'm working under Ubuntu 16.04, so I set BUILD_WIN32=0 and BUILD_WIN64=0 to just build the linux-version)

After the compilation completed sucessfully I tried to make it available for use by manually copying the output files and directorys as following: (replacing the preexisting files when named identically)

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

It was kind of trial and error, maybe some of the path are wrong, but it seemed reasonable when comparing to the old files from the old gcc-installation. avr-g++ -v gives me the correct version "gcc version 8.1.0 (GCC)".

(I use eclipse oxygen as the IDE, so the following commands are autogenerated, please excuse the bloated command) - When compiling my project using

    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"

I get the following error: as: Unknown option: »-mmcu=avr6«. (See below for full verbose output).

It seems that the new avr-g++ compiler doesn't use the correct avr-as file and uses the hosts default as assembler instead. But avr-as lies in \usr\bin\, the same folder where as is located.

How can I set up the avr-g++ 8.1.0-toolchain to work correctly? I actually want to try out some of the new avr-g++ features and the default version from the official repository is really old (some 4.x version)

Full avr-g++ output:

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«
DocValle
  • 125
  • 2
  • 10
  • 1
    Sounds like a number of flawed assumptions - you want a separate AVR-GCC / libc / avrdude infrastructure. You want to keep the AVR toolchain out of the way until (you've at least entered a new shell level) and set your PATH / LIBRARY_PATH appropriately. Here's [my](https://github.com/brettyhale/AVR-OSX-and-Olimex-ISP-MK2) installation. – Brett Hale Sep 08 '18 at 07:40
  • Thanks for the Link Brett, I will take a look at your solution as soon as I have time for this project again. – DocValle Sep 09 '18 at 17:03

1 Answers1

1

Brave, you might just have shredded your installation.

  • If you are not 101% sure what you are doing, use a --prefix somewhere in your $HOME, for example.

  • NEVER copy files into an existing installation. Except you prefer mess.

  • Always (like in ALWAYS) configure outside the source tree (configuring GCC in the source tree is not supported).

  • Ad your problem: When GCC is being configured --target=avr, avr-as and avr-ld must be in the PATH (maybe also other Binutils like avr-ranlib etc.) Alternatively, when your are also building avr-Binutils, you can: configure-build-install avr-Binutils and then configure GCC with the same --prefix like Binutils. If configure does not find the target as, it is just using as. You see this from what configure is babbling (somewhere in to top 100 lines) and also from the respective config.log.

emacs drives me nuts
  • 2,785
  • 13
  • 23
  • Thanks for the useful informations. In the meantime I have upgraded the OS of my machine and only installed the new g++ version, so the mess is gone. But I accepted your answer anyway, as the question is really old and your answer seems helpful for anyone with similar problems... ;) – DocValle Jan 09 '20 at 18:08