Re: PTHREAD_CFLAGS/PTHREAD_LIBS clean test (Re: libpthread vs libthr.)

From: Ruslan Ermilov <ru_at_FreeBSD.org>
Date: Sun, 26 Nov 2006 14:53:08 +0300
On Sun, Nov 26, 2006 at 11:53:11AM +0900, Norikatsu Shigemura wrote:
> On Fri, 10 Nov 2006 20:35:26 +0300
> Ruslan Ermilov <ru_at_freebsd.org> wrote:
> > To make user's life easier, I suggest the following simple patch.
> > Its effect on platforms where libpthread is available is to (sym)link
> > libthr to libpthread if WITHOUT_LIBPTHREAD is set in /etc/src.conf.
> > This would allow more people interested in libthr testing to more
> > easily do it.  (Of course already linked applications wouldn't
> > magically start using libthr without also patching /etc/libmap.conf.)
> > %%%
> > Index: Makefile
> > ===================================================================
> > RCS file: /home/ncvs/src/lib/libthr/Makefile,v
> > retrieving revision 1.20
> > diff -u -p -r1.20 Makefile
> > --- Makefile	22 Aug 2006 07:51:06 -0000	1.20
> > +++ Makefile	10 Nov 2006 17:27:40 -0000
> > _at__at_ -42,7 +42,7 _at__at_ PRECIOUSLIB=
> >  .include "${.CURDIR}/sys/Makefile.inc"
> >  .include "${.CURDIR}/thread/Makefile.inc"
> >  
> > -.if ${MACHINE_ARCH} == "sparc64"
> > +.if ${MACHINE_ARCH} == "sparc64" || ${MK_LIBPTHREAD} == "no"
> >  SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a
> >  .if !defined(NO_PIC)
> >  SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so
> > %%%
> 
> 	In the case you said (echo WITHOUT_LIBPTHREAD=yes >> /etc/src.conf),
> 	we cannot get libkse.*.  Because lib/libpthread is omitted in
> 	lib/Makefile:-(.
> 
On sparc64, yes.  On other arches, there's no libkse at all.
Why is it a problem?  We don't want to hear about libkse.

> 	I'm trying to test PTHREAD_CFLAGS/PTHREAD_LIBS.  So I prepared
> 	following environment.
> 
> 	x libpthread.* (removed as passible as)
> 	o libkse.*
> 	o libthr.*
> 
> 	But WITHOUT_LIBPTHREAD (MK_LIBPTHREAD=no) option is too danger.
> 
> $ cd /usr/src
> $ fgrep -r MK_LIBPTHREAD .
> ./lib/Makefile:.if ${MK_LIBPTHREAD} != "no"
> ./sbin/ggate/Makefile:.elif ${MK_LIBPTHREAD} != "no"
> ./share/man/man3/Makefile:.if ${MK_LIBPTHREAD} != "no" || ${MK_LIBTHR} != "no"
> ./tools/build/mk/OptionalObsoleteFiles.inc:#.if ${MK_LIBPTHREAD} == no
> ./usr.bin/Makefile:.elif ${MK_LIBPTHREAD} != "no"
> ./usr.sbin/Makefile:.if ${MK_LIBPTHREAD} != "no"
> ./usr.sbin/Makefile:.if ${MK_LIBPTHREAD} != "no"
> ./usr.sbin/Makefile:.if ${MK_LIBPTHREAD} != "no"
> 

[...]
> 	ng  In case of sbin/ggate/Makefile, ggatec and ggated will not be
> 	    installed.
> 
The conditional should be changed to

.elif ${MK_LIBPTHREAD} != "no" || ${MK_LIBTHR} != "no"

so it benefits from my patch to libthr/Makefile.

> 	ng  In case of usr.bin/Makefile, csup will not be installed.
> 	ng  In case of usr.sbin/Makefile, pppctl will not be installed.
> 
The same change here.

> 	And usr.sbin/cached/Makefile and usr.sbin/ngctl/Makefile is not
> 	good WITHOUT_LIBPTHREAD.  I couldn't compile them.  I think that
> 	these should be omitted in usr.sbin/Makefile like pppctl case.
> 
You mean without my patch and with WITHOUT_LIBPTHREAD, and with my
patch and wit both WITHOUT_LIBPTHREAD and WITHOUT_LIBTHR?  Yes, these
need to be fixed (see the patch).

> 	And FreeBSD src tree don't have PTHREAD_CFLAGS/PTHREAD_LIBS clean
> 	mechanism.  I think that there are some way to adopt PTHREAD_CFLAGS/
> 	PTHREAD_LIBS to src tree, maybe.  But I don't know how do I do
> 	anyway.
> 
Why?  Just using ${LIBPTHREAD} in DPADD and -lpthread in LDADD should
work.  If it doesn't work, we will fix it.

> 	1. force lib/libpthread install libkse.* to /usr/lib, and symlink
> 	   to /lib/libpthread.*.  I don't know KEYWORD to symlink to /lib/
> 	   libpthread.* from libkse.*/libthr.*.
> 
I don't see a reason for this; yet, this is a bad idea because binaries
will record libkse.so.X in them.

> 	2. Fix like following in usr.bin/Makefile and usr.sbin/Makefile:
> .if ${MK_LIBPTHREAD} != "no"
> .....
> 	:
> 
> 	to
> 
> .if ${MK_LIBPTHREAD} != "no" || ${MK_LIBTHR} != "no"
> 
Yes.

> .....
> 	:
> 	   And compile force lib/libpthread.
> 
Like I said, I fail to see a reason for this.

>          And in case of
> 	   MK_LIBPTHREAD=no, symlink libthr.* to libpthread.*.
> 
This is what my patch to libthr/Makefile does.  BTW, I'm testing
the attached patch now that should fix issues you mentioned.


Cheers,
-- 
Ruslan Ermilov
ru_at_FreeBSD.org
FreeBSD committer

Received on Sun Nov 26 2006 - 10:52:55 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:03 UTC