Re: Build gcc 10.3.0 for avr on a amd64 linux host

Senthil Kumar <[email protected]> Sun, 23 May 2021 20:09:08 +0530
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <CABvNLJt7r9rwHCbH7xoKS7LdcYpj=mwyd3T+TTQxp0bsc71mVA@mail.gmail.com>
On Sun, May 23, 2021 at 12:47 PM BERTRAND Jo=C3=ABl
<[email protected]> wrote:
>
> Senthil Kumar a =C3=A9crit :
> > On Sat, May 22, 2021 at 1:21 AM BERTRAND Jo=C3=ABl <joel.bertrand@syste=
lla.fr> wrote:
> >>
> >>         Hello,
> >>
> >>         I'm trying to build a recent gcc to check if my issue comes fr=
om
> >> compiler or not. Thus, I have downloaded gcc 10.3.0 sources. Of course=
,
> >> on my debian/testing workstation, I have avr avr-binutils and avr-libc=
.
> >>
> >>         I have configured gcc with :
> >>
> >> hilbert:[~/cvs/cross-gcc/build] > ../gcc-10.3.0/configure -v
> >> --enable-languages=3Dc,c++,fortran --prefix=3D/home/bertrand/cvs/cross=
-gcc
> >> --disable-nls --disable-libssp --target=3Davr --with-dwarf2
> >>
> >> but build process hangs with :
> >>
> >> make[3] : on quitte le r=C3=A9pertoire
> >> =C2=AB /home/bertrand/cvs/cross-gcc/build/avr/libgcc =C2=BB
> >> make[2] : on quitte le r=C3=A9pertoire
> >> =C2=AB /home/bertrand/cvs/cross-gcc/build/avr/libgcc =C2=BB
> >> Checking multilib configuration for libbacktrace...
> >> Configuring in avr/libbacktrace
> >> configure: loading cache ./config.cache
> >> checking build system type... x86_64-pc-linux-gnu
> >> checking host system type... avr-unknown-none
> >> checking target system type... avr-unknown-none
> >> checking for avr-gcc... /home/bertrand/cvs/cross-gcc/build/./gcc/xgcc
> >> -B/home/bertrand/cvs/cross-gcc/build/./gcc/
> >> -B/home/bertrand/cvs/cross-gcc/avr/bin/
> >> -B/home/bertrand/cvs/cross-gcc/avr/lib/ -isystem
> >> /home/bertrand/cvs/cross-gcc/avr/include -isystem
> >> /home/bertrand/cvs/cross-gcc/avr/sys-include
> >> checking whether the C compiler works... no
> >> configure: error: in `/home/bertrand/cvs/cross-gcc/build/avr/libbacktr=
ace':
> >> configure: error: C compiler cannot create executables
> >> See `config.log' for more details
> >> make[1]: *** [Makefile:12412 : configure-target-libbacktrace] Erreur 1
> >> make[1] : on quitte le r=C3=A9pertoire =C2=AB /home/bertrand/cvs/cross=
-gcc/build =C2=BB
> >> make: *** [Makefile:938 : all] Erreur 2
> >> hilbert:[~/cvs/cross-gcc/build] >
> >>
> >>         Config log contains:
> >> configure:3078: /home/bertrand/cvs/cross-gcc/build/./gcc/xgcc
> >> -B/home/bertrand/cvs/cross-gcc/build/./gcc/
> >> -B/home/bertrand/cvs/cross-gcc/avr/bin/
> >> -B/home/bertrand/cvs/cross-gcc/avr/lib/ -isystem
> >> /home/bertrand/cvs/cross-gcc/avr/include -isystem
> >> /home/bertrand/cvs/cross-gcc/avr/sys-include    -g -O2   conftest.c  >=
&5
> >> /usr/bin/avr-ld: cannot find -lm
> >> /usr/bin/avr-ld: cannot find -lc
> >> collect2: error: ld returned 1 exit status
> >> configure:3082: $? =3D 1
> >> configure:3120: result: no
> >> configure: failed program was:
> >> | /* confdefs.h */
> >> | #define PACKAGE_NAME "package-unused"
> >> | #define PACKAGE_TARNAME "libbacktrace"
> >> | #define PACKAGE_VERSION "version-unused"
> >> | #define PACKAGE_STRING "package-unused version-unused"
> >> | #define PACKAGE_BUGREPORT ""
> >> | #define PACKAGE_URL ""
> >> | /* end confdefs.h.  */
> >> |
> >> | int
> >> | main ()
> >> | {
> >> |
> >> |   ;
> >> |   return 0;
> >> | }
> >> configure:3125: error: in
> >> `/home/bertrand/cvs/cross-gcc/build/avr/libbacktrace':
> >> configure:3127: error: C compiler cannot create executables
> >> See `config.log' for more details
> >>
> >>         OK. xgcc tries to build an avr executable and doesn't find lib=
m and
> >> libc. But even if I add LDFLAGS on configure command line, make always
> >> returns this error. I suppose I have done a mistake...
> >
> > Did you try building and installing avr-libc also at the same --prefix =
location?
>
>         No, avr-libc is installed in /usr/lib/avr, but I have tried to ad=
d
> LDFLAGS on configure command line without any success.

LDFLAGS, CFLAGS etc.. are used when building the binary that runs on
the host (i.e xgcc in your example). I haven't tried building gcc
against avr-libc installed at a different prefix, but could you try
BOOT_LDFLAGS and see if it helps?
>
>         I have tried to build cross compiler with ct-ng also without any
> success (from gcc 6.x to 11.x). Same error. ct-ng builds its own
> avr-libc and doesn't use system avr-libc.

I haven't used that tool either. I'll try building gcc 10.3 from
scratch tonight and post the steps I used.

>
>         Best regards,
>
>         JB