Topic: libg++ installation


Author: tong@fw.bluestone.com (Thomas Tong)
Date: 1995/07/26
Raw View
Hi everyone,

        I'm trying to install gcc2.6.3 and libg++2.6.2 onto a
SunOS4.1.3. and having a bit of a problem.  First of all, I'm
not root, so I'm installing this under /tools/tong/gcc-2.6.3,
and the libg++ is under /tools/tong/gcc-2.6.3/libg++-2.6.2 .

        The gcc2.6.3 compiled OK by setting the "prefix" value
in the Makefile to /tools/tong/gcc-2.6.3 .  The libg++'s 'con-
figure' script's "prefix" value was also changed to same, thus
all the Makefiles created by 'configure' to also have the "prefix"
values pointing to /tools/tong/gcc-2.6.3 .

        The compiling of libg++ goes happily along when I encounter
this error message:

gcc -c -g -nostdinc++ -I. -I/tools/tong/gcc-2.6.3/include
-I../../libio -I. -I./../../libio -I./../src  AllocRing.cc
In file included from
/tools/tong/gcc-2.6.3/include/sys/fcntlcom.h:156,
                 from /usr/include/fcntl.h:6,
                 from ./std.h:29,
                 from AllocRing.cc:23:
/tools/tong/gcc-2.6.3/include/unistd.h:86: previous declaration of
`int chmod(const char *, short unsigned int)' with C++ linkage
/tools/tong/gcc-2.6.3/include/sys/stat.h:92: conflicts with new
declaration with C linkage

        I opened all the files mentioned above to see what may be the
problem, but it's not obvious to me.  Some of those files (sys/stat.h
& unistd.h) uses a #define _PARAMS.  But I don't think that's the
problem.  If any of you out there knows of this problem, please
let me know :)

        Thanks in advance.

   ===============================================================
   Thomas Tong     Phone: (609) 727-4600
   Bluestone
   1000 Briggs Road  Email: tong@bluestone.com
   Mt. Laurel, NJ 08054
                                  Web: http://www.bluestone.com/
   ===============================================================






Author: tong@fw.bluestone.com (Thomas Tong)
Date: 1995/07/26
Raw View
Hi again,
        I was able to compile libg++(2.6.2) after a while, but
now I've got a new problem with it.  I tried compiling some
sample code with the new g++ and libg++.  One worked OK, but only
if I enclosed the standard header files with 'extern "C" {...}',
otherwise the linker complained that it couldn't find some
functions.  The funny part was that these functions were ones
like strcpy, sscanf, fprintf, etc..  But once I enclosed the
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
with the extern "C" {...} it worked.  Hmmmm...

        So anyway, off to the second test file.  This one is an
extremely simple Motif code (just has a rowcolumn with three
pushbuttons).  But now, the linker complains about a new
undefined symbol, _xmalloc.  So I looked through the source codes
for gcc-2.6.3 and found that xmallod is a #define within
alloca.c.  And also that alloca.o was not included in either
libgcc.a nor libg++.a.

        Therefore, in the Makefile, I defined ALLOCA=alloca.o and
reran the makefile.  It compiled the alloca.c but still did not
place it either of the libraries, so I forced it into libg++.a
using:
        ar q libg++.a alloca.o

        Then to make sure alloca.o had a _xmalloc, I did:
                od -s alloca.o | more
        which showed me this:
                0000606  \b@
                0003217 8_free
                0003226 _last_alloca_header
                0003252 _xmalloc
                0003263 _alloca

        So I know that _xmalloc is defined in libg++.a, so WHY
do I get this error message?

        ld: Undefined symbol
                _xmalloc
        collect2: ld returned 2 exit status

        If anybody knows why, **PLEASE** let me know.

        Thanks ahead of time. :)


   ===============================================================
   Thomas Tong     Phone: (609) 727-4600
   Bluestone
   1000 Briggs Road  Email: tong@bluestone.com
   Mt. Laurel, NJ 08054
                                  Web: http://www.bluestone.com/
   ===============================================================