More NT cross Linux compiler stuff :-)

Curt Moffitt
Wed Jun 23 17:39:00 GMT 1999

Hi all,

Thanks to people's help, I'm making more headway on the NT cross compiler
for Linux that I'm trying to build.  :-)   Sorry I have to bother the list
again, but I have hit another problem that I need to ask about.  But first,
here's re-cap of what I've done / tried so far:

1.  I placed the cygwin distribution (20.1) on my Linux machine and untarred
creating a src directory.  Using Mumit Khan's instructions, I then created a
CROSS directory in the same directory as src, cd'd into it and ran:

../src/configure --prefix=/usr/local/cygb20 --target=i686-cygwin32 -v

2. Then I ran:

make > make.log 2>&1

but a compilation error occurred.  I fixed that and ran make again -
everything compiled!  So, theoretically I have a Linux cross Cygwin toolset
that I can use to create the actual Cygwin (NT) cross Linux compiler.  In
order to build it, I did these steps:

3.  Added '/usr/local/cygb20' to my PATH,
    set LD_LIBRARY_PATH=/usr/local/cygb20/lib  and
    set LD_LIBRARY_PATH=/usr/local/cygb20/lib

4.  Created a LINUX dir in the same dir as src, cd'd into it and ran:

../src/configure --prefix=/cygnus/cygwin-b20 --build=i486-linux-gnu
--target=i486-linux-gnu --host=i686-cygwin32

Everything seemed to configure ok except for one strange message:

Configuring dosrel...
** HEY **
DOSREL not been tested for i486-pc-linux-gnu yet.
Some bits may not be prepared correctly.
eg. multilib stuff will be missing
and the demo will be dull

5.  I ignored that error and ran:  make > make.log 2>&1

Which died with an error:

i686-cygwin32-gcc -DHAVE_CONFIG_H -I. -I../../src/ld -I. -D_GNU_SOURCE -I.
-I../../src/ld -I../bfd -I../../src/ld/../bfd -I../../src/ld/../include
-I../../src/ld/../intl -I../intl  -g -O2
-DLOCALEDIR="\"/cygnus/cygwin-b20/share/locale\""    -g -O2 -c eelf_i386.c
eelf_i386.c:641: unbalanced `#endif'
make[1]: *** [eelf_i386.o] Error 1

6.  I removed the offending #endif, and did a make again.  I makes for a
while and then dies here:

cat ../../src/gcc/sys-types.h ../../src/gcc/sys-protos.h > SYSCALLS.c
i486-linux-gnu-gcc -DCROSS_COMPILE -DIN_GCC    -g -O2 -I./include     -I.
-I../../src/gcc -I../../src/gcc/config \
  -aux-info SYSCALLS.c.X -S -o tmp-SYSCALLS.s SYSCALLS.c
make[1]: i486-linux-gnu-gcc: Command not found
make[1]: *** [SYSCALLS.c.X] Error 127

7.  I looked at the Makefile and here is the section that it was making:

# This info describes the target machine, so compile with GCC just built.
SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \
	-rm -f SYSCALLS.c tmp-SYSCALLS.s
	cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
	  -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
	-rm -f SYSCALLS.c tmp-SYSCALLS.s

So, my question is, why is it trying to invoke the Cygwin (NT) cross Linux
compiler?  Shouldn't it only be using i686-cygwin32-gcc?  That is, shouldn't
it be using the compiler created in steps 1 & 2, which is the compiler that
actually does get invoked most of the time during steps 5 - 7?  In fact,
i686-cygwin32-gcc is used like 90% of the time, and other 10% it uses the
Linux native compiler (gcc).  I don't know exactly why it uses gcc
sometimes, but it is definately strange that it would try to invoke
i486-linux-gnu-gcc.  From what I understand, that is actually the NT cross
Linux compiler, and thus should only run on my NT machine, correct?  Have I
missed something here?

I tried changing the section of the Makefile shown above to use $(CC)
instead of $(GCC_FOR_TARGET).  I ran make again and it compiled ok at that
part, but then died again here:

echo "int xxy_us_dummy;" >tmp-dum.c
i486-linux-gnu-gcc -S tmp-dum.c
make[1]: i486-linux-gnu-gcc: Command not found
make[1]: *** [s-under] Error 127

Which looks like exactly the same problem because it uses $(GCC_FOR_TARGET)
in the Makefile.  So, now I'm really wondering whether or not that was the
right thing to do.  If so, it looks like I'll have to fix lots of spots in
the Makefile in the same way.  Does anyone know if this is the right fix, or
am I really messing this up by trying to do damage control and patch all
kinds of little things like this?

Thanks alot (again),

New CrossGCC FAQ:
To remove yourself from the crossgcc list, send
mail to with the
text 'unsubscribe' (without the quotes) in the
body of the message.

More information about the crossgcc mailing list