0

I am trying to setup my development toolchain for AVR in Debian Linux, from source donwloaded directly from gnu.org, latest versions.

I am stocked in this step:

#./configure --target-avr --program-prefix='avr-'
# make

Configure terminates well building my Makefile. However, make gives me a lot of compilation errors similar to this:
----------------------------------------------------------------------------------------
In file included from ./fopen_unlocked.c:76:
/usr/include/stdio_ext.h:46:15: error: old-style parameter declarations in prototyped function definition
   46 | extern size_t __fbufsize (FILE *__fp) __THROW;
      |               ^~~~~~~~~~
./fopen_unlocked.c:129: error: expected ‘{’ at end of input
  129 | }
      | 
./fopen_unlocked.c:129: warning: control reaches end of non-void function [-Wreturn-type]
  129 | }
------------------------------------------------------------------------------------

It is unthinkable that those source files are wrong, so obviously I am missing something. Any help on this will be appreciated.

  • Why are you trying to build an AVR version of binutils at all? – Joseph Sible-Reinstate Monica Jul 16 '22 at 02:02
  • Because I think I need it (please, correct me if I am wrong). When try to compile a simple avrtest.c source file with avr-gcc (which I build from source), I get this error message: as: unrecognized option '-mmcu=avr2', which make me think that gcc is invoking the wrong assembler (i636 instead of AVR). – Armando Acosta Jul 16 '22 at 02:28
  • Okay, I understand your confusion now. You need binutils with a host architecture of x86 (or whatever your workstation is), that supports a target architecture of avr. You're trying to build binutils with a host architecture of avr, which doesn't make much sense. – Joseph Sible-Reinstate Monica Jul 16 '22 at 03:39
  • Thank you, Joseph, but not sure that is the case. I can run my avr-as in my x86 computer directly so the "host" is definitely x86, no AVR. I can also assembly AVR code with it so it is definitely targeting AVR architecture. The issue here is that avr-gcc is calling the wrong as program, not my new avr-as. The question now is: how I can tell avr-gcc to call the correct (avr-targeted) assembler? (same for the linker and others) – Armando Acosta Jul 19 '22 at 14:25

1 Answers1

0

as: unrecognized option '-mmcu=avr2', which make me think that gcc is invoking the wrong assembler.

Yes. Reason might be that avr-gcc was not configured / built correctly. On some Linux systems there are packages for GNU tools for AVR named binutils-avr, gcc-avr and avr-libc.

Maybe you missed to install the Binutils part? ... no idea why they are using separate packages, they only make sense together.

Anyway, you might also read avr-gcc 8.1.0 uses as instead of avr-as.

emacs drives me nuts
  • 2,785
  • 13
  • 23