[Mageia-dev] Cross compile x86_64 on i586 for icecream?

Colin Guthrie mageia at colin.guthr.ie
Tue Jun 14 10:27:35 CEST 2011


'Twas brillig, and Christiaan Welvaart at 13/06/11 12:24 did gyre and
gimble:
> On Mon, 13 Jun 2011, Colin Guthrie wrote:
> 
>> I'm not exactly a guru with icecream but is it possible to build a
>> toolchain that can allow i586 nodes to compile x86_64 code?
> 
> If your question is about the toolchain, have you tried simply passing
> -m64 to gcc?

OK, so for the record, this doesn't work.

However I checked out our tool chain and the RPMs accept some handy
arguments. Yay!

Sadly they don't really work!

I was able to build binutils via:
 rpmbuild --define "cross x86_64" --define "_topdir $(pwd)" -bb
SPECS/binutils.spec

But then I tried gcc via:
 rpmbuild --define "cross_bootstrap x86_64" --define "_topdir $(pwd)"
-bb SPECS/gcc.spec

(it needs to bootstrap to build glibc which can then be used to rebuild
gcc again fully).

Sadly this bombed out:
/home/colin/Mageia/gcc/BUILD/gcc-4.5.2/obj-x86_64-mageia-linux-gnu/./gcc/xgcc
-B/home/colin/Mageia/gcc/BUILD/gcc-4.5.2/obj-x86_64-mageia-linux-gnu/./gcc/
-B/usr/x86_64-mageia-linux-gnu/bin/ -B/usr/x86_64-mageia-linux-gnu/lib/
-isystem /usr/x86_64-mageia-linux-gnu/include -isystem
/usr/x86_64-mageia-linux-gnu/sys-include
--sysroot=/home/colin/Mageia/gcc/BUILD/gcc-4.5.2/obj-x86_64-mageia-linux-gnu/../sysroot
  -O2 -g -pipe -m32 -O2  -O2 -g -pipe -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE -DNATIVE_CROSS  -W -Wall -Wwrite-strings
-Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition  -isystem ./include  -fPIC -g  -DIN_LIBGCC2
-D__GCC_FLOAT_NOT_NEEDED   -I. -I. -I../../.././gcc -I../../../../libgcc
-I../../../../libgcc/. -I../../../../libgcc/../gcc
-I../../../../libgcc/../include -I../../../../libgcc/config/libbid
-DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS  -DUSE_TLS -o _muldi3.o -MT
_muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c
../../../../libgcc/../gcc/libgcc2.c
In file included from ../../../../libgcc/../gcc/tsystem.h:87:0,
                 from ../../../../libgcc/../gcc/libgcc2.c:29:
/home/colin/Mageia/gcc/BUILD/gcc-4.5.2/obj-x86_64-mageia-linux-gnu/./gcc/include-fixed/stdio.h:13:23:
fatal error: sys/types.h: No such file or directory
compilation terminated.



Now it seems that adding -Dinhibit_libc here works a treat, but I've no
idea if this is appropriate. The files sys/types.h is included in the
source but e.g. sys/syscall.h is not (this is subsequently needed if you
fix the include path to point at the included lsb headers).


As I know nothing about the tool chain....

 Q1. Should we be setting -Dinhibit_libc during this bootstrap stage?
 Q2. Would it be better to use the lsb-headers instead and somehow find
syscall.h?
 Q3. Am I doing something dumb?

Cheers

Col

-- 

Colin Guthrie
mageia(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


More information about the Mageia-dev mailing list