[gnu.g++.bug] Building libg++

rfg@MCC.COM (Ron Guilmette) (03/18/89)

recently, (ctw%CNS.UMIST.AC.UK@mitvma.mit.edu) writes:

>When trying to build the test programs for libg++ I get the following
>result.
>

>/usr/include/sys/fcntlcom.h:62: warning: type declaration of flock shadows
> previous declaration
>/usr/include/sys/fcntlcom.h:62: warning: `flock' was declared `extern' and later `static'

There warnings are nothine to worry about, although it is good that
they have been posted so that Doug Lea can see them (in case he didn't
already know about them.)


>ld: No such file or directory for Mcrt1.o
>*** Error code 1

I had this same problem.  The problem seems to be that (on Sun3's at least)
some of the Sun-supplied *crt*.o files are normally located in the /lib
directory.  Unfortunatly, there are only two main ways by which such
things as Mcrt1.o can be found.  Both of these are failing.

In the gcc.c file (with G++ 1.34.1 and earlier) two string pointers
are given initial values.  The first is "standard_startfile_prefix"
and the second one is stardard_startfile_prefix_1.  The first one of
these is initialized by a string supplied by the Makefile (from the
value it gets for its own $(libdir) variable.  This is usually the name
of a special library dirtectory into which gnu sub-tools are installed.
Some people use "/usr/local/lib" for this, others (such as me) use
different path names (such as "/usr/local/src/lib/1.34.1.1/sun3").
In any case, this pathname is *not* normally equal to "/lib".

The second string (standard_startfile_prefix_1) was defined in the
gcc.c file in several g++ distributions leading up to 1.34.1 to be
"/usr/local/lib".  Thus, the g++ driver program fails to ever look
in "/lib" (on a Sun3) for Mcrt1.o.

I fixed this in my copy by editing the g++ version of gcc.c and changing
the string which defines standard_startfile_prefix_1 from "/usr/local/lib"
to "/lib".  I believe that this is more correct, and it certainly cures
the Mcrt1.o problem.

Actually, the best thing would be to fix gcc.c so that it has a whole
array of default search prefixes (kinda just like ld.c does).  For instance:

char *standard_startfile_prefixes[] = {
#ifdef STANDARD_STARTFILE_PREFIX
	STANDARD_STARTFILE_PREFIX,
#endif
	"/usr/local/lib",
	"/usr/lib",
	"/lib"
};


// Ron Guilmette  -  MCC  -  Experimental (parallel) Systems Kit Project
// 3500 West Balcones Center Drive,  Austin, TX  78759  -  (512)338-3740
// ARPA: rfg@mcc.com
// UUCP: {rutgers,uunet,gatech,ames,pyramid}!cs.utexas.edu!pp!rfg