18.3.2015, 13:58, Alex Blekhman kirjoitti:
Andrew Haley <aph <at> redhat.com> writes:
Cross-compiling from 32- to 64-bit hosts is notoriously tricky. People
almost always go in the opposite direction. I don't even know if it
can be done.
I think that the 32-bit Linux distros don't support "native" compiling
to 64-bit at all
because one cannot run the 64-bit binaries on 32-bit hosts. Doing vice
versa, producing
to 32-bit on a 64-bit system then is always supported in "native"
toolchains. But what
comes to crosscompiling, at least producing crosstoolchains for the
64-bit Linux distros
hasn't been any problem ever. So making a crosscompiler from
'i386-centos-linux5.11'
to 'x86_64-centos-linux6.5' is a quite plain vanilla job, one only needs
the glibc and kernel
headers for the target CentOS 6.5/x86_64 installed in a sysroot on the
CentOS 5.11/i386
host... Neither when the host system is a CentOS 6.5/i386 system. Just
built on a 32-bit
CentOS 5.11 system what Niccolo Ferrari tried on his 64-bit Linux :
[root@localhost ~]# x86_64-freebsd10.1-gcc-4.9 -v
Using built-in specs.
COLLECT_GCC=x86_64-freebsd10.1-gcc-4.9
COLLECT_LTO_WRAPPER=/opt/cross/lib/gcc/x86_64-freebsd10.1/4.9.2/lto-wrapper
Target: x86_64-freebsd10.1
Configured with: ../configure --build=i686-linux-gnu
--host=i686-linux-gnu --target=x86_64-freebsd10.1 --prefix=/opt/cross
--libdir=/opt/cross/lib --libexecdir=/opt/cross/lib
--with-sysroot=/opt/host-FreeBSD10.1_x86_64 --enable-languages=c,c++
--enable-shared --enable-threads=posix --disable-nls
--enable-version-specific-runtime-libs
--with-gxx-include-dir=/opt/cross/include/c++/4.9.2
--program-prefix=x86_64-freebsd10.1- --program-suffix=-4.9
Thread model: posix
gcc version 4.9.2 (GCC by Kai Ruottu)
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.18-402.el5 #1 SMP Tue Feb 10 17:49:32
EST 2015 i686 athlon i386 GNU/Linux
I can live with 64-bit system, which has 64-bit GCC. What is essential for
me is that I can build both 32-bit and 64-bit targets and then run 32-bit
targets (during test phase of the build).
How difficult (easy?) is it to have 64-bit Debian/Redhat machine running
32-bit executables?
OK, maybe I'm a trash collector but when I still have those old 32-bit
PCs, inventing some use
for them like building GNU stuff on them, sounds motivated... The
Windozes in them were
never updated and the Windozes went to trash. And when having only 1 GB
memory, installing some
older Linux distros to them sounded sane. Ok, the second > 1 GHz one has
CentOS 6.5/i386 but
I haven't tried much toolchain builds on it yet, only used it as a
"safer" net-PC. The only 64-bit
system I have at home is a double core laptop PC with 2 GB memory which
could be booted to
CentOS 6.5 x86_64 but I don't think the builds on it were much quicker
than now on my primary
2.8 GHz AthlonXP build machine. The laptop being the only one with
Windoze (because of some
necessary apps), I seldom boot it to Linux any more... Of course when
one does these things in
work, there isn't much consideration whether one would need a double
core or quad core 64-bit PC
with 4 or 8 GB all the time. At home I do something else while the 2.8
GHz PC builds and when
I again look at it, the job seems to be done. Not too slow yet....