From: khan@xraylith.wisc.edu (Mumit Khan)
Subject: Re: lgamma() and -lm bug in b18, b19
10 Mar 1998 04:29:07 -0800
Message-ID: <9803100249.AA18084.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <3502EF88.924C73EF@tky0.attnet.or.jp>
To: Norirhiro Ogata <norry@tky0.attnet.or.jp>
Cc: gnu-win32@cygnus.com

Norirhiro Ogata <norry@tky0.attnet.or.jp> writes:

[ missing `signgam' bug ]

This bug has been around since I started using cygwin32 circa b17.1, and
I've posted the trivial here a few times. Here's one of those posts from
way back:

 -- using template mhl.format --
Date:    Mon, 12 May 1997 18:46:20 CDT
From:    Mumit Khan <khan@cygnus.com>
Subject: Missing signgam definition in libm [Re: problems with lgamma()]


"xyz" writes:
> I'm having a trouble in compiling and liking a program listed as
> follows.
> 
> #include <stdio.h>
> #include <math.h>
> 
> main()
> {
>   double l;
>   l = lgamma(1);
>   printf("%lf\n", l);
> }
> 
> Compiling environment is on Win NT 4.0 with cygwin32 beta 18.
> 
> Compiling processes and messages are as follows:
> 
> bash$ gcc -o lgamma lgamma.c
> /tmp\cc0015931.o(.text+0x1b):lgamma.c: undefined reference to `lgamma'
> gcc: Internal compiler error: program ld got fatal signal 1
> 
> bash$ gcc -o lgamma lgamma.c -lm
> C:\gnuwin32\b18\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-970404
> \../../../../i386-cygwin32\lib/libm.a(w_lgamma.o)(.text+0x7):w_lgamma.c:
> undefined reference to `signgam'
> gcc: Internal compiler error: program ld got fatal signal 1
> 

For some reason, the file s_signgam.c, where signgam is defined, wasn't
included in the 'obj' variable in the Makefile (it is there in the 
src one) and hence left out of the library. You can fix it one of 2 
ways:
    
    1. Get the file cdk/newlib/libm/math/s_signgam.c, compile it and put
       in libm, or
    
    2. temporarily, include the following in your program somewhere in a
       file scope:

       #ifdef __CYGWIN32__
       int signgam = 0;
       #endif
    
       and rebuild.

In any case, the compiler shouldn't be dying with internal compiler error,
and that's a bug. The Linux cross-compiler, btw, doesn't die, and simply
reports the linker error.

Mumit

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
