delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/05/11/18:55:42

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
X-Authentication-Warning: modi.xraylith.wisc.edu: khan owned process doing -bs
Date: Tue, 11 May 1999 17:55:09 -0500 (CDT)
From: Mumit Khan <khan AT xraylith DOT wisc DOT edu>
Reply-To: Mumit Khan <khan AT xraylith DOT wisc DOT edu>
To: Rand Dvorak <Rand DOT Dvorak AT wdr DOT com>
cc: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: problem linking with cygwin
In-Reply-To: <9905112148.AA02389@ch1d2301nwk>
Message-ID: <Pine.SUN.3.93.990511174814.26495B-100000@modi.xraylith.wisc.edu>
MIME-Version: 1.0

On Tue, 11 May 1999, Rand Dvorak wrote:

> I have some internal unix libs I am trying to compile using cygwin
> and get the following errors when linking:
> 
> when I simply compile with no -l, I get:
> 
> GEN_Hash.o(.text+0x14):GEN_Hash.c: undefined reference to `memalign'
> GEN_Hash.o(.text+0xb2):GEN_Hash.c: undefined reference to `memalign'
> GEN_Hash.o(.text+0x580):GEN_Hash.c: undefined reference to `memalign'
> GEN_Hash.o(.text+0x5c3):GEN_Hash.c: undefined reference to `memalign'
> GEN_Hash.o(.text+0x690):GEN_Hash.c: undefined reference to `memalign'
> GEN_Hash.o(.text+0x77e):GEN_Hash.c: more undefined references to `memalign' follow
> collect2: ld returned 1 exit status

Neither ANSI nor POSIX specify the existence of a function named
"memalign", so you can't expect any code that uses it to build on
a POSIX system. In reality, memalign is part of a widely used 
malloc library, and lots of systems have it; this of course leads
to the bad habit of thinking it's "standard". Portable code simply
can't depend on implementation detail like memalign. Sorry.

> so then when I use the -lc compiler switch I get:
> 
> C:\cygnus\CYGWIN~1\H-I586~1\bin\..\lib\gcc-lib\i586-cygwin32\egcs-2.91.57\..\..\..\..\i586-cygwin32\lib/libcygwin.a(libccrt0.o)(.data+0x0):libccrt0.cc: multiple definition of `_impure_ptr'
> C:\cygnus\CYGWIN~1\H-I586~1\bin\..\lib\gcc-lib\i586-cygwin32\egcs-2.91.57\..\..\..\..\i586-cygwin32\lib/libc.a(impure.o)(.data+0x2ec):impure.c: first defined here
> collect2: ld returned 1 exit status

This is an old and somewhat known problem. On Cygwin, -lc is unnecessary,
and in fact, it's only good for causing confusion such as this. I'd like
to see it either removed from the distributions or a link to libcygwin.a
(which is the "real" libc on Cygwin). 

Regards,
Mumit




--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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