libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: -lc fix for BSD/OS and FreeBSD


From: Howard Chu
Subject: RE: -lc fix for BSD/OS and FreeBSD
Date: Thu, 31 Jan 2002 19:51:56 -0800

I've found other problems on Solaris and Linux with libtool explicitly adding
libc to the link line. One of the more recent hassles is with gcc 3.x; if you
build a shared library with gcc and explicitly link -lc, gcc also links
libgcc.so into your object. This gets to be a real hassle because now you have
shared libraries that wrongly have a dependency on libgcc. Only linked
executables are supposed to pull in libgcc, and it's really only critical for
C++, not for plain C.

It would be safest if libtool never added -lc to the link line, since all C
compiler drivers already do it implicitly.

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support

> -----Original Message-----
> From: address@hidden [mailto:address@hidden Behalf Of
> Dave MacKenzie
> Sent: Thursday, January 31, 2002 7:23 PM
> To: address@hidden
> Cc: address@hidden
> Subject: -lc fix for BSD/OS and FreeBSD
>
>
> I was trying to run a CGI program with Apache 2.0.18 on BSDI BSD/OS 4.3,
> and found that when read() on a nonblocking pipe returned -1, errno wasn't
> setting set (to EAGAIN); it was 0.  So apache didn't do its timeout call
> and the CGI request got a Server Error.
>
> The problem turned out to be that when linking libapr.so, libtool was adding
> -lc.  Then, when libapr.so was linked into httpd, -lc gets linked in again,
> and there are now two copies of libc in apache's address space, each with its
> own thread-safe copy of errno.
>
> The version of libtool that came with Apache is:
>
> ltmain.sh (GNU libtool) 1.3.4-freebsd-ports (1.385.2.196 1999/12/07 21:47:57)
>
> However, the problem still exists in:
>
> ltmain.sh (GNU libtool) 1.4 (1.920 2001/04/24 23:26:18)
>
> The latter contains this case:
>
>           *-*-netbsd*)
>             # Don't link with libc until the a.out ld.so is fixed.
>             ;;
>
> That case needs to be extended to:
>
>           *-*-netbsd* | *-*-freebsd* | *-*-bsdi4*)
>             # Don't link with libc until the a.out ld.so is fixed.
>             ;;
>
> The FreeBSD port of libtool adds freebsd, and as I just discovered,
> BSD/OS needs the same treatment.
>
> This problem also recently bit Steven Schultz <address@hidden> while
> porting some video software from Linux to BSD/OS.
>
> _______________________________________________
> Libtool mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/libtool
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]