Subject: Re: pkg/28373
To: None <irix-pkg-people@netbsd.org, gnats-admin@netbsd.org,>
From: Georg Schwarz <georg.schwarz@freenet.de>
List: pkgsrc-bugs
Date: 01/31/2005 11:13:02
The following reply was made to PR pkg/28373; it has been noted by GNATS.

From: georg.schwarz@freenet.de (Georg Schwarz)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/28373
Date: Mon, 31 Jan 2005 12:13:53 +0100

 Indeed for python23 the three mentioned issues are no longer present.
 However, there are some other newly-appeared issues, probably related to
 the use of threads:
 
 As with pkg/27009 on systems with no native socklen_t the pthread header
 typedefs socklen_t. python's configure does not know about this, so it
 detects a missing socklen_t definition and adds its own, which later
 leads to a conflict. The same issue occurs with lang/python24.
 In both cases a fix is to uncoditionally add
 
 CONFIGURE_ENV+= ac_cv_type_socklen_t="yes"
 
 On systems where it exists it is true anyway (so it does not hurt), on
 others it is provided by the pthread header.
 
 Then there's a problem with python23's Python/thread.c: the header files
 which prototype some functions are included only after the actual
 function definition code in Python/thread.c. My cc at least does not
 like this. As a fix (?) I reversed things a bit:
 
 --- Python/thread.c.orig1       2005-01-30 23:16:23.000000000 +0100
 +++ Python/thread.c     2005-01-30 23:17:58.000000000 +0100
 @@ -35,6 +35,7 @@
  
  #ifdef __sgi
  #define SGI_THREADS
 +#undef HAVE_PTH
  #endif
  
  #ifdef HAVE_THREAD_H
 @@ -63,27 +64,6 @@
  
  static int initialized;
  
 -static void PyThread__init_thread(void); /* Forward */
 -
 -void PyThread_init_thread(void)
 -{
 -#ifdef Py_DEBUG
 -       char *p = getenv("THREADDEBUG");
 -
 -       if (p) {
 -               if (*p)
 -                       thread_debug = atoi(p);
 -               else
 -                       thread_debug = 1;
 -       }
 -#endif /* Py_DEBUG */
 -       if (initialized)
 -               return;
 -       initialized = 1;
 -       dprintf(("PyThread_init_thread called\n"));
 -       PyThread__init_thread();
 -}
 -
  #ifdef SGI_THREADS
  #include "thread_sgi.h"
  #endif
 @@ -139,6 +119,27 @@
  #endif
  */
  
 +static void PyThread__init_thread(void); /* Forward */
 +
 +void PyThread_init_thread(void)
 +{
 +#ifdef Py_DEBUG
 +        char *p = getenv("THREADDEBUG");
 +
 +        if (p) {
 +                if (*p)
 +                        thread_debug = atoi(p);
 +                else
 +                        thread_debug = 1;
 +        }
 +#endif /* Py_DEBUG */
 +        if (initialized)
 +                return;
 +        initialized = 1;
 +        dprintf(("PyThread_init_thread called\n"));
 +        PyThread__init_thread();
 +}
 +
  #ifndef Py_HAVE_NATIVE_TLS
  /* If the platform has not supplied a platform specific
     TLS implementation, provide our own.
 
 
 As you can see, I in addition undef'd HAVE_PTH, since including both
 pth.h and pthread.h lead e.g. to a duplicate typedef for socklen_t.
 Probably however this should be better solved by other means.
 
 With python24 I similarly get:
 
 cc -c  -DNDEBUG -O2 -I/usr/local/pkg/include -I/usr/include
 -I/usr/local/pkg/include -I/usr/include -I/usr/local/pkg/include
 -I/usr/include -I. -I./Include  -DPy_BUILD_CORE -o Python/thread.o
 Python/thread.c
 cfe: Warning 728: ./Include/objimpl.h, line 255: Long double not
 supported; double assumed.
         long double dummy;   
         ^
 cfe: Error:
 /usr/people/schwarz/pkgsrc/lang/python24/work/.buildlink/include/pthread
 .h, line 194: redeclaration of 'socklen_t'; previous declaration at line
 55 in file
 '/usr/people/schwarz/pkgsrc/lang/python24/work/.buildlink/include/pth.h'
  typedef int socklen_t;
  ------------^
 cfe: Error:
 /usr/people/schwarz/pkgsrc/lang/python24/work/.buildlink/include/pthread
 .h, line 196: redeclaration of 'nfds_t'; previous declaration at line 58
 in file
 '/usr/people/schwarz/pkgsrc/lang/python24/work/.buildlink/include/pth.h'
  typedef unsigned long nfds_t;
  ----------------------^
 
 
 Last, the endiness detection issue is still present with python24, with
 the originally proposed extra code to Makefile working around it.    
 
 
 -- 
 Georg Schwarz    http://home.pages.de/~schwarz/
  georg.schwarz@freenet.de   +49 177 8811442