This is the mail archive of the mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

To use or not to use -lc [RE: in execvp.c undefined ...]

On Thu, 22 Apr 1999, Michael Fonte wrote:

> Reply I caught this about 30 minutes later.  I am not sure why 'most' of the
> source code distributions out there explicitly add -lc as well.  Anyone have
> a historical perspective on this.  I suppose there are apps out there that
> don't use libc, they either write their own or don't need it.  In these
> cases it would be nice to not have to link against libc.  In either case for
> compatibility reasons explicitly adding -lc should not cause a fatal error
> (IMHO).

Historically speaking, it was usually to deal with systems which had
multiple C runtime libraries, and the compiler drivers didn't handle
it as well as you'd like or at all. eg., lots of systems had libc.a,
libc_s.a, libc_g.a and so on where each library had some special meaning
(profile, debugging, static-vs-dynamic, some-other-feature, etc); more 
often than not, there was no switch to pass to "cc" that will pick the 
right one, and so you'll have to do it yourself. I don't recall having 
to do this since the late 80's however.

Currently, there is absolutely no reason to do this in general; it's just
a bad habit folks pick up from old packages and perpetuate the whole
mess ;-)

This is also another reason one should not use low-level linkers etc
unless there is a special reason. You need to know way too much about
the target system to use ld etc directly.

> The makefile was generated via a configure script from the standard tcl8.0.5
> source distribution.

You're using the in tcl8.0.5/unix directory, which is one
problem right there (unless of course you really mean to build a Cygwin 
Tcl that doesn't use Win32 API); the other is a bug in Tcl
-- it should not have the -lc in the first place (see ``LIBS = ').

You can pretty much use my patches for 8.0.4 and import it into a 8.0.5
CVS tree. Might need a few minor adjustments however. it's available from I'll try to get 8.0.5
patches out sometime soon.


Want to unsubscribe from this list?
Send a message to