public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* gcc -lm and libm.a for Mac OS X
@ 2003-11-11 16:31 Vincent Lemaitre
  2003-11-11 16:41 ` Andrew Pinski
  0 siblings, 1 reply; 2+ messages in thread
From: Vincent Lemaitre @ 2003-11-11 16:31 UTC (permalink / raw)
  To: gcc-bugs

Hi,

When running the following command:
gcc -lm test_isnan.cc

I got the following error message:

ld: Undefined symbols:
___gxx_personality_v0

The libm.a is missing in /usr/lib. And I suspect this is (part of) the 
reason of the reason for the error.

Could somebody explain me where and how to get libm.a under Mac OSX? Or 
is there another way to link the math library?

The gcc man page on Apple web site takes it for granted that libm.a 
should be in /usr/local, but it is not. The only library that could be 
a math library is libm.dylib@...
(I have installed the Apple's Developper's Tools and all the C 
libraries I could find with fink, without success).

Thank you in advance,

Vincent





test_isnan.cc:

#include <stdio.h>
#include <math.h>

int main()
{

   printf("Hello it's test program for isnan()\n");

   printf(" \"3000\" is a NUMBER?\t: %d\n",isnan(3000.0));

   return 1;
}


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gcc -lm and libm.a for Mac OS X
  2003-11-11 16:31 gcc -lm and libm.a for Mac OS X Vincent Lemaitre
@ 2003-11-11 16:41 ` Andrew Pinski
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Pinski @ 2003-11-11 16:41 UTC (permalink / raw)
  To: Vincent Lemaitre; +Cc: gcc-bugs


On Nov 11, 2003, at 8:31 AM, Vincent Lemaitre wrote:

> Hi,
>
> When running the following command:
> gcc -lm test_isnan.cc
>
> I got the following error message:
>
> ld: Undefined symbols:
> ___gxx_personality_v0

This symbol is needed for exception handling in c++, either compile 
with g++ or use -fno-exceptions or use higher optimizations.


>
> The libm.a is missing in /usr/lib. And I suspect this is (part of) the 
> reason of the reason for the error.

libm.a does not exists because it is part of the libSystem.dyld and 
Apple does not provide static libraries.


>
> Could somebody explain me where and how to get libm.a under Mac OSX? 
> Or is there another way to link the math library?


You do not have to explicitly link with the math library on Mac OS X 
(aka Darwin) to use it, it is already included in libSystem.

>
> The gcc man page on Apple web site takes it for granted that libm.a 
> should be in /usr/local, but it is not. The only library that could be 
> a math library is libm.dylib@...
> (I have installed the Apple's Developper's Tools and all the C 
> libraries I could find with fink, without success).
>
> Thank you in advance,
>
> Vincent
>
> test_isnan.cc:
>
> #include <stdio.h>
> #include <math.h>
>
> int main()
> {
>
>   printf("Hello it's test program for isnan()\n");
>
>   printf(" \"3000\" is a NUMBER?\t: %d\n",isnan(3000.0));
>
>   return 1;
> }
>
>
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-11-11 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-11 16:31 gcc -lm and libm.a for Mac OS X Vincent Lemaitre
2003-11-11 16:41 ` Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).