public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* cross compile gcc 10.1.0 on linux for avr fails
@ 2020-07-16  8:35 Klaus Rudolph
  2020-07-16 23:59 ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Klaus Rudolph @ 2020-07-16  8:35 UTC (permalink / raw)
  To: 'gcc-help@gcc.gnu.org'

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 ; \
         )



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cross compile gcc 10.1.0 on linux for avr fails
  2020-07-16  8:35 cross compile gcc 10.1.0 on linux for avr fails Klaus Rudolph
@ 2020-07-16 23:59 ` Jim Wilson
  2020-07-17  7:58   ` Klaus
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2020-07-16 23:59 UTC (permalink / raw)
  To: Klaus Rudolph; +Cc: gcc-help

On Thu, Jul 16, 2020 at 1:35 AM Klaus Rudolph <lts-rudolph@gmx.de> wrote:
> '/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?

Looks like a PATH environment variable problem.  Do you have "." (dot)
on your path?  In the gcc build tree, we create a script/link called
as for the cross compiler to use.  But if you have dot on your path,
before /usr/bin, then this script/link will be used with the native
gcc instead of the native as, and your build can fail like this.  Also
note that two colons in a row or a colon at the beginning or end of
PATH is the same as having dot on your path.  Putting dot on your path
is a security risk, but if you must do it, put it at the end so it
doesn't accidentally override standard dirs like /bin and /usr/bin.

Jim

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cross compile gcc 10.1.0 on linux for avr fails
  2020-07-16 23:59 ` Jim Wilson
@ 2020-07-17  7:58   ` Klaus
  0 siblings, 0 replies; 3+ messages in thread
From: Klaus @ 2020-07-17  7:58 UTC (permalink / raw)
  To: Jim Wilson; +Cc: gcc-help

Am 17.07.20 um 01:59 schrieb Jim Wilson:
> On Thu, Jul 16, 2020 at 1:35 AM Klaus Rudolph <lts-rudolph@gmx.de> wrote:
>> '/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?
>
> Looks like a PATH environment variable problem.  Do you have "." (dot)
> on your path?

Yepp! That was the problem! After removing it everything works fine!
Thanks a lot!




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-17  7:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  8:35 cross compile gcc 10.1.0 on linux for avr fails Klaus Rudolph
2020-07-16 23:59 ` Jim Wilson
2020-07-17  7:58   ` Klaus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).