delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/01/23/22:23:06

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Tue, 23 Jan 2001 22:21:43 -0500
From: Christopher Faylor <cgf AT redhat DOT com>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: Re: g77 -lm link problem [Re: Results for 2.97 20010115 (experimental) testsuite on i686-pc -cygwin]
Message-ID: <20010123222143.A23074@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
References: <20010123211050 DOT A22516 AT redhat DOT com> <Pine DOT HPP DOT 3 DOT 96 DOT 1010123210154 DOT 6114K-100000 AT hp2 DOT xraylith DOT wisc DOT edu>
Mime-Version: 1.0
User-Agent: Mutt/1.3.11i
In-Reply-To: <Pine.HPP.3.96.1010123210154.6114K-100000@hp2.xraylith.wisc.edu>; from khan@NanoTech.Wisc.EDU on Tue, Jan 23, 2001 at 09:09:48PM -0600

On Tue, Jan 23, 2001 at 09:09:48PM -0600, Mumit Khan wrote:
>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).

Maybe the only solution is to remove -lm.  I do appreciate the analysis
of the problem.  Now I at least understand why this is happening.

cgf

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019