Fix build problems on hurd-i386
authorPino Toscano <pino@debian.org>
Sun, 1 Oct 2023 12:00:06 +0000 (13:00 +0100)
committerAlastair McKinstry <mckinstry@debian.org>
Sun, 1 Oct 2023 12:00:06 +0000 (13:00 +0100)
Forwarded: partially
Last-Update: 2018-10-24

This patch allows Open MPI to build on Debian GNU/HURD.

Also, the memory:linux MCA component is disabled, since its use of POSIX API
in malloc hooks called very early at startup causes troubles.

Also changes by Samuel Thibault <sthibault@debian.org>
See bugs.debian.org/846965

Gbp-Pq: Name build_hurd

ompi/include/ompi_config.h
ompi/mca/fbtl/posix/fbtl_posix_preadv.c
ompi/mca/fbtl/posix/fbtl_posix_pwritev.c
opal/mca/base/mca_base_var.c
opal/util/stacktrace.c
orte/include/orte_config.h
orte/mca/odls/base/odls_base_default_fns.c

index a7a2c1fa0850d15b10e716c270dda843cf3c12a7..2428ddeabc0cb1b67d0c599f206d48c1cfc4a74b 100644 (file)
 
 #include "opal_config.h"
 
+#ifndef PATH_MAX /* Hurd */
+#define PATH_MAX 65535
+#endif
+
 #define OMPI_IDENT_STRING OPAL_IDENT_STRING
 
 /***********************************************************************
index 6658540777aafaddb75c215514cef19d850fcc13..73a48d98f4ebbdd2a1ba0e566fe7a6308ebdd7ea 100644 (file)
 static ssize_t mca_fbtl_posix_preadv_datasieving (ompio_file_t *fh);
 static ssize_t mca_fbtl_posix_preadv_generic (ompio_file_t *fh);
 
+#ifndef IOV_MAX
+#define IOV_MAX 1024
+#endif
+
 ssize_t mca_fbtl_posix_preadv (ompio_file_t *fh )
 {
     ssize_t bytes_read=0, ret_code=0;
index d54e9e0943479f4ddacd7491a6984e63437bd560..89098fca8be8424ec9cb0a19bed0602a3a6fcdbc 100644 (file)
 static ssize_t mca_fbtl_posix_pwritev_datasieving (ompio_file_t *fh );
 static ssize_t mca_fbtl_posix_pwritev_generic (ompio_file_t *fh );
 
+#ifndef IOV_MAX
+#define IOV_MAX 1024
+#endif
+
 ssize_t  mca_fbtl_posix_pwritev(ompio_file_t *fh )
 {
     ssize_t bytes_written=0, ret_code=0;
index d409296d3cd590646ff4607ced806afda74ce5c4..a1291a218da5f9f966ad12ad5ef298c1031f831f 100644 (file)
 #include "opal/util/opal_environ.h"
 #include "opal/runtime/opal.h"
 
+#ifndef MAXPATHLEN /* Hurd */
+#define MAXPATHLEN 65535
+#endif
+
+#ifndef PATH_MAX  /* Hurd */
+#define PATH_MAX 65535
+#endif
+
 /*
  * local variables
  */
index 3a36d15915d4fcea14abc86bd646000ad80051e9..9b4a2a0fa2d6b222344198603da08844dc2a223a 100644 (file)
@@ -588,8 +588,12 @@ int opal_util_register_stackhandlers (void)
 
     /* Setup the signals to catch */
     memset(&act, 0, sizeof(act));
+#ifdef SA_SIGINFO
     act.sa_sigaction = show_stackframe;
     act.sa_flags = SA_SIGINFO;
+#else
+    act.sa_handler = show_stackframe_handler;
+#endif
 #ifdef SA_ONESHOT
     act.sa_flags |= SA_ONESHOT;
 #else
index 9c951b7f800dae7d3f18221518871667a9774d29..6ec28d08cd82ed539f9f2cda5056dd8d1a070827 100644 (file)
 
 #include "opal_config.h"
 
+#ifndef PATH_MAX /* Hurd */
+#define PATH_MAX 65535
+#endif
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 65535
+#endif
+
 #define ORTE_IDENT_STRING OPAL_IDENT_STRING
 
 #  if OPAL_C_HAVE_VISIBILITY
index 8db35a6eb9efa2c046bb69aa8f0de9e84b1900a5..8f92dc449ba989817dca75fc013ef082e4813db7 100644 (file)
@@ -856,7 +856,11 @@ static int setup_path(orte_app_context_t *app, char **wdir)
          * again not match getcwd! This is beyond our control - we are only
          * ensuring they start out matching.
          */
+#if !defined(MAXPATHLEN) && defined(__GLIBC__)
+    basedir = get_current_dir_name();
+#else
         getcwd(dir, sizeof(dir));
+#endif 
         *wdir = strdup(dir);
         opal_setenv("PWD", dir, true, &app->env);
         /* update the initial wdir value too */
@@ -1065,7 +1069,11 @@ void orte_odls_base_default_launch_local(int fd, short sd, void *cbdata)
     orte_app_context_t *app;
     orte_proc_t *child=NULL;
     int rc=ORTE_SUCCESS;
-    char basedir[MAXPATHLEN];
+#if !defined(MAXPATHLEN) && defined(__GLIBC__)
+    char *basedir=NULL;
+#else
+  char basedir[MAXPATHLEN];
+#endif
     int j, idx;
     int total_num_local_procs = 0;
     orte_odls_launch_local_t *caddy = (orte_odls_launch_local_t*)cbdata;
@@ -2061,7 +2069,11 @@ int orte_odls_base_default_restart_proc(orte_proc_t *child,
      * bouncing around as we execute this app, but we will always return
      * to this place as our default directory
      */
+#if !defined(MAXPATHLEN) && defined(__GLIBC__)
+    basedir = get_current_dir_name();
+#else
     getcwd(basedir, sizeof(basedir));
+#endif
 
     /* find this child's jobdat */
     if (NULL == (jobdat = orte_get_job_data_object(child->name.jobid))) {