How to build gcc for x86_64?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am trying to convert my Linux installation to x86_64 architecture from 
current i686. The whole system has been compiled for i686 and runs on 
double-CPU AMD64 machine. 

As a first step, I wanted to build a cross compiler for x86_64 which would 
then allow me to build 64-bit binaries of the rest of the system. I followed 
howto at http://www.objsw.com/CrossGCC/:

Software versions: binutils-2.15  gcc-3.4.0 glibc-2.3.2

Here is what I did after unpacking all packages in one directory:
[root@st5mag sorcery]$ . set_cc_env
[root@st5mag sorcery]$ cat set_cc_env
#!/bin/sh
export target=x86_64-linux-gnu
export prefix=/new64
export host=i686-pc-linux-gnu
export PATH=$PATH:/new64/usr/bin:/new64/usr/x86_64-linux-gnu/bin
[root@st5mag sorcery]$ mkdir build-binutils build-gcc
[root@st5mag sorcery]$ cd build-binutils
[root@st5mag build-binutils]$ ../binutils-2.15/configure --target=$target 
--pref ix=$prefix/usr

This went fine, let me know if you need output of configure.

[root@st5mag build-binutils]$ make all install

Success again.

[root@st5mag build-binutils]$ cd ../build-gcc
[root@st5mag build-gcc]$ ../gcc-3.4.0/configure --target=$target 
--prefix=$prefi x/opt/gcc/3.4.0
creating cache ./config.cache
checking host system type... i686-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking build system type... i686-pc-linux-gnu
checking for a BSD compatible install... /usr/bin/install -c
checking for i686-pc-linux-gnu-ar... no
checking for ar... ar
checking for i686-pc-linux-gnu-as... no
checking for as... as
checking for i686-pc-linux-gnu-dlltool... no
checking for dlltool... dlltool
checking for i686-pc-linux-gnu-ld... no
checking for ld... ld
checking for i686-pc-linux-gnu-nm... no
checking for nm... nm
checking for i686-pc-linux-gnu-ranlib... no
checking for ranlib... ranlib
checking for i686-pc-linux-gnu-windres... no
checking for windres... windres
checking for i686-pc-linux-gnu-objcopy... no
checking for objcopy... objcopy
checking for i686-pc-linux-gnu-objdump... no
checking for objdump... objdump
checking for x86_64-linux-gnu-ar... x86_64-linux-gnu-ar
checking for x86_64-linux-gnu-as... x86_64-linux-gnu-as
checking for x86_64-linux-gnu-dlltool... no
checking for x86_64-linux-gnu-ld... x86_64-linux-gnu-ld
checking for x86_64-linux-gnu-nm... x86_64-linux-gnu-nm
checking for x86_64-linux-gnu-ranlib... x86_64-linux-gnu-ranlib
checking for x86_64-linux-gnu-windres... no
checking whether to enable maintainer-specific portions of Makefiles... no
updating cache ./config.cache
creating ./config.status
creating Makefile
[root@st5mag build-gcc]$ make all install

Make finished with these error messages:

/bin/sh ../../gcc-3.4.0/gcc/mkconfig.sh tconfig.h
/usr/src/sorcery/build-gcc/gcc/xgcc -B/usr/src/sorcery/build-gcc/gcc/ 
-B/new64/opt/gcc/3.4.0/x86_64-linux-gnu/bin/ 
-B/new64/opt/gcc/3.4.0/x86_64-linux-gnu/lib/ 
-isystem /new64/opt/gcc/3.4.0/x86_64-linux-gnu/include 
-isystem /new64/opt/gcc/3.4.0/x86_64-linux-gnu/sys-include -O2 -DIN_GCC 
-DCROSS_COMPILE -DNATIVE_CROSS   -W -Wall -Wwrite-strings -Wstrict-prototypes 
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I. 
-I../../gcc-3.4.0/gcc -I../../gcc-3.4.0/gcc/. 
-I../../gcc-3.4.0/gcc/../include   -g0 -finhibit-size-directive 
-fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss 
-fno-unit-at-a-time -fno-omit-frame-pointer -fno-asynchronous-unwind-tables \
  -Dinhibit_libc -c ../../gcc-3.4.0/gcc/crtstuff.c -DCRT_BEGIN \
  -o crtbegin.o
/tmp/ccFyyjN8.s: Assembler messages:
/tmp/ccFyyjN8.s:37: Error: `completed.1(%rip)' is not a valid 32 bit 
base/index expression
/tmp/ccFyyjN8.s:38: Error: suffix or operands invalid for `push'
/tmp/ccFyyjN8.s:39: Error: suffix or operands invalid for `movq'
/tmp/ccFyyjN8.s:45: Error: `p.0(%rip)' is not a valid 32 bit base/index 
expression
/tmp/ccFyyjN8.s:48: Error: `p.0(%rip)' is not a valid 32 bit base/index 
expression
/tmp/ccFyyjN8.s:49: Error: `(%rax)' is not a valid 32 bit base/index 
expression
/tmp/ccFyyjN8.s:58: Error: `completed.1(%rip)' is not a valid 32 bit 
base/index expression
/tmp/ccFyyjN8.s:72: Error: suffix or operands invalid for `push'
/tmp/ccFyyjN8.s:75: Error: suffix or operands invalid for `movq'
/tmp/ccFyyjN8.s:81: Error: `__JCR_LIST__(%rip)' is not a valid 32 bit 
base/index expression
make[1]: *** [crtbegin.o] Error 1
make[1]: Leaving directory `/usr/src/sorcery/build-gcc/gcc'
make: *** [all-gcc] Error 2

At this point, I cannot figure out what is wrong. Googling nor gcc 
documentation did not help.

Thank you for any suggestions,

Jan

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux