On Thu, 25 May 2006 15:10:57 -0400 Joe Marcus Clarke wrote: >Jean-Yves Lefort wrote: >> On Thu, 25 May 2006 17:17:43 +0200 >> Jean-Yves Lefort wrote: >> >>> On Thu, 25 May 2006 10:56:32 -0400 >>> Joe Marcus Clarke wrote: >>> >>>> Pav Lucistnik wrote: >>>>> Jean-Yves Lefort píše v st 24. 05. 2006 v 23:47 +0200: >>>>>> On Wed, 24 May 2006 22:38:11 +0200 >>>>>> Pav Lucistnik wrote: >>>>>> >>>>>>> Since file open dialog needs pthread_* functions and that's a part of >>>>>>> Gtk+-2.0 library, shouldn't `pkg-config --libs gtk+-2.0` contain >>>>>>> '-pthread' too? >>>>>>> >>>>>>> >>>>>> -pthread should be changed to -lpthread in bsd.port.mk and libraries >>>>>> which need libpthread should be linked against it. I remember bland >>>>>> had some patches. >>>>> >>>>> >>>>> I was living in the belief that linking -lpthread directly is a bad >>>>> design? Have this changed recently? I know it's probably a question >>>>> for arch@ >>>>> >>>>> Otherwise yes, this looks like the only systematic solution to the >>>>> problem. >>>> >>>> >>>> Linking directly to -lpthread is very bad. I had this discussion with >>>> deischen a while back when we switched the pthread libs to -pthread >>>> everywhere. The problem with linking a shared library to -lpthread is >>>> that if any executable that links to that library is not also linked >>>> with -lpthread (or -pthread), then the application can lock up. >>>> >>>> I think bland ran into the same thing with his patches which is why the >>>> issue was dropped. I could be mistaken, though. >>> >>> >>> I'm curious as to what is causing said applications to lock up, since >>> linking libs against libpthread is apparently possible on Linux. Maybe >>> I'll have a look. >> >> >> After applying this patch: >> >> http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/gen/_pthread_stubs.c.diff?r1=1.11&r2=1.12&f=h >> >> and recompiling glib with PTHREAD_LIBS="-lpthread" it seems to work. >> >> bland: do you remember which application(s) locked up? > > > Nautilus was one such app that used to lock up. If you built all of the > shared libraries with -lpthread, but did not use -pthread or -lpthread > when linking nautilus itself, it would lock up trying to load. > > Before making any changes, you should also consult with deischen on weak > symbols, and why our pthread behavior is the way it is. It's not possible to make changes anyway, since the libc fix hasn't been MFC'ed. Getting back to Pav's initial question, why is adding -pthread to gtk+-2.0.pc considered harmful? This workaround is used in a number of libraries which use threads and provide a config script or .pc file.