Trying to build avr 4.7.2 gcc with following commands: ./configure --target=avr --enable-languages=c --disable-nls --disable-libssp --with-dwarf2 --prefix=/tmp/avrgcc PATH="/tmp/abu/bin:${PATH}" make where /tmp/abu/bin is temporary build of avr binutils: >/tmp/abu/bin/avr-as --version GNU assembler (GNU Binutils) 2.22.90.20120727 built like: ./configure --prefix=/tmp/abu --program-prefix=avr- --target=avr make make install Get an error: /tmp/abu/bin/avr-as: unrecognized option '--64' system used to build: ubuntu 12.04 >uname -a Linux uebuntu 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux >gcc --version gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 >as --version GNU assembler (GNU Binutils for Ubuntu) 2.22
You need to have the assembler in the PATH while you are configuring GCC also.
I was wrong not setting $PATH to just compiled binutils. However, even after setting correct $PATH or just compiling binutils to default /usr/local/bin, problem still persisted. I used clean x86_64 virtual machine with fresh ubuntu12.04.1 server install with just nothing installed except SSH and then packages needed to build binutils and gcc, and I've found, that bug exists when $PATH has ./ at first place. If there is no ./ in $PATH or ./ at the end, gcc compiles fine. Of course then same behavior repeats itself on hardware.
up
Don't configure GCC in the source tree. Read the online documentation on configuring GCC again. If you configured in the GCC sources, remove the sources and retrieve them again to be sure they are not messed up by the configure in the source tree. You must have a working avr-binutils in the path. Alternatively, you can build and install avr binutils with the same --prefix before configuring avr-gcc. You don't need to add it to the path in the latter case. You need binutils 2.23 or higher for avr-gcc 4.7, see the GCC 4.7 release notes.