Re: pbms on freebsd w/ threads



Hi,

On Wed, May 05, 1999 at 11:31:39AM -0400, Owen Taylor wrote:
> Well, they weren't ignored (we traded a few messages
> on the subject, IIRC), but no, they were never applied.

Sorry, my warped communication skills...  I like using words like 'steal'
instead of 'borrow', etc.  'Ignored' is my way of saying 'not applied'.

> For a couple of reasons:
> 
>  1) I got confused with the FreeBSD v2 vs. FreeBSD v3;
>     -lc_r vs. pthreads... etc...

It's simple: freebsd2.2-aout-libc_r, freebsd3-aout-libc_r,
freebsd3-aout-libpthread, freebsd3-elf-libc_r, freebsd3-elf-libpthread,
freebsd4-elf-libc_r and freebsd4-elf-libpthread...

Now add GTK+ 1.0.6, GTK+ 1.1.3, GTK+ 1.1.19, GTK+ 1.2.2...  and "Welcome
to the FreeBSD Port's Collection".

:-)

>  2) There were a number of issues involved, and it p
> 
>     a) libtool patches. I believe that the equivalent patches
>        have gone into libtool since and if they aren't
>        in GLib now, will certainly be in the next release,
>        which is libtool-1.3 based.

Yes. The ELF issues are fixed for 1.2f onwards.  aout is still broken
from the ports collection perspective.  It will work for CVS builds.

>     b) Some configuration tests to deal with libc_r oddities.
>        These probably were OK to go in.

Attached is a new set of patches, based on the problem reported in this
thread.  Could the others (CC'd) please test and report if they fix the
problem?  Some people may want to conditionalise them for FreeBSD, but I
think they are probably right for most platforms.

Beyond the FreeBSD patches, they move G_THREAD_CFLAGS to only be used in
the compilation of libgthread.

The issues with FreeBSD's libc_r are:
1.  Must use -D_THREAD_SAFE to get thread safe headers.
2.  Must link with -pthread not -lc_r, since libc_r replaces libc. 
    Because of using weak symbols in libc it should work anyway, but
    it's better to do it the right way.
3.  No poll() in libc_r, but configure will find the one in libc, and
    fail when linked with libc_r. 

libpthread is a straight port of the LinuxThreads package, and only
requires "-D_THREAD_SAFE -DLINUXTHREADS" to pick up the right headers. 
Otherwise it can be treated like Linux.

>     c) library name issues. There are known issues with
>        the way we do shared-library naming on platforms
>        like FreeBSD and SunOS. Some fixes are definitely
>        needed here, but getting all the tests right is
>        not easy for someone like me who only has ELF-based
>        platforms. (And FreeBSD is the worst part of the
>        confusion because of a switch from a.out to
>        ELF.)
>
>        I understood at the time that this part of the
>        patch wasn't meant to be submitted because the 
>        FreeBSD policy was to invent completely new shared
>        library names (!) ... (though I've heard different
>        stories from different people)

The FreeBSD Ports Collection has to use different library names, include
directories, -config scripts, etc. to support concurrent building and
running with multiple versions of GLib/GTK+.  Untill a few days ago all
of the versions I listed above were in the collection, but now the 1.1.x
ports have been elmininated.  Yes, I didn't mean to include that bit,
since this is a 'Ports only' issue.

To be rude, the real issue is that the product version is being
confused with the shared library version.  If the major number was being
bumped properly, then ld wouldn't be having such a hard time.

>  3) The patches was sent to me personally; this is a good
>     way of getting them forgotten. If you don't want
>     your patches to get forgotten, either upload them
>     to ftp://ftp.gtk.org/pub/incoming/ or submit them
>     to the bug tracking system. (The former, or a combination
>     of the two is preferred for patches that are more
>     than a couple of lines long.)

The FreeBSD ethic is to contact the code maintainer before submitting
bug reports on his code.  You were the last person to touch the code in
question (at the time), and therefore the nominal maintainer.  It's my
fault for not submitting it to the bug tracking system, but the patches
have changed substainally with each release, and now are much smaller.

I'll submit a bug report on this if the others (Hi!) report success.

Thanks,
 -Jeremy

-- 
  |    What will people think when they hear that I'm a Jesus freak?
--+--  What will people do when they find that it's true?
  |    I don't really care if they label me a Jesus Freak,
  |    There ain't no disguising the truth.  - d c Talk

--- gthread/Makefile.am.orig	Wed May  5 23:03:44 1999
+++ gthread/Makefile.am	Wed May  5 23:06:57 1999
@@ -22,3 +22,5 @@
 
 noinst_PROGRAMS = testgthread
 testgthread_LDADD = ../libglib.la libgthread.la 
+
+CFLAGS = @CFLAGS@ @G_THREAD_CFLAGS@
--- configure.in.orig	Thu Jan 28 09:59:01 1999
+++ configure.in	Thu Jan 28 23:13:01 1999
@@ -271,7 +271,7 @@
 AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))
 
 # Check for some functions
-AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf strcasecmp strncasecmp poll)
+AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf strcasecmp strncasecmp)
 
 # Check for sys_errlist
 AC_MSG_CHECKING(for sys_errlist)
@@ -526,6 +526,12 @@
 	  linux*)
 	    G_MODULE_LDFLAGS='-rdynamic'
 	    ;;
+	  freebsd*)
+	    objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+	    if test $objformat = "elf"; then
+		    G_MODULE_LDFLAGS='-Wl,-E'
+	    fi
+	    ;;
 	esac
 	LIBS_orig="$LIBS"
 	LDFLAGS_orig="$LDFLAGS"
@@ -735,11 +741,14 @@
             	        G_THREAD_CFLAGS="$G_THREAD_CFLAGS -mthreads"
 		fi
 		;;
-	*-freebsd2.2*)
-		G_THREAD_CFLAGS="$G_THREAD_CFLAGS -D_THREAD_SAFE"
-
-		# FreeBSD 2.2.x shiped with gcc 2.7.2.x, which doesn't support
-		# -mthreads flag.
+	*-*-freebsd*)
+		if test x"$G_THREAD_LIBS" = x"-lc_r"; then
+			G_THREAD_CFLAGS="-D_THREAD_SAFE -pthread"
+			G_THREAD_LIBS=""
+			have_poll=no
+		else
+			G_THREAD_CFLAGS="-D_THREAD_SAFE -DLINUXTHREADS"
+		fi
 		;;
     esac
 
@@ -856,8 +865,6 @@
 AC_SUBST(G_THREAD_CFLAGS)
 AC_SUBST(G_THREAD_LIBS)
 
-CFLAGS="$CFLAGS $G_THREAD_CFLAGS"
-
 dnl **********************************************
 dnl *** GDefaultMutex setup and initialization ***
 dnl **********************************************
@@ -881,6 +888,9 @@
 dnl ****************************************
 dnl *** GLib POLL* compatibility defines ***
 dnl ****************************************
+if test x"$have_poll" != xno; then
+	AC_CHECK_FUNCS(poll)
+fi
 GLIB_SYSDEFS(
 [#include <sys/types.h>
 #include <sys/poll.h>],



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