cross compile gcc 10.1.0 on linux for avr fails

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

cross compile gcc 10.1.0 on linux for avr fails

Klaus Rudolph
I try to compile gcc 10.1.0 for target avr. If fails with:


make[2]: Entering directory
'/home/krud/git_my_checkout/first/own_components/gcc_install/gcc/gcc-10.1.0/build/gcc'
g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions
-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing
-Wwrite-strings -Wcast-qual -Wno-error=format-diag
-Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long
-Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H
-DGENERATOR_FILE -fno-PIE -I. -Ibuild -I../../gcc -I../../gcc/build
-I../../gcc/../include  -I../../gcc/../libcpp/include  \
     -o build/genmodes.o ../../gcc/genmodes.c
/opt/avr_10.1.0/avr/bin/as: unrecognized option '--64'


As I see it tries to use gcc to compile and link with avr-as which is
wrong. What did I wrong?


I simply do
make binutils
make gcc
with the following makefile




PREFIX=/opt
VERSION_BINUTILS=2.34
VERSION_GCC=10.1.0
GCC_DOWNLOAD_SUBDIR=gcc-10.1.0
MPC_VERSION=1.0.3
MPFR_VERSION=3.1.4
GMP_VERSION=6.1.0

binutils:
     mkdir binutils
     ( cd binutils; \
         wget https://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.xz; \
         tar xf binutils-2.34.tar.xz ; \
         cd binutils-2.34 ; \
         mkdir build ; \
         cd build ; \
         ../configure --target=avr --prefix=$(PREFIX)/avr_$(VERSION_GCC) ;\
         make -j8 ; \
         sudo make install ; \
         )

gcc:
     mkdir gcc
     ( cd gcc; \
         wget
https://ftp.gnu.org/gnu/gcc/$(GCC_DOWNLOAD_SUBDIR)/gcc-$(VERSION_GCC).tar.xz
; \
         tar xf gcc-$(VERSION_GCC).tar.xz ; \
         cd gcc-$(VERSION_GCC)/ ; \
         wget
https://gcc.gnu.org/pub/gcc/infrastructure/mpc-$(MPC_VERSION).tar.gz ; \
         tar xf mpc-$(MPC_VERSION).tar.gz ; \
         mv mpc-$(MPC_VERSION) ./mpc ; \
         wget
https://gcc.gnu.org/pub/gcc/infrastructure/mpfr-$(MPFR_VERSION).tar.bz2 ; \
         tar xf mpfr-$(MPFR_VERSION).tar.bz2 ; \
         mv mpfr-$(MPFR_VERSION) ./mpfr ; \
         wget
https://gcc.gnu.org/pub/gcc/infrastructure/gmp-$(GMP_VERSION).tar.bz2 ; \
         tar xf gmp-$(GMP_VERSION).tar.bz2 ; \
         mv gmp-$(GMP_VERSION) ./gmp ; \
         mkdir build ; \
         cd build ; \
         ../configure --prefix=$(PREFIX)/avr_$(VERSION_GCC) --target=avr
--enable-languages=c,c++ --enable-lto --disable-nls --disable-libssp ; \
         make -j8 ; \
         sudo make install ; \
         )


Reply | Threaded
Open this post in threaded view
|

Re: cross compile gcc 10.1.0 on linux for avr fails

Senthil Kumar
That is odd - are you able to compile a bare bones C++ file with the
g++ you're using to build avr-gcc?

Regards
Senthil

On Thu, Jul 16, 2020 at 2:09 PM Klaus Rudolph <[hidden email]> wrote:

>
> I try to compile gcc 10.1.0 for target avr. If fails with:
>
>
> make[2]: Entering directory
> '/home/krud/git_my_checkout/first/own_components/gcc_install/gcc/gcc-10.1.0/build/gcc'
> g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions
> -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing
> -Wwrite-strings -Wcast-qual -Wno-error=format-diag
> -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long
> -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H
> -DGENERATOR_FILE -fno-PIE -I. -Ibuild -I../../gcc -I../../gcc/build
> -I../../gcc/../include  -I../../gcc/../libcpp/include  \
>      -o build/genmodes.o ../../gcc/genmodes.c
> /opt/avr_10.1.0/avr/bin/as: unrecognized option '--64'
>
>
> As I see it tries to use gcc to compile and link with avr-as which is
> wrong. What did I wrong?
>
>
> I simply do
> make binutils
> make gcc
> with the following makefile
>
>
>
>
> PREFIX=/opt
> VERSION_BINUTILS=2.34
> VERSION_GCC=10.1.0
> GCC_DOWNLOAD_SUBDIR=gcc-10.1.0
> MPC_VERSION=1.0.3
> MPFR_VERSION=3.1.4
> GMP_VERSION=6.1.0
>
> binutils:
>      mkdir binutils
>      ( cd binutils; \
>          wget https://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.xz; \
>          tar xf binutils-2.34.tar.xz ; \
>          cd binutils-2.34 ; \
>          mkdir build ; \
>          cd build ; \
>          ../configure --target=avr --prefix=$(PREFIX)/avr_$(VERSION_GCC) ;\
>          make -j8 ; \
>          sudo make install ; \
>          )
>
> gcc:
>      mkdir gcc
>      ( cd gcc; \
>          wget
> https://ftp.gnu.org/gnu/gcc/$(GCC_DOWNLOAD_SUBDIR)/gcc-$(VERSION_GCC).tar.xz
> ; \
>          tar xf gcc-$(VERSION_GCC).tar.xz ; \
>          cd gcc-$(VERSION_GCC)/ ; \
>          wget
> https://gcc.gnu.org/pub/gcc/infrastructure/mpc-$(MPC_VERSION).tar.gz ; \
>          tar xf mpc-$(MPC_VERSION).tar.gz ; \
>          mv mpc-$(MPC_VERSION) ./mpc ; \
>          wget
> https://gcc.gnu.org/pub/gcc/infrastructure/mpfr-$(MPFR_VERSION).tar.bz2 ; \
>          tar xf mpfr-$(MPFR_VERSION).tar.bz2 ; \
>          mv mpfr-$(MPFR_VERSION) ./mpfr ; \
>          wget
> https://gcc.gnu.org/pub/gcc/infrastructure/gmp-$(GMP_VERSION).tar.bz2 ; \
>          tar xf gmp-$(GMP_VERSION).tar.bz2 ; \
>          mv gmp-$(GMP_VERSION) ./gmp ; \
>          mkdir build ; \
>          cd build ; \
>          ../configure --prefix=$(PREFIX)/avr_$(VERSION_GCC) --target=avr
> --enable-languages=c,c++ --enable-lto --disable-nls --disable-libssp ; \
>          make -j8 ; \
>          sudo make install ; \
>          )
>
>