gcc-2.6.3 Compile Error

2007-12-25 11:59:00

Dear Sun Managers:

It has been three weeks since I posted the following question on getting

gcc v2.6.3 compiled on Solaris 2.5.1. My original problem was missing

bison which most managers pointed out to me to install. This issue was

solved. However, I still couldn't get any gcc nor g++ compiled. It kept

failing at "fixproto: populating 'include'." I ignored these messages

and continued with "stage 1" but that failed with "error." I'd followed

everyone's suggestion, I'd compiled it using gcc v2.7.2 and SparcWorks C

v2.0, I'd tried it on different SUNs, and I'd followed instructions

from the README file under "Installing GNU CC on the Sun" (I'm desperate!)...

but the error message was the same for fixproto, and stage 1 exited with

error.

As a footnote, if anyone has a binary version of gcc v2.6.3 compiled

for Solaris 2.5.1 (Sparc 20), or if anyone could think of other ways

of accomplishing the task, I would appreciate hearing from you. Thank

you.

Vicky Lau

vlau@msmail2.hac.com

=============================================================================

My credits go to:

- Benjamin Cline

- Kevin Sheehan

- Craig Mason

- Rick Kelly

- rsk@itw.com

- Brian Davies

- Michael Blandford

- Frank Pardo

- Tim Evans

- Tim Carlson

- Tino W. Dai

- Marcus Pless

- Bill Armand

- Laurent Duperval

- Lawson A S

- Fedor Gnuchev

=============================================================================

My original question:

====================

We are using a simulation software (BONeS Designer v3.6) that works only

with gcc v2.6.3.

We downloaded the latest gcc compiler and used this compiler to compile

the gcc-2.6.3. I followed the README instructions:

- configure (for Solaris 2.5.1)

- changed "CC = /opt/FSFgcc/bin/gcc" in the Makefiles, including the one in cp

directory

- make LANGUAGES="c c++"

The make exited with the following error:

/opt/FSFgcc/bin/gcc -c -DIN_GCC -DSVR4 -g -I. -I.. -I. -I./.. -I.http://config

expr.c

expect 1 shift/reduce conflict and 34 reduce/reduce conflicts.

cd .; bison -d -o parse.y

sh: bison: not found

*** Error code 1

make: Fatal error: Command failed for target 'parse.h'

Current working directory /user1/vlau/tmp/gcc-2.6.3/cp

In the Makefile there is an entry "BISON = bison." Am I missing some

path name for bison or some library that I should install before compiling

this version of gcc?

My follow-up question:

=====================

I'd received quite a number of responses from the group helping me

out with compiling an older version of gcc-2.6.3. Most of you suggested

that I needed to install bison, which I did, and recompiled c and c++.

However, after an hour of compiling, I received the following errors:

# mkdir /user1/vlau/gcc-2.6.3/include

# ./configure --prefix=/user1/vlau/gcc-2.6.3

--local-prefix=/user1/vlau/gcc-2.6.3/include

# make LANGUAGES="c c++"

...

fixproto: populating `include'

fix-header: fixing stdio.h

fix-header: fixing unistd.h

fixproto: cpp could not parse /user1/vlau/gcc-2.6.3/include/kerberos/osconf.h

(ignored)

fixproto: cpp could not parse /user1/vlau/gcc-2.6.3/include/sys/cg8reg.h

(ignored)

fixproto: cpp could not parse /user1/vlau/gcc-2.6.3/include/sys/cg8var.h

(ignored)

(No *.h files in /user1/vlau/gcc-2.6.3/include/sys/scsi)

(No *.h files in /user1/vlau/gcc-2.6.3/include/v9)

mkdir: Failed to make directory "/user1/vlau/gcc-2.6.3/include/v7/sys"; No

such file or directory

mkdir: Failed to make directory "/user1/vlau/gcc-2.6.3/include/v7/sys"; No

such file or directory

touch stmp-fixproto

=============================================================================

Responses to first problem:

==========================

Install Bison and put bison in the search path.

Replace bison with yacc in the Makefile(s).

You only need to run bison if you changed its input (*.y) files. Chances

are you didn't do that. When I had a similar problem a year or so ago, I

found that the simplest fixup was to "touch" the output *.c files, so

that the makefile won't ever try to run bison. Look for the *.y files

in the source directory (I think there are four of them), and "touch" the

corresponding *.c files. If you use the Korn shell, you can do it all in

one line, using the "%%" and "##" trickery.

Responses to second problem:

===========================

I'm not sure you should do this.

--prefix= is where you eventually want to install gcc

--local-prefix= is (I believe) a local include path which is search by

default by gcc, on top of /usr/include. It is normally

/usr/local/include, I think.

With all versions of gcc wich I installed I did:

./configure --prefix=/usr/local/gnu

(I want gcc in /usr/local/gnu/bin)

make LANGUAGES="c" (I think, look at the docs)

make stage1

make CC=stage1/gcc (I think, look at the docs, once again)

make stage2

Then there's another run to check that the compiler is producing proper

code. After that, do a make install and you're in business.

===========================

Nothing, I think. I think these are just informative messages telling

you about the progress of fixproto (which runs fix-header, if memory

serves) and as long as it keeps going, I don't think these complains

are significant.

===========================

I just finished compiling gcc 2.7.2.1 and I use gcc 2.5. This is what I did

First if you are using gcc to do the compiling you have to have bison in

the gcc directory. Mine is in "/opt/gnu/gcc/bin". I have gcc and bison

in this directory. And bison versions older than Sept. 8, 1988 will

cause incoorrect output. So to make sure I grabbed the latest version of

bison and compiled it first.

Next, in the source directory:

        ./configure --local-prefix=/opt/gnu/

I did this so it would install the binaries in that directory. The gcc

default is "/usr/local/". If you want to look at other options do a:

"./configure --help".

Once I have run configure, I vi'ed Makefile and checked the "CC = gcc"

line. Usually, it will put the gcc in for you instead of cc if you're

using gcc to compile. No need for the directory path.

Now for the compile. There are several steps to the complete compile.

You would now do:

        make LANGUAGES=c

At this point it's a waste of time to build anyother languages but "c".

Now move the 1st stage object files and executables into a subdirectory:

        make stage1

The files are moved into a directory named stage1

Now recompile the compiler with itself:

        make CC="stage1/xgcc -Bstage1/" CFLAGS="-g O2"

Called making a stage2 compiler. If you only want "c and c++" do this:

        make CC="stage1/xgcc -Bstage1/" CFLAGS="-g O2" LANGUAGES="`c', `c++'"

I went on and built a stage3 compiler to have two to compare but not

necessary.

Last but not least you:

make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="`c', `c++'"

This will install the compiler in the directory specified in the

configure step. Hope this helps.

Comments

Got something to say?

You must be logged in to post a comment.