Error compiling 64bits gcc 3.2 compiler on Solaris 2.8

Rupert Wood rup@kanat.pair.com
Thu Oct 3 08:07:00 GMT 2002


Ziying Sherwin wrote:

> We are trying to install gcc 3.2 64 bits compiler on our Solaris 2.8
> machine.

Why do you want this? The 32-bit compiler can generate 64-bit code if you
pass the '-m64' flag. I'd be very surprised if there were any performance
improvements or if you ever hit the memory cap running the 32-bit
compiler.

>  1. Using gcc 2.95.2 compile a 32 bits gcc 3.2 compiler:
>
>       /gcc_3.2.dir/configure \
>           --prefix=/depot/package/gcc_3.2_32bit \
>           --enable-languages=c,c++,f77,objc \
>           --enable-threads
>       make bootstrap
>       make check
>       make install

You could --with-cpu=ultrasparc to the configure to set the default target
CPU (although that might now be the default - I don't recall).

>  2. Using the newly compiled 32 bits gcc 3.2 compiler to compile a 64 bits
>     compiler:
>
>       /gcc_3.2.dir/configure \
>           --prefix=/depot/package/gcc_3.2_64bit \
>           --enable-languages=c,c++,f77,objc \
>           --enable-threads \
>           --with-as=/usr/ccs/bin/as \
>           --with-ld=/usr/ccs/bin/ld \
>           --disable-nls
>           sparcv9-sun-solaris2
>       make bootstrap
>       make check
>       make install

Note that because you are 'make bootstrap'ping here, the output of this
second step will be a 'real' 64-bit compiler.

If you had really just intended to use this to build a third GCC, you only
needed the C language. You'd save a lot of time not building the runtimes
libraries for the other three.

> ld: warning: file ../libiberty/libiberty.a(hashtab.o): wrong ELF class:
> ELFCLASS32

I think this is actually a failure from step 2, not step 3.

The problem is that the bootstrap compiler (32 bits) is used to build
libiberty. To build stage 2, stage 1's new 64-bit xgcc attempts to link
the libiberty built by the bootstrap compile. You told it that it is doing
a 64-bit native build so it assumes that the bootstrap compiler generates
64-bit code. You haven't configured --disable-multilib, so the first step
compiler will generate 64-bit code if you pass '-m64'; you could try
defining

    CFLAGS="-m64 -O2 -g"

or similar for the second step. Another approach would be to rename the
32-bit libiberty, reconfigure and rebuilt it using the stage1 compiler and
then restart the bootstrap.

Good luck,
Rup.



More information about the Gcc-help mailing list