g77 -lm doesn't work

Billinghurst, David (CRTS) David.Billinghurst@riotinto.com
Mon Jan 1 05:19:00 GMT 2001

Using cygwin 1.17-1, if I try to link any Fortran program with -lm I get the

.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

(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

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

More information about the Cygwin mailing list