More NT cross Linux compiler stuff :-)

Kai Ruottu karuottu@freenet.hut.fi
Tue Jun 29 02:19:00 GMT 1999


Curt wrote:

> So, my question is, why is it trying to invoke the Cygwin (NT) cross Linux
> compiler?

 It doesn't try to invoke the Cygwin-host one, just "the compiler to 
produce binaries for the target". The default name is the '<target>-gcc'.
In a general case the target compiler isn't the same as the build 
compiler.

> Shouldn't it only be using i686-cygwin32-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?

 No, you generally need three toolsets -- the "Canadian Cross" has three 
something... First, a toolset to produce binaries for the build machine, Linux 
in this case. Second, a toolset to produce binaries for the host machine, 
Cygwin in this case. And third, a toolset to produce binaries for the target, 
Linux in this case.... Normally the third is just a cross-compiler for the 
target.

 The build compiler is needed to compile those 'gen*' executables, which read
the target 'machine description' (.md) file and produce all kind of 'gen-*.c' 
sources. It's version hasn't much influence...

 The host compiler is needed to compile binaries for the host machine. Its 
version hasn't much influence either...

 The target toolset tries to produce the 'crtbegin*.o', 'crtend*.o', 
'libgcc.a', 'libstdc++.a' etc. for the target. AND... You MUST have just 
the same version of GCC to produce the target binaries as your GCC sources are!
If you haven't, you are in a trouble... Compiling the C++ class-libraries needs
just as modern compiler as the sources are...

 If you have egcs-1.1.2 as the native-Linux compiler, just use the egcs-1.1.2 
sources to produce the Cygwin-to-Linux GCC. It is really sad if you used the 
old ('buggy') egcs-1.1 sources from Cygwin-b20.1 release and not the egcs-1.1.2 
sources, with the Mumit Khan's Cygwin/Mingw32-patches, as the 'raw material'...

 If you already have a toolset for the target, producing all the libs is of 
course higly redundant, but a way to hunt bugs. If it produces quite different 
sized libs from the current ones, there is something wrong...
 
> I tried changing the section of the Makefile shown above to use $(CC)
> instead of $(GCC_FOR_TARGET).

 This was ok if you changed the definition, not only in one rule... 
And hopefully your native GCC was the same version as the sources.

> 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.

 In egcs-sources there are the Makefile in the main directory and the Makefile
in the gcc subdir. The GCC_FOR_TARGET, CC_FOR_TARGET and CXX_FOR_TARGET must be
changed there to be 'gcc' (or 'g++'). I have the GCCs coming with the base 
Linux-distribution as 'gcc/g++', and egcs-1.1.2-versions as 'g*-linux' (for 
libc5) and 'g*-linux-gnu' (for libc6). So my 'Linux-target' egcs-1.1.2-compiler 
is different from my 'native' one...

 Normally the '*_FOR_TARGET' definitions are very complex scripts checking all 
possible incarnations of '<target>-gcc' and it is a great joy to delete all 
the ugly stuff away (or just a nuisance to do it for the hundredth time when 
telling all the '*_FOR_TARGET' stuff to configure has no influence ;-)

Cheers, Kai
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.


More information about the crossgcc mailing list