Threading libraries

Jean-Baptiste Quenot jbq at caraldi.com
Mon Apr 3 07:52:36 UTC 2006


* Vasil Dimov:

> On Sun, Apr  02, 2006 at 04:33:28PM  +0200, Jean-Baptiste Quenot
> wrote:
>
> > Instead of  linking with "cc" instead  of "ld", why not  add a
> > « FreeBSD SPECIFIC  OPTION » called  "-pthread" to  "ld", like
> > what has been done to "cc"?
>
> Because linking with  cc is a fix  that we have a  patch for and
> therefore can be committed right on the moment.
>
> As I  see it you object  against linking with cc  instead of ld,
> but  you do  not have  any other  solution (except  from linking
> *everything* with pthread).

I'm not  objecting to your patch,  which is valuable ATM  until we
improve FreeBSD handling of pthread libraries.

What I don't like is:

1) we are explicitly linking with cc, that is not a Resin-specific
   issue at all, please tell me if I'm wrong.  The problem we have
   with Resin will arise for other ports too.  Right or wrong?

2) the documentation *must* be improved because it does not state
   that ld does not support -pthread, see
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/book.html

   12.16 Threading libraries

   The threading library must be linked to the binaries using a
   special linker flag -pthread on FreeBSD. If a port insists on
   linking -lpthread or -lc_r directly, patch it to use PTHREAD_LIBS
   variable provided by the ports framework. This variable usually
   has the value of -pthread, but on certain architectures and
   FreeBSD versions it can have different values, so do not just
   hardcode -pthread into patches and always use PTHREAD_LIBS.

I can provide a patch for the documentation if you wish...
-- 
     Jean-Baptiste Quenot
aka  John Banana Qwerty
http://caraldi.com/jbq/


More information about the freebsd-ports mailing list