delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/09/19/18:30:43

X-Spam-Check-By: sourceware.org
Message-ID: <45106F80.5060000@cygwin.com>
Date: Tue, 19 Sep 2006 18:30:24 -0400
From: "Larry Hall (Cygwin)" <reply-to-list-only-lh AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.5) Gecko/20060727 Fedora/1.5.0.5-1.fc4.remi Thunderbird/1.5.0.5 Mnenhy/0.7.4.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: G77, libg2c and a linking problem
References: <Pine DOT OSF DOT 4 DOT 21 DOT 0609192339480 DOT 12537-100000 AT ax0rm1 DOT roma1 DOT infn DOT it>
In-Reply-To: <Pine.OSF.4.21.0609192339480.12537-100000@ax0rm1.roma1.infn.it>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Angelo Graziosi wrote:
> 
> Dave Korn wrote:
> 
>> Can we then assume that the cernlib build process is doing something
>> unneccessary or unusual or incorrect?
> 
> What would be 'unusual or incorrect' in
> 
> $ cat hello.F
>       program hello
>       implicit none
>       write(*,*) 'Hello!'
>       end
> 
> (1)
> $ g77 hello.F -o hello -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -lg2c
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(libcmain.o):(.text+0xab):
>  undefined reference to `_WinMain AT 16'
> collect2: ld returned 1 exit status
> 
> 
> (2)
> $ g77 hello.F -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -lg2c -o hello
> 
> $ ./hello
>  Hello!
> 
> ?
> 
> 
>> It should all become clear in terms of the linker's requirement that
>> undefined references must always come in objects earlier than the
>> symbols that satisfy those references
> 
> I know this...but then '-o hello' contains symbols that satisfy previous
> references ? 
> (compare (1) with (2))


I think you're speculating too much.  What does it do without adding the
library and path in the first case?  I'm not at a Windows box right now
but I get a similar link error from Linux in the first case.  You'll
either see the same thing I do without the library (everything's fine)
or you'll see a different problem.  If it's the former, your problem
is that you added the unneeded library.  If it's the latter, it's an
ordering problem as Dave mentioned.


-- 
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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