Build 32 bit compiler on 64 bit machine

Kai Ruottu karuottu@mbnet.fi
Fri May 12 07:34:00 GMT 2006


Asfand Yar Qazi wrote:
> Christina Wang wrote:
>   
>> I'm trying to build 32 bit gcc4.1.0 on a 64 bit machine(FC3 with intel
>> x86_64EMT processors). The default mode of the generated compiler is
>> always 64 bit. I tried "--enable-targets=m32" in the configuration
>> stage, but it doesn't work. With a  64 bit processor, how can I build 32
>> bit gcc or bi-arch but the default mode is 32 bit?
>>     
> Perhaps compiling it with 'configure --host=x86_64-pc-linux-gnu
> --build=x86_64-pc-linux-gnu --target=i686-pc-linux-gnu' ?
>
> i.e. a cross compiler, of sorts.
>   
 Producing a crosscompiler is quite well defined goal, one only needs
to know the "target" for which one needs to produce stuff. For instance
SuSE 10.0/i586 most probably isn't exactly the same target as FC3/i386
although they both seem to use just the same glibc-2.3.5 as their base
C library.  If targeting to still earlier Linux/x86's, even those using the
glibc-2.2.5 like Debian 3.0 or Red Hat 7.3,  both the SuSE 10.0 and FC3
are then wrong, apps linked against glibc-2.3.5 will not work with the
glibc-2.2.5 based runtime. But apps linked against glibc-2.2.5 should
work with the glibc-2.3.5 based runtime.

 In Christina's case the goals with the 32-bit compiler, where it should
run (Why it must be for a 32-bit host and for which 32-bit host) and for
what 32-bit and 64-bit targets it should produce  stuff, was left untold.
My guess though is "another kind of native GCC", one which uses 32-bit
binaries as its 'gcc', 'g++', 'cc1*' etc. and which produces 32-bit and
64-bit binaries for the 64-bit default FC3/x86_64...  Getting one using
'-m32' in 'CC' ('CC="gcc -m32"') or in 'CFLAGS' should be easy as a pie
but if the target is 'x86_64-linux-gnu' (what it must be for bi-arch), then
the default output is still 64-bit.

 Another quite well defined goal could be to produce a 32-bit GCC for
the FC3/i386, one which produces 32-bit binaries as default and 64-bit
binaries with '-m64'.  This would be similar to the 'sparc-solaris2.*' (7,
8,9,10) target, the GCC for Solaris2.8 for instance produces 32-bit stuff
as default and 64-bit ('sparcv9') stuff with '-m64'.  Unfortunately the
'i686-linux-gnu' target doesn't work this way as a 'bi-arch' target, 
although
nowadays this sounds quite expected.  It definitely wouldn't matter at all
if with a 32-bit Linux distro one could produce apps for its "big brother
or big sister", the 64-bit distro. So with the GCC coming with FC3/i386 
it should
be fully possible to produce apps for the FC3/x86_64. This works vice versa
already so what on earth is the problem with the Fedora developers?

 When anyone who can build crosscompilers just builds them without much
thinking, things like the previous about what the 'i686-linux-gnu' targeted
GCC should produce nowadays, have stayed unchanged.  In cases where
there are both 32-bit and 64-bit distros, like SuSE 9.x and 10.0, Fedoras,
Ubuntus etc., these two incarnations of the same distro of course should
have been compatible from the very beginning.  But whey haven't, in my case
producing a SuSE 9.2/i586 hosted crosscompiler for SuSE 9.2/x86_64 was
quite obvious... Just as making crosscompilers for the later SuSEs, 
'9.3' and
'10.0', for Fedora Core 3 and 4, Ubuntus and others.  As the matter of fact
I lied here, all my GCCs were made for the RHL 7.3 host although built 
on the
SuSE 9.2...

  I really would like to see somewhere a claim like "Our Linux will run 
all the
binaries made for the current ABC Linux, DEF Linux and so on".  But it 
is not
rare to see separate binaries  like :

------------------ clip ---------------------
Download Skype for Linux

Version: 1.2.0.18. Release date: October 25, 2005

RPM for SuSE 9 and newer (7.6 MB)

RPM for Fedora Core 3 (7.7 MB)

RPM for Mandriva 10.1 and newer (7.4 MB)
Version: 1.2.0.21. Release date: January 9, 2006

Debian package (7.7 MB)
Version: 1.2.0.18. Release date: March 21, 2006
Xandros, MEPIS, Ubuntu, other Debian-based distros
------------------ clip ---------------------

here with Skype....  My decision to produce things for RHL 7.3 and then 
expect
the produced stuff to work almost everywhere has this far succeeded 
quite well.

 So I would like to see people to define their aimed targets a little 
more precise.
And would suggest finding that "least common nominator" as the suitable 
Linux/x86
target system (RHL 7.3 in my case).



More information about the Gcc-help mailing list