Sylvain Leroux schrieb:
Hi,
I'm tying to compile gcc for AVR. configure, make and make install went
smoothly (i.e.: without any /visible/ error) - but I noticed that 'g++'
was installed but not 'gcc'. I spend a lot of time trying and googling
without much progress.
I have all the required dependencies and a working gcc/binutils/libc for
my platform (Debian Squeeze x86_64). Here is my setting:
sh$ export VERSION=4.7.1
sh$ wget "ftp://ftp.gnu.org/gnu/gcc/gcc-${VERSION}/gcc-${VERSION}.tar.bz2"
sh$ tar xjf gcc-${VERSION}.tar.bz2
sh$ mkdir gcc-${VERSION}-build
sh$ cd gcc-${VERSION}-build/
sh$ ../gcc-${VERSION}/configure --prefix=/tmp/gcc-${VERSION} \
--program-prefix=avr-
--program-suffix=-${VERSION} \
--target=avr \
--enable-languages=c,c++
sh$ make -j9
sh$ make install
At this point, when looking in the installation directory, I notice that
'g++' is there, but not 'gcc':
sh$ ls /tmp/gcc-4.7.1/bin/
avr-c++-4.7.1 avr-g++-4.7.1 avr-gcc-nm-4.7.1 avr-gcov-4.7.1
avr-cpp-4.7.1 avr-gcc-ar-4.7.1 avr-gcc-ranlib-4.7.1
*But*, the cross compiler are present in the build directory:
sh$ ls -l gcc/*cross*
-rwxr-xr-x 1 sylvain sylvain 1667242 Jul 17 19:52 gcc/gcc-cross
-rwxr-xr-x 1 sylvain sylvain 1680692 Jul 17 19:52 gcc/g++-cross
By looking at the output of 'make install' I notice an error while
copying gcc-cross:
-------8<----------
rm -f /tmp/gcc-4.7.1/bin/avr-gcc-4.7.1
/usr/bin/install -c xgcc /tmp/gcc-4.7.1/bin/avr-gcc-4.7.1
rm -f /tmp/gcc-4.7.1/bin/avr-gcc-4.7.1
( cd /tmp/gcc-4.7.1/bin && \
ln avr-gcc-4.7.1 avr-gcc-4.7.1 ) <<<<<<< STRANGE ???
ln: accessing `avr-gcc-4.7.1': No such file or directory
make[2]: [install-driver] Error 1 (ignored) <<<<<<< ERROR !!!
if [ -f gcc-cross ] ; then \
if [ -d /tmp/gcc-4.7.1/lib/gcc/avr/4.7.1/../../../../avr/bin/.
] ; then \
rm -f
/tmp/gcc-4.7.1/lib/gcc/avr/4.7.1/../../../../avr/bin/gcc; \
/usr/bin/install -c gcc-cross
/tmp/gcc-4.7.1/lib/gcc/avr/4.7.1/../../../../avr/bin/gcc; \
else true; fi; \
else \
rm -f /tmp/gcc-4.7.1/bin/avr-gcc-tmp; \
( cd /tmp/gcc-4.7.1/bin && \
ln avr-gcc-4.7.1 avr-gcc-tmp && \
mv -f avr-gcc-tmp avr-avr-gcc-4.7.1 ); \
fi
-------8<----------
There is something strange here: the script try to link gcc on itself
(ln avr-gcc-4.7.1 avr-gcc-4.7.1) in the destination folder just after
having removed it if present (rm -f /tmp/gcc-4.7.1/bin/avr-gcc-4.7.1)
and before actually copying it ???
Obviously something went bad there. I suspect I was doing the wrong way
at configure-time: while I reconfigure without
''--program-prefix=avr-'', ''make install'' install ''avr-gcc-4.7.1'' in
the destination directory, but all the other binaries are without the
''avr-'' prefix (like ''g++-4.7.1'').
Anyway, the really puzzling thing here is that in on case it works for
g++ (''avr-g++-4.7.1'') but not gcc - and the other case this is the
opposite... Is there any way to have all the executables installed with
their name rewritten as ''avr-XXXX-4.7.1''?
I would be very grateful for any help or pointer with this issue,
Thanks in advance,
- Sylvain.
You tried without the program suffix?
If you configure without program-suffix and -prefix, the default name of
the compiler will ne avr-gcc and also an avr-gcc-4.7.1 will be installed.
Maybe that coincidence confused the build script?
If you also downloaded the sources to /tmp/gcc-4.7.1 don't install
the compiler to that location.