Bug 54996

Summary: gcc with --target=avr fails to build
Product: gcc Reporter: lvd.mhm
Component: targetAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P3    
Version: 4.7.2   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description lvd.mhm 2012-10-20 07:48:04 UTC
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
Comment 1 Andrew Pinski 2012-10-20 07:56:38 UTC
You need to have the assembler in the PATH while you are configuring GCC also.
Comment 2 lvd.mhm 2012-10-28 15:25:28 UTC
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.
Comment 3 lvd.mhm 2012-10-28 15:27:04 UTC
up
Comment 4 Georg-Johann Lay 2012-11-01 08:26:21 UTC
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.