Mail Archives: cygwin/1999/05/11/18:55:42
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 -