Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com X-Authentication-Warning: hp2.xraylith.wisc.edu: khan owned process doing -bs Date: Tue, 23 Jan 2001 21:09:48 -0600 (CST) From: Mumit Khan To: "'cygwin AT cygwin DOT com'" Subject: g77 -lm link problem [Re: Results for 2.97 20010115 (experimental) testsuite on i686-pc -cygwin] In-Reply-To: <20010123211050.A22516@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 23 Jan 2001, Christopher Faylor wrote: > On Wed, Jan 24, 2001 at 12:38:56AM -0000, Billinghurst, David (CRTS) wrote: > > I guess I was vainly hoping that someone would actually debug the > problem or offer insight into the reason for the problem rather than > saying "Just remove -lm! Works for me!" The problem is that the g77 runtime library (libg2c) contains main, and internal reordering of libraries by gcc driver causes the problem. $ cat libm-bugf.f program libm_bug write (*,*) 'libm bug' stop end Following causes a problem because g77 driver puts -lm before -lg2c (use -v to see it): $ g77 -o libm-bugf.exe libm-bugf.f -lm /usr/lib/libm.a(libcmain.o)(.text+0x6a):libcmain.c: undefined reference to `WinMain AT 16' collect2: ld returned 1 exit status Following "fixes" the problem now that we know that libg2c must come beforehand (use -v to see it): $ g77 -o libm-bugf.exe libm-bugf.f -lg2c -lm $ I know the symptom, but don't know the real problem, hence don't know the solution (yet). Regards, Mumit -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple