1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
|
Description: Fix build problems on hurd-i386
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
Author: Pino Toscano <pino@debian.org>
Forwarded: partially
Last-Update: 2016-12-12
Index: openmpi-2.0.2/opal/util/stacktrace.c
===================================================================
--- openmpi-2.0.2.orig/opal/util/stacktrace.c
+++ openmpi-2.0.2/opal/util/stacktrace.c
@@ -445,8 +445,12 @@ int opal_util_register_stackhandlers (vo
}
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: openmpi-2.0.2/orte/mca/odls/base/odls_base_default_fns.c
===================================================================
--- openmpi-2.0.2.orig/orte/mca/odls/base/odls_base_default_fns.c
+++ openmpi-2.0.2/orte/mca/odls/base/odls_base_default_fns.c
@@ -628,7 +628,12 @@ void orte_odls_base_default_launch_local
orte_proc_t *child=NULL;
int rc=ORTE_SUCCESS;
orte_std_cntr_t proc_rank;
+
+#if !defined(MAXPATHLEN) && defined(__GLIBC__)
+ char *basedir=NULL;
+#else
char basedir[MAXPATHLEN];
+#endif
char **argvsav=NULL;
int inm, j, idx;
int total_num_local_procs = 0;
@@ -642,7 +647,11 @@ void orte_odls_base_default_launch_local
* bouncing around as we execute various apps, 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 the jobdat for this job */
if (NULL == (jobdat = orte_get_job_data_object(job))) {
@@ -1651,8 +1660,13 @@ int orte_odls_base_default_restart_proc(
int rc;
orte_app_context_t *app;
orte_job_t *jobdat;
+#if !defined(MAXPATHLEN) && defined(__GLIBC__)
+ char *basedir=NULL;
+ char *dir=NULL;
+#else
char basedir[MAXPATHLEN];
-
+#endif
+
OPAL_OUTPUT_VERBOSE((5, orte_odls_base_framework.framework_output,
"%s odls:restart_proc for proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
@@ -1662,7 +1676,11 @@ int orte_odls_base_default_restart_proc(
* 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))) {
Index: openmpi-2.0.2/ompi/include/ompi_config.h
===================================================================
--- openmpi-2.0.2.orig/ompi/include/ompi_config.h
+++ openmpi-2.0.2/ompi/include/ompi_config.h
@@ -28,6 +28,10 @@
#include "opal_config.h"
+#ifndef PATH_MAX /* Hurd */
+#define PATH_MAX 65535
+#endif
+
#define OMPI_IDENT_STRING OPAL_IDENT_STRING
/***********************************************************************
Index: openmpi-2.0.2/opal/mca/base/mca_base_var.c
===================================================================
--- openmpi-2.0.2.orig/opal/mca/base/mca_base_var.c
+++ openmpi-2.0.2/opal/mca/base/mca_base_var.c
@@ -50,6 +50,14 @@
#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: openmpi-2.0.2/test/util/opal_path_nfs.c
===================================================================
--- openmpi-2.0.2.orig/test/util/opal_path_nfs.c
+++ openmpi-2.0.2/test/util/opal_path_nfs.c
@@ -31,8 +31,10 @@
#include <dirent.h>
#include <sys/param.h>
+#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
-#ifdef HAVE_SYS_STATFS_H
+#endif
+#if defined(__linux__) /* not present on Hurd */
#include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_VFS_H
Index: openmpi-2.0.2/opal/mca/memory/patcher/memory_patcher_component.c
===================================================================
--- openmpi-2.0.2.orig/opal/mca/memory/patcher/memory_patcher_component.c
+++ openmpi-2.0.2/opal/mca/memory/patcher/memory_patcher_component.c
@@ -152,6 +152,7 @@ static void *intercept_mmap(void *start,
#endif
+#if defined (SYS_munmap)
static int (*original_munmap) (void *, size_t);
static int _intercept_munmap(void *start, size_t length)
@@ -177,6 +178,7 @@ static int intercept_munmap(void *start,
OPAL_PATCHER_END;
return result;
}
+#endif
#if defined (SYS_mremap)
@@ -484,10 +486,12 @@ static int patcher_open (void)
}
#endif
+#if defined(SYS_munmap)
rc = opal_patcher->patch_symbol ("munmap", (uintptr_t)intercept_munmap, (uintptr_t *) &original_munmap);
if (OPAL_SUCCESS != rc) {
return rc;
}
+#endif
#if defined (SYS_mremap)
rc = opal_patcher->patch_symbol ("mremap",(uintptr_t)intercept_mremap, (uintptr_t *) &original_mremap);
Index: openmpi-2.0.2/orte/include/orte_config.h
===================================================================
--- openmpi-2.0.2.orig/orte/include/orte_config.h
+++ openmpi-2.0.2/orte/include/orte_config.h
@@ -26,6 +26,13 @@
#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: openmpi-2.0.2/ompi/mca/fbtl/posix/fbtl_posix_preadv.c
===================================================================
--- openmpi-2.0.2.orig/ompi/mca/fbtl/posix/fbtl_posix_preadv.c
+++ openmpi-2.0.2/ompi/mca/fbtl/posix/fbtl_posix_preadv.c
@@ -28,6 +28,10 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
+#ifndef IOV_MAX
+#define IOV_MAX 1024
+#endif
+
ssize_t mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh )
{
/*int *fp = NULL;*/
Index: openmpi-2.0.2/ompi/mca/fbtl/posix/fbtl_posix_pwritev.c
===================================================================
--- openmpi-2.0.2.orig/ompi/mca/fbtl/posix/fbtl_posix_pwritev.c
+++ openmpi-2.0.2/ompi/mca/fbtl/posix/fbtl_posix_pwritev.c
@@ -30,6 +30,10 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
+#ifndef IOV_MAX
+#define IOV_MAX 1024
+#endif
+
ssize_t mca_fbtl_posix_pwritev(mca_io_ompio_file_t *fh )
{
/*int *fp = NULL;*/
|