"invalid option" error while building gcc as a cross-compiler

"invalid option" error while building gcc as a cross-compiler

Post by Scott Alft » Mon, 04 Jun 2001 03:43:28



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Since the Debian install on my Quadra 610 is a bit poky, I figured I'd try
putting together an LFS (Linux From Scratch) system for it, optimized for
the 68040 instead of whatever optimization Debian uses.  I already have an
x86 LFS system running on a homebrew K6-III box, so I figured I'd use the
instructions in the CrossGCC FAQ to build up a 68K compiler and go from
there.

binutils-2.11 compiled with no problem, but gcc-2.95.3 bombs out when it
gets to SYSCALLS.c:

/home/salfter/gcc-m68k/build-gcc/gcc/xgcc -B/home/salfter/gcc-m68k/build-gc
c/gcc/ -B/usr/local/gcc-m68k/m68k-mac-linux-gnu/bin/ -I/usr/local/gcc-m68k/
m68k-mac-linux-gnu/include -DCROSS_COMPILE -DIN_GCC -O2 -march=i586 -fomit-
frame-pointer -I./include -I. -I../../gcc-2.95.3/gcc -I../../gcc-2.95.3/gcc
/config -I../../gcc-2.95.3/gcc/../include -aux-info SYSCALLS.c.X -S -o tmp-
SYSCALLS.s SYSCALLS.c
cc1: Invalid option `arch=i586'
make[1]: *** [SYSCALLS.c.X] Error 1
make[1]: Leaving directory `/home/salfter/gcc-m68k/build-gcc/gcc'
make: *** [all-gcc] Error 2

The following environment variables are set:

host    i586-pc-linux-gnu
target  m68k-mac-linux-gnu
prefix  /usr/local/gcc-m68k
i       /usr/local/gcc-m68k/bin
CFLAGS  -O2 -march=i586 -fomit-frame-pointer

Originally, CFLAGS included -march=k6 instead of -march=i586, as I usually
optimize binaries for the AMD processors that I run.  Leaving out -march=___
altogether lets the compile process go further, but eventually it conks out
again:

for name in _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 _lshrdi3 _ash
ldi3 _ashrdi3 _ffsdi2 _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf
_floatdisf _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfd
i _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatdi
tf __gcc_bcmp _varargs __dummy _eprintf _bb _shtab _clear_cache _*oline
 __main _exit _ctors _pure; \
do \
  echo ${name}; \
  /home/salfter/gcc-m68k/build-gcc/gcc/xgcc -B/home/salfter/gcc-m68k/build-
gcc/gcc/ -B/usr/local/gcc-m68k/m68k-mac-linux-gnu/bin/ -I/usr/local/gcc-m68
k/m68k-mac-linux-gnu/include -O2  -DCROSS_COMPILE -DIN_GCC     -O2 -fomit-f
rame-pointer -I./include  -fPIC -g1  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
  -I. -I../../gcc-2.95.3/gcc -I../../gcc-2.95.3/gcc/config -I../../gcc-2.95
.3/gcc/../include -c -DL${name} \
       ../../gcc-2.95.3/gcc/libgcc2.c -o ${name}.o; \
  if [ $? -eq 0 ] ; then true; else exit 1; fi; \
  m68k-mac-linux-gnu-ar rc tmplibgcc2.a ${name}.o; \
  rm -f ${name}.o; \
done
_muldi3
../../gcc-2.95.3/gcc/libgcc2.c:41: stdlib.h: No such file or directory
../../gcc-2.95.3/gcc/libgcc2.c:42: unistd.h: No such file or directory
make[1]: *** [libgcc2.a] Error 1
make[1]: Leaving directory /home/salfter/gcc-m68k/build-gcc/gcc'
make: *** [all-gcc] Error 2

These files, of course, are in /usr/include, so why would it be complaining
about these files being missing?

  _/_
 / v \
