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 Reply-To: Mumit Khan To: Rand Dvorak cc: cygwin AT sourceware DOT cygnus DOT com Subject: Re: problem linking with cygwin In-Reply-To: <9905112148.AA02389@ch1d2301nwk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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