*BSD News Article 38920


Return to BSD News archive

Xref: sserve comp.os.386bsd.questions:14978 gnu.g++.help:7211 gnu.gcc.help:10258
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!spool.mu.edu!howland.reston.ans.net!europa.eng.gtefsd.com!news.umbc.edu!haven.umd.edu!cville-srv.wam.umd.edu!cradle
From: cradle@wam.umd.edu (David)
Newsgroups: comp.os.386bsd.questions,gnu.g++.help,gnu.gcc.help
Subject: Problems compiling libg++-2.6.1 using gcc-2.6.[1,2]
Date: 5 Dec 1994 17:22:54 GMT
Organization: University of Maryland, College Park
Lines: 130
Message-ID: <3bvi9e$gj4@cville-srv.wam.umd.edu>
NNTP-Posting-Host: rac2.wam.umd.edu



I'm having difficulty compiling the libg++-2.6.1 library on my system, an   
i386/40 running FreeBSD 1.1.

I'll try to give a somewhat detailed explanation of the steps I've taken
to install gcc and libg++.  The end result, though, is that the 
compiler chokes when it gets to Fix.cc in the libg++ distribution.


1.  I installed GNU make ver. 3.72.1, without difficulty

2.  I installed gcc.  I've had no luck with either version 2.6.1 or 2.6.2.
  (haven't tried 2.6.3 yet).
    
    a)  I ran configure from the gcc-2.6.2 directory.  The script correctly
        guessed the configuration to be i386-unknown-freebsd1.1

    b)  I compiled gcc-2.6.2 using the compiler that came packaged with 
	FreeBSD 1.1, gcc version 2.4.5, with the command
	      make LANGUAGES=c

    c) I made the stage2 compiler with the commands (executed from 
       the gcc-2.6.2 directory):
	     make stage1
	     make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"

    d) I built the Objective C library:
	     make objc-runtime CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"

    e) I installed the compiler:
	     make install CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O" 

    f) I installed the Objective C library:
	     make install-libobjc CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"


3.  I attempted to install libg++-2.6.1

    a) I copied /usr/bin/g++, /usr/bin/gcc, /usr/bin/cpp, the old
       versions of these programs, to /usr/bin/g++.old, etc, so that
       the 2.6.2 gcc was executed (in /usr/local/bin/gcc) by the makefiles.

    b) To enable libstc++ I uncommented the second definition of target_libs
       in configure.in

    c) In libg++-2.6.1 I executed configure, which again correctly guessed
       the system type.

    d) To make the library:      
              make all "CC=gcc -O" "CXX=gcc -O"


At this point, after compiling for quite some time and successfully creating 
some of the libraries, I got the following errors:

gcc -O -c -g -O2 -fno-implicit-templates -nostdinc++ -I. -I../../libio -I.
-I./../../libio -I./../src  Fix.cc
In file included from ../../libio/libio.h:32,
                 from ../../libio/streambuf.h:34,
                 from ../../libio/iostream.h:31,
                 from ../../libio/stream.h:31,
                 from ./Fix.h:11,
                 from Fix.cc:25:
../../libio/_G_config.h:42: warning: ANSI C++ forbids typedef which does not 
specify a type
../../libio/_G_config.h:44: warning: ANSI C++ forbids typedef which does not 
specify a type
Fix.cc: In function `static struct Fix::Rep * Fix::multiply(const struct Fix::Re
p *, const struct Fix::Rep *, struct Fix::Rep * = 0)':
Fix.cc:301: call of overloaded constructor `Fix(unsigned int)' is ambiguous
./Fix.h:232: candidates are: Fix::Fix(const Fix &)
./Fix.h:218:                 Fix::Fix(int)
./Fix.h:226:                 Fix::Fix(double)
Fix.cc:301: in base initialization for class `Fix'
Fix.cc:301: call of overloaded constructor `Fix(unsigned int)' is ambiguous
./Fix.h:232: candidates are: Fix::Fix(const Fix &)
./Fix.h:218:                 Fix::Fix(int)
./Fix.h:226:                 Fix::Fix(double)
Fix.cc:301: in base initialization for class `Fix'
Fix.cc: In function `static struct Fix::Rep * Fix::divide(const struct Fix::Rep 
*, const struct Fix::Rep *, struct Fix::Rep * = 0, struct Fix::Rep * = 0)':
Fix.cc:371: call of overloaded constructor `Fix(unsigned int)' is ambiguous
./Fix.h:232: candidates are: Fix::Fix(const Fix &)
./Fix.h:218:                 Fix::Fix(int)
./Fix.h:226:                 Fix::Fix(double)
Fix.cc:371: in base initialization for class `Fix'
Fix.cc:386: call of overloaded constructor `Fix(unsigned int)' is ambiguous
./Fix.h:232: candidates are: Fix::Fix(const Fix &)
./Fix.h:218:                 Fix::Fix(int)
./Fix.h:226:                 Fix::Fix(double)
Fix.cc:386: in base initialization for class `Fix'
make[2]: *** [Fix.o] Error 1
make[2]: Leaving directory `/usr/tempor/libg++-2.6.1/libg++/src'
make[1]: *** [in-src] Error 2
make[1]: Leaving directory `/usr/tempor/libg++-2.6.1/libg++'
make: *** [all-libg++] Error 2


The ANSI C++ typedef warning comes up often, but doesn't stop the compiling. 


I suspect the problem may have something to do with gcc-2.6.2 not finding
the proper header files.

For instance, if I compile (using the newly compiled 2.6.2 version of g++) a 
simple program to print out "hello" using iostream.h, I get the following error:

% g++ test2.cc
In file included from /usr/include/g++/iostream.h:24,
                 from test2.cc:4:
/usr/include/g++/streambuf.h:187: `ios::operator void *(...)' must take `void'
/usr/include/g++/streambuf.h:187: confused by earlier errors, bailing out


But, oddly enough, if I copy the header files in /usr/include/g++ to the
directory /usr/local/include/g++, and include this directory explicitly:

    % g++ -I /usr/local/include/g++ test2.cc

then I have no problem.  Note that these examples use the newly compiled
gcc and g++.


Any help would be greatly appreciated.  I'm baffled.


David Eisner
cradle@wam.umd.edu
University of Maryland at College Park