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

Re: gcc-3.4.0 howto build ?



On Fri, 30 Apr 2004 11:36:34 +0100
 Paul Brook <paul@codesourcery.com> wrote:
On Friday 30 April 2004 06:23, Yuri Kozlov wrote:
Hello.
I can`t to build gcc-3.4.0 for x86_64. (debian/stable gcc-2.95 and new
binutils-2.14)
I have
binutils-2.14
gcc-3.4.0
(need some more ?)

I build binutils
../binutils-2.14/configure --prefix=/opt/binutils-2.14
--target=x86_64-pc-linux-gnu
make
make install
All ok and I have in /opt/binutils-2.14/bin files
x86_64-pc-linux-gnu-as and so on.

Next I try build gcc
export PATH=/opt/binutils-2.14/bin:$PATH
../gcc-3.4.0/configure --prefix=/opt/gcc-3.4.0
--target=x86_64-pc-linux-gnu --enable-languages=c,c++
make
Give error something about rip register can not be used in 32 bit
operands ?

This is a typical bootstrap problem. To build a full gcc with threads, shared library and c++ support you need glbc. However You need a working C compiler before you can build glibc.

The solution is to build a minimal version of gcc which does not require a target C library to function.

To build this first C compiler configure with:

../gcc-3.4.0/configure --prefix=/opt/x86_64-toolchain --disable-shared --target x86_64-pc-linux-gnu --enable-languages=c --disable-threads
make
make install. This will give you a functional C compiler. This is sufficient to compile a kernel. If you wish to also compile real applications (or languages other than C), you will need to compile and install glibc, then recompile gcc with the appropriate support, as in your first attempt.

You should also use the same prefix for both binutils and gcc. Gcc expects certain files to be in $prefix. Putting x86_64-pc-linux-gnu-{as,ld} in your path is not sufficient. It may be possible to get this to work by specifying --wit-{as,ld}=, but it's much easier to just use the same prefix for the whole toolchain.

Thanks for answer Paul.
I think, I understand.

Regards,
Yuri Kozlov



Reply to: