Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Oct 1996 10:13:59 -0600 (MDT)
From:      Nate Williams <nate@mt.sri.com>
To:        Keith Mitchell <kmitch@unix.guru.org>
Cc:        nate@mt.sri.com (Nate Williams), current@freebsd.org
Subject:   Re: Weirdness in current
Message-ID:  <199610171613.KAA18147@rocky.mt.sri.com>
In-Reply-To: <199610171431.KAA10456@unix.guru.org>
References:  <199610171359.HAA17511@rocky.mt.sri.com> <199610171431.KAA10456@unix.guru.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> > Are you saying the math library is brought in even if you don't
> > explicitly ask for it?
> 
> Yes.  It did that in 2.10R, 2.15R, -stable, and now again in -current.

I don't see that on my -stable box, but it definitely happens in
-current.

It's done automatically in -current by the c++ driver on line 551 of
/usr/src/contrib/cc/cp/g++.c. 

*RANT MODE ON*

Did I mention that I *HATE* the new contrib scheme?  It makes trying to
debug programs a nightmare since the code is scattered everywhere across
contrib, so a simply grep doesn't work very well.

*RANT MODE OFF*

In any case, the math library is linked into into *ALL* binaries, so
'static' vs 'shared' shouldn't make any difference.

> I have no idea why though.  The program doesn't use any of the
> functions in the math library directly.  And, without the math library
> the program core dumps (but ONLY on output redirection ;-<>).  With
> the math library compiled in it works fine.

It's linked into the static version, so why adding it again makes any
difference is a mystery to me.  An easy way to see what's happening is
to use the '-v' flag to the compiler.

EX:
% setenv CC "cc -v"

> Well, what I think is happening is that the static linking is not bringing
> in the math library like the dynamic one now does (see above).

Nope.  At least, not on my system.

> NOTE: -current as of 10/9 did not bring in the math library by
> default.

The file hasn't changed, so I don't see how it would not.

> -current as of 09/01 behaved the same way (gcc 2.6.3).

Right.  Older versions of gcc didn't explicitly link in the math
library.  I don't know why it's being done, but the GCC folks hopefully
have some reason (or it's a bug).

>  Also, If I make
> a "hello world" program and compile it with cc I get just the c library.  If
> I compile it with c++, I get the c, math, and the stdc++ libraries.  (This is
> as of 10/16 anyways).

Right.  This is on purpose, since apparently the stdc++ libraries are
necessary for almost *any* C++ program you write.  Even the hello world
program (using streams) won't link w/out stdc++.

The math library thing is a mystery though....




Nate



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610171613.KAA18147>