Bug 54996 - gcc with --target=avr fails to build
Summary: gcc with --target=avr fails to build
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.7.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2012-10-20 07:48 UTC by lvd.mhm
Modified: 2012-11-01 08:26 UTC (History)
0 users

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
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)
built like:
./configure --prefix=/tmp/abu --program-prefix=avr- --target=avr
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
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.