Package: mpich
Version: 1.2.5.3-5
Severity: important
Tags: patch

Hi,

mpich currently FTBFS on hurd-i386. Here is a patch (note that the
semaphore part was completely bogus).

Samuel

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-xen
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages mpich depends on:
ii  libmpich1.0-dev               1.2.7-2    mpich static libraries and develop
ii  mpich-bin                     1.2.7-2    MPI parallel computing system impl

mpich recommends no packages.

-- no debconf information

-- 
Samuel Thibault <[EMAIL PROTECTED]>
       void *memmem (const void *meule_de_foin, size_t lg_meule,
              const void *aiguille, size_t lg_aiguille);
(extrait de la page de man de memmem -- Manuel du programmeur Linux)
--- bin/tarch.orig      2007-04-21 20:52:55.000000000 +0000
+++ bin/tarch   2007-04-21 20:31:01.000000000 +0000
@@ -69,7 +69,7 @@
 
        IRIX64|IRIX) FARCH=$LARCH ; break ;;
  
-        Linux)  
+        Linux|GNU)  
            # Pick between i86, alpha, and PowerPC LINUX
             LINUXARCH=`$UNAME -m`
            case $LINUXARCH in 
--- mpid/mpd/mpdcon.c.orig      2007-04-21 20:54:51.000000000 +0000
+++ mpid/mpd/mpdcon.c   2007-04-21 20:54:11.000000000 +0000
@@ -15,6 +15,10 @@
 #define PATSIZE 64
 #define TIMEOUTVAL 5
 
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 1024
+#endif
+
 struct fdentry fdtable[MAXFDENTRIES];  /* for external defn */
 extern int fdtable_high_water_mark;
 
--- mpid/ch_shmem/configure.in.orig     2007-04-21 21:50:19.000000000 +0000
+++ mpid/ch_shmem/configure.in  2007-04-21 21:52:09.000000000 +0000
@@ -134,6 +134,7 @@
 # where they belong).  Thus, if mutex_init IS found, we need to 
 # check for -lthread.   (Which we should have done above)
 #
+AC_CHECK_LIB(pthread,sem_post)
 AC_CHECK_FUNCS(mutex_init strerror shmat semop mmap sem_post)
 
 # atexit registers a function to be called at normal process termination
--- mpid/ch_shmem/configure.orig        2007-04-21 21:53:03.000000000 +0000
+++ mpid/ch_shmem/configure     2007-04-21 22:28:33.000000000 +0000
@@ -1316,6 +1316,53 @@
 # where they belong).  Thus, if mutex_init IS found, we need to 
 # check for -lthread.   (Which we should have done above)
 #
+echo $ac_n "checking for sem_post in -lpthread""... $ac_c" 1>&1
+echo "configure:1272: checking for sem_post in -lpthread" >&2
+ac_lib_var=`echo pthread'_'sem_post | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&1
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lpthread  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1280 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char sem_post();
+
+int main() {
+sem_post()
+; return 0; }
+EOF
+if { (eval echo configure:1291: \"$ac_link\") 1>&2; (eval $ac_link) 2>&2; } && 
test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&2
+  cat conftest.$ac_ext >&2
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&1
+    ac_tr_lib=HAVE_LIB`echo pthread | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lpthread $LIBS"
+
+else
+  echo "$ac_t""no" 1>&1
+fi
+
 for ac_func in mutex_init strerror shmat semop mmap sem_post
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&1
--- mpid/ch_shmem/p2p_locks.h.orig      2007-04-21 22:31:04.000000000 +0000
+++ mpid/ch_shmem/p2p_locks.h   2007-04-21 22:46:33.000000000 +0000
@@ -226,16 +226,16 @@
 #endif
 
 #if defined(USE_POSIX_SEM)
-#include <?>
+#include <semaphore.h>
 #define INCLUDED_POSIX_SEM
 typedef struct { sem_t mutex; } p2p_lock_t;
-#define p2p_lock_init(l) sem_init( &((l).mutex), 0, 1 )
+#define p2p_lock_init(l) sem_init( &((l)->mutex), 0, 1 )
 /* Sem_wait is a slow system call and can be interrupted */
 #define p2p_lock(l)      \
-    while (sem_wait( &((l).mutex) == -1 && errno == EAGAIN );
-#define p2p_unlock(l)    sem_post( &((l).mutex) )
+    ({ while (sem_wait( &((l)->mutex) ) == -1 && (errno == EAGAIN || errno == 
EINTR) ); 0; })
+#define p2p_unlock(l)    sem_post( &((l)->mutex) )
 #define p2p_lock_name    "Posix sem"
-#define p2p_lock_free(l) sem_destroy( &((l).mutex )
+#define p2p_lock_free(l) sem_destroy( &((l)->mutex )
 #endif
 
 /* A few odds and ends */

Reply via email to