views:

738

answers:

1

My problem:

I've been trying to compile, build, and install GCC 4.4.2 in my installation of OpenSolaris 2009.06 on my VirtualBox 3 i386 machine. But I keep getting this same error when running make:

> checking whether ln -s works... yes
checking for i386-pc-solaris2.11-gcc... /src/gcc-4.4.2/host-i386-pc-solaris2.11/gcc/xgcc -B/src/gcc-4.4.2/host-i386-pc-solaris2.11/gcc/ -B/usr/gnu/i386-pc-solaris2.11/bin/ -B/usr/gnu/i386-pc-solaris2.11/lib/ -isystem /usr/gnu/i386-pc-solaris2.11/include -isystem /usr/gnu/i386-pc-solaris2.11/sys-include
checking for suffix of object files... configure: error: in `/src/gcc-4.4.2/i386-pc-solaris2.11/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/src/gcc-4.4.2'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/src/gcc-4.4.2'
make: *** [all] Error 2

Attempted solutions:

  1. I tried the answer to this question: Problem compiling gcc 4.4.0 on OpenSolaris 2009.6 i.e.

    ./configure --prefix=/usr/gnu --with-gmp=/usr/gnu --with-mpfr=/usr/gnu --with-as=/usr/sfw/bin/gas --with-gnu-as --with-gnu-ld

  2. I tried GNU GCC's platform specific solution: GNU Solaris specific build instructions i.e.

    ./configure --prefix=/usr/gnu --with-gmp=/usr/gnu --with-mpfr=/usr/gnu --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-shared

I am still getting the same errors despite running ./configure with the two solutions above

Any help would be appreciated! Thanks!

+1  A: 
  • Can you compile programs with the existing GCC?

    If not, you need to resolve that.

    If you can, then you need to look at that monstrous 7-argument command (the one where it says 'checking for i386-pc-solaris2.11-gcc' - why those 7 arguments?).

  • Are you running 'make bootstrap'?

    If not, what happens when you do?

    If so, whereabouts in the processing is it? (Is this stage 1, or stage 2, or what?)

  • Are you using the recommended setup, with the source for GCC in, say, /src/gcc-4.4.2 and the object files in, say, /src/gcc-4.4.2-obj?

    If not, do so. Use: cd /src/gcc-4.4.2-obj; ../gcc-4.4.2/configure ...

  • Which shell do you use?

    On regular Solaris 10 (not OpenSolaris - and SPARC, not Intel), I have to set CONFIG_SHELL=/bin/ksh in the environment to make things compile (by default, it uses /bin/sh, but the /bin/sh on Solaris 10 is Bourne shell and there's a script deep down in the Java section (IIRC) that uses Bash/Korn/POSIX shell notations like $(cmd ...)). However, that normally affects a much later stage in the processing.

However, I have got GCC 4.4.2 on Solaris 10 without problem (using GCC 4.4.1 as the bootstrap compiler).

Jonathan Leffler
penyuan
Now after doing "make bootstrap" I get a different error message:"checking whether the C compiler works... configure: error: in `/src/gcc-4.4.2/i386-pc-solaris2.11/amd64/libgcc':configure: error: cannot run C compiled programs.If you meant to cross compile, use `--host'.See `config.log' for more details.make[2]: *** [configure-stage3-target-libgcc] Error 1make[2]: Leaving directory `/src/gcc-4.4.2'make[1]: *** [stage3-bubble] Error 2make[1]: Leaving directory `/src/gcc-4.4.2'make: *** [bootstrap] Error 2"Does anyone know what this means? Thanks!
penyuan
Regarding time - it is certainly a fairly long-winded process, but if you run with 'make -j4' (with a number appropriate to the number of cores on your machine), it will certainly take less time if you use a number bigger than one. You also need copious space - of the order of 2-4 GB. This usually isn't a problem on modern systems, but be aware of it (I have to make space on my antique SPARC). The 'recursive variable' is puzzling.
Jonathan Leffler
Regarding your new error, that is odd. This is the stage 3 compilation - which is an unusual place to get this sort of error. Stage 1 uses an exiting compiler to compile the new GCC; stage 2 uses the new GCC to compile itself; stage 3 uses the rebuilt stage 2 compiler to rebuild itself, and checks that it gets the same answer. The final stage builds support libraries and other things that have not previously been built. [...to be continued...]
Jonathan Leffler
[...continued...] I forget whether the final build phase is formally stage 3 or a separate phase. So, the Stage 3 clean and configure should be using the new GCC to rebuild itself - but it is unusual for that to be causing trouble. I'm not sure what could be going wrong. I presume you are using an AMD64 chip? And you are not cross-compiling?
Jonathan Leffler
Actually my chip is an Intel Core 2 Duo 2.0 gHz and I am not cross-compiling. Also I just tried the same thing (to be sure) and got the same error.
penyuan
By the way, I also tried to do this:"./configure --prefix=/usr/gnu --program-suffix=-4.4.2 --enable-shared --disable-static --disable-libtool-lock --target= --enable-objc-gc --enable-concept-checks --disable-libada --enable-libssp --enable-languages=c,c++,objc,fortran --enable-threads=posix
penyuan
--enable-tls=yes --with-system-zlib --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-gnu-as --with-as=/usr/sfw/bin/gas --with-gmp-include=/usr/gnu/include/ --with-gmp-lib=/usr/gnu/lib --with-mpfr-include=/usr/gnu/include/ --with-mpfr-lib=/usr/gnu/lib --enable-c99 --enable-nls --enable-wchar_t --enable-libstdcxx-allocator=mt --with-pic"
penyuan
I got this above very long set of options by running './gcc -v' and seeing how my existing copy of gcc is compiled.
penyuan
If you are not using an AMD64 chip, you need to wonder why the configure is choosing that option. It depends on whether the Core 2 Duo looks enough like AMD64, I suppose - I'm running out of ideas and the relevant experience to help. I've compiled GCC often enough; I built 4.4.2 earlier this week, and removed 4.2.3 version to make space for it (I still have 4.4.1 and 4.3.3 and 3.4.6 lurking around installed). I'm gonna try some 'stuff' - I'll let you know whether I find anything out.
Jonathan Leffler
Not sure how significant it is, but when I build GCC 4.4.2 on MacOS X 10.5.8, it uses x86_64 rather than AMD for the architecture. Picking one library, it is /usr/gcc/v4.4.2/lib/x86_64/libgomp.1.dylib. I think you need to look at whether the chosen architecture is correct for your platform.
Jonathan Leffler