g77 -lm doesn't work

Larry Hall (RFK Partners, Inc) lhall@rfk.com
Mon Jan 1 15:59:00 GMT 2001


At 08:19 AM 1/1/2001, Billinghurst, David (CRTS) wrote:
>Using cygwin 1.17-1, if I try to link any Fortran program with -lm I get the
>error
>
>/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-6/../../../../i686-pc-cygwin/lib/libm
>.a(libcmain.o)(.text+0x7f): undefined reference to `WinMain@16'
>collect2: ld returned 1 exit status
>
>Now libm.a is a symbolic link to libcygwin.a.  I believe the root cause is
>linking libcygwin.a before libg2c.a since for any Fortran program I see
>
>g77 foo.f                       OK
>g77 foo.f -lm                   FAIL
>g77 foo.f -lg2c -lm             OK
>g77 foo.f -lcygwin              FAIL
>g77 foo.f -lg2c -lcygwin                OK
>
>Now the obvious solution is to not use -lm, but then I have to edit
>Makefiles (or even worse - hack Dejagnu so I can run the g77 testsuite).
>Once upon a time the cygwin libm.a was an empty archive.  Can we revert to
>this?
>
>+++++++++++++++++++++++++++++++++++++++++
>(Mr) David Billinghurst
>Comalco Research Centre
>PO Box 316, Thomastown, Vic, Australia, 3074
>Phone:  +61 3 9469 0642
>FAX:    +61 3 9462 2700
>Email:  David.Billinghurst@riotinto.com.au



No, reverting isn't an option.  Some packages look for certain functionality
in libm.a as part of their configure (if I remember correctly - and if not,
you'll find the precise answer in the mail archives!;-))  Perhaps this issue
could be resolved in the specs file (forgive me, I'm pretty ignorant of gcc
internals)?




Larry Hall                              lhall@rfk.com
RFK Partners, Inc.                      http://www.rfk.com
118 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list