(IIGS(  Scott Alfter (remove Voyager's hull number for email address)
 \_^_/  http://www.veryComputer.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.veryComputer.com/

iD8DBQE7GTQyVgTKos01OwkRAg01AJ4qOLBe773Qd+AC14JRBwBXDujRLQCgt1yO
Z31mqRSSNMMqrJX8POzLShc=
=5AcF
-----END PGP SIGNATURE-----

 
 
 

"invalid option" error while building gcc as a cross-compiler

Post by Roman Zippe » Mon, 04 Jun 2001 18:51:50


Hi,


> host    i586-pc-linux-gnu
> target  m68k-mac-linux-gnu
> prefix  /usr/local/gcc-m68k
> i       /usr/local/gcc-m68k/bin
> CFLAGS  -O2 -march=i586 -fomit-frame-pointer

> Originally, CFLAGS included -march=k6 instead of -march=i586, as I usually
> optimize binaries for the AMD processors that I run.  Leaving out -march=___
> altogether lets the compile process go further, but eventually it conks out
> again:

> for name in _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 _lshrdi3 _ash
> ldi3 _ashrdi3 _ffsdi2 _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf
> _floatdisf _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfd
> i _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatdi
> tf __gcc_bcmp _varargs __dummy _eprintf _bb _shtab _clear_cache _*oline
>  __main _exit _ctors _pure; \
> do \
>   echo ${name}; \
>   /home/salfter/gcc-m68k/build-gcc/gcc/xgcc -B/home/salfter/gcc-m68k/build-
> gcc/gcc/ -B/usr/local/gcc-m68k/m68k-mac-linux-gnu/bin/ -I/usr/local/gcc-m68
> k/m68k-mac-linux-gnu/include -O2  -DCROSS_COMPILE -DIN_GCC     -O2 -fomit-f
> rame-pointer -I./include  -fPIC -g1  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
>   -I. -I../../gcc-2.95.3/gcc -I../../gcc-2.95.3/gcc/config -I../../gcc-2.95
> .3/gcc/../include -c -DL${name} \
>        ../../gcc-2.95.3/gcc/libgcc2.c -o ${name}.o; \
>   if [ $? -eq 0 ] ; then true; else exit 1; fi; \
>   m68k-mac-linux-gnu-ar rc tmplibgcc2.a ${name}.o; \
>   rm -f ${name}.o; \
> done
> _muldi3
> ../../gcc-2.95.3/gcc/libgcc2.c:41: stdlib.h: No such file or directory
> ../../gcc-2.95.3/gcc/libgcc2.c:42: unistd.h: No such file or directory
> make[1]: *** [libgcc2.a] Error 1
> make[1]: Leaving directory /home/salfter/gcc-m68k/build-gcc/gcc'
> make: *** [all-gcc] Error 2

> These files, of course, are in /usr/include, so why would it be complaining
> about these files being missing?

The cross compiler is looking for the native headers, copy them from
your mac and put them into $prefix/$target/include. You might hit
another problem, where the cross compiler can't find the headers, you
have to manually create the installation directory
$prefix/lib/gcc-lib/$target/2.95.3, since the cross compiler tries to
find the system headers relative to this directory.

bye, Roman

 
 
 

"invalid option" error while building gcc as a cross-compiler

Post by Jim Walli » Mon, 04 Jun 2001 21:18:09



> The following environment variables are set:

> host    i586-pc-linux-gnu
> target  m68k-mac-linux-gnu
> prefix  /usr/local/gcc-m68k
> i       /usr/local/gcc-m68k/bin
> CFLAGS  -O2 -march=i586 -fomit-frame-pointer

> Originally, CFLAGS included -march=k6 instead of -march=i586, as I usually
> optimize binaries for the AMD processors that I run.  Leaving out -march=___
> altogether lets the compile process go further, but eventually it conks out
> again:

Sounds like -march should refer to the destination system, i.e. m68k,
rather than the build system.

I had some success with cross-compiling a while ago but I can't remember
what source I used or what modifications I had to do. Try searching the
ng archives for a post by Ross Vumbaca about cross-compiling, I'm sure
it's where I got most of my tips from!

JIM

 
 
 

1. gcc "make error" when building a linux-x-djgpp cross compiler

This is the log file from running "make > make.log 2>&1" under gcc build
directory.
Can anyone explain to me the error that follows:

gcc -DCROSS_COMPILE -DIN_GCC     -g -O2  -DHAVE_CONFIG_H  -o collect2
collect2.o tlink.o hash.o intl.o underscore.o version.o
obstack.o        ../libiberty/libiberty.a
cp xgcc gcc-cross
/usr/src/djgpp/cross/gcc/gcc/xgcc -B/usr/src/djgpp/cross/gcc/gcc/
-B/usr/local/i586-pc-msdosdjgpp/bin/
-I/usr/local/i586-pc-msdosdjgpp/include -dumpspecs > tmp-specs
mv tmp-specs specs
echo "void __foo () {}" > dummy.c
/usr/src/djgpp/cross/gcc/gcc/xgcc -B/usr/src/djgpp/cross/gcc/gcc/
-B/usr/local/i586-pc-msdosdjgpp/bin/
-I/usr/local/i586-pc-msdosdjgpp/include -DCROSS_COMPILE -DIN_GCC     -g
-O2 -I./include  -c dummy.c
i586-pc-msdosdjgpp-ar rc libgcc1.null dummy.o
make[1]: i586-pc-msdosdjgpp-ar: Command not found
make[1]: *** [libgcc1.null] Error 127
make[1]: Leaving directory `/usr/src/djgpp/cross/gcc/gcc'
make: *** [all-gcc] Error 2

I have the file "i586-pc-msdosdjgpp-ar" sitting in my /usr/local/bin and

/usr/local/i586-pc-msdosdjgpp/bin directories. Can you tell me why it is

not finding it.

2. MIME decode form file

3. Compiling Tulip.c for LINKSYS Network Card giving error "Invalid option -WStrict-prototypes"

4. strange segmentation fault with var in main

5. bootdisk "crc error" or "invalid compressed format"?

6. Redhat and PPP

7. GETSERVBYNAME()????????????????????"""""""""""""

8. Remote boot - swaping between kernels versions

9. Anyone Built a GCC Cross-Compiler?

10. Building GCC as Solaris2.4 -> SunOS4.1.3 cross-compiler

11. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""

12. gcc error - "Unrecognized option -Qy"

13. Error GCC with option "-Qy"