The following patch, against openmpi v1.2.2, prevents undefined environ symbols
in the openmpi shared libraries
on MacOS X. This approach avoids the need to modifiy the configure scripts.
Jack
diff -uNr openmpi-1.2.2/ompi/communicator/comm_dyn.c
openmpi-1.2.2.environ/ompi/communicator/comm_dyn.c
--- openmpi-1.2.2/ompi/communicator/comm_dyn.c 2007-01-24 13:16:09.000000000
-0500
+++ openmpi-1.2.2.environ/ompi/communicator/comm_dyn.c 2007-05-28
16:08:20.000000000 -0400
@@ -59,7 +59,12 @@
#include "orte/runtime/runtime.h"
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#endif /* !defined(__WINDOWS__) */
static int ompi_comm_get_rport (orte_process_name_t *port,
diff -uNr openmpi-1.2.2/opal/mca/memory/ptmalloc2/arena.c
openmpi-1.2.2.environ/opal/mca/memory/ptmalloc2/arena.c
--- openmpi-1.2.2/opal/mca/memory/ptmalloc2/arena.c 2006-11-09
13:53:28.000000000 -0500
+++ openmpi-1.2.2.environ/opal/mca/memory/ptmalloc2/arena.c 2007-05-28
17:50:12.000000000 -0400
@@ -293,7 +293,12 @@
/* Initialization routine. */
#ifdef _LIBC
#include <string.h>
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **_environ;
+# endif
static char *
internal_function
diff -uNr openmpi-1.2.2/opal/tools/wrappers/opal_wrapper.c
openmpi-1.2.2.environ/opal/tools/wrappers/opal_wrapper.c
--- openmpi-1.2.2/opal/tools/wrappers/opal_wrapper.c 2007-04-19
12:30:53.000000000 -0400
+++ openmpi-1.2.2.environ/opal/tools/wrappers/opal_wrapper.c 2007-05-28
16:09:20.000000000 -0400
@@ -52,7 +52,12 @@
#include "opal/util/os_path.h"
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#define OPAL_INCLUDE_FLAG "-I"
#define OPAL_LIBDIR_FLAG "-L"
#else
diff -uNr openmpi-1.2.2/opal/util/opal_environ.c
openmpi-1.2.2.environ/opal/util/opal_environ.c
--- openmpi-1.2.2/opal/util/opal_environ.c 2007-04-19 12:30:53.000000000
-0400
+++ openmpi-1.2.2.environ/opal/util/opal_environ.c 2007-05-28
17:43:50.000000000 -0400
@@ -28,7 +28,12 @@
#include "opal/constants.h"
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char** environ;
+# endif
#endif /* !defined(__WINDOWS__) */
/*
diff -uNr openmpi-1.2.2/orte/mca/pls/bproc/pls_bproc.c
openmpi-1.2.2.environ/orte/mca/pls/bproc/pls_bproc.c
--- openmpi-1.2.2/orte/mca/pls/bproc/pls_bproc.c 2007-04-19
12:30:57.000000000 -0400
+++ openmpi-1.2.2.environ/orte/mca/pls/bproc/pls_bproc.c 2007-05-28
16:10:37.000000000 -0400
@@ -81,7 +81,12 @@
/**
* Our current evironment
*/
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
static bool daemons_launched;
static bool bynode;
diff -uNr openmpi-1.2.2/orte/mca/pls/gridengine/pls_gridengine_module.c
openmpi-1.2.2.environ/orte/mca/pls/gridengine/pls_gridengine_module.c
--- openmpi-1.2.2/orte/mca/pls/gridengine/pls_gridengine_module.c
2007-04-19 12:30:57.000000000 -0400
+++ openmpi-1.2.2.environ/orte/mca/pls/gridengine/pls_gridengine_module.c
2007-05-28 16:11:25.000000000 -0400
@@ -90,7 +90,12 @@
#include "orte/mca/pls/gridengine/pls_gridengine.h"
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#endif /* !defined(__WINDOWS__) */
orte_pls_base_module_t orte_pls_gridengine_module = {
diff -uNr openmpi-1.2.2/orte/mca/pls/poe/pls_poe_component.c
openmpi-1.2.2.environ/orte/mca/pls/poe/pls_poe_component.c
--- openmpi-1.2.2/orte/mca/pls/poe/pls_poe_component.c 2006-11-09
13:54:09.000000000 -0500
+++ openmpi-1.2.2.environ/orte/mca/pls/poe/pls_poe_component.c 2007-05-28
16:12:09.000000000 -0400
@@ -153,7 +153,12 @@
}
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#endif /* !defined(__WINDOWS__) */
/**
diff -uNr openmpi-1.2.2/orte/mca/pls/poe/pls_poe_module.c
openmpi-1.2.2.environ/orte/mca/pls/poe/pls_poe_module.c
--- openmpi-1.2.2/orte/mca/pls/poe/pls_poe_module.c 2007-02-16
13:20:49.000000000 -0500
+++ openmpi-1.2.2.environ/orte/mca/pls/poe/pls_poe_module.c 2007-05-28
16:12:53.000000000 -0400
@@ -56,7 +56,12 @@
#include "orte/mca/pls/poe/pls_poe.h"
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#endif /* !defined(__WINDOWS__) */
/*
diff -uNr openmpi-1.2.2/orte/mca/pls/rsh/pls_rsh_component.c
openmpi-1.2.2.environ/orte/mca/pls/rsh/pls_rsh_component.c
--- openmpi-1.2.2/orte/mca/pls/rsh/pls_rsh_component.c 2007-01-13
21:39:47.000000000 -0500
+++ openmpi-1.2.2.environ/orte/mca/pls/rsh/pls_rsh_component.c 2007-05-28
16:14:15.000000000 -0400
@@ -45,7 +45,12 @@
#include "orte/mca/pls/rsh/pls_rsh.h"
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#endif /* !defined(__WINDOWS__) */
/*
@@ -189,11 +194,6 @@
return ORTE_SUCCESS;
}
-
-#if !defined(__WINDOWS__)
-extern char **environ;
-#endif /* !defined(__WINDOWS__) */
-
orte_pls_base_module_t *orte_pls_rsh_component_init(int *priority)
{
char *bname;
diff -uNr openmpi-1.2.2/orte/mca/pls/rsh/pls_rsh_module.c
openmpi-1.2.2.environ/orte/mca/pls/rsh/pls_rsh_module.c
--- openmpi-1.2.2/orte/mca/pls/rsh/pls_rsh_module.c 2007-05-08
13:55:56.000000000 -0400
+++ openmpi-1.2.2.environ/orte/mca/pls/rsh/pls_rsh_module.c 2007-05-28
16:15:01.000000000 -0400
@@ -89,7 +89,12 @@
#include "orte/mca/pls/base/pls_private.h"
#include "orte/mca/pls/rsh/pls_rsh.h"
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#if OMPI_HAVE_POSIX_THREADS && OMPI_THREADS_HAVE_DIFFERENT_PIDS &&
OMPI_ENABLE_PROGRESS_THREADS
static int orte_pls_rsh_launch_threaded(orte_jobid_t jobid);
diff -uNr openmpi-1.2.2/orte/mca/pls/slurm/pls_slurm_module.c
openmpi-1.2.2.environ/orte/mca/pls/slurm/pls_slurm_module.c
--- openmpi-1.2.2/orte/mca/pls/slurm/pls_slurm_module.c 2007-04-19
12:30:57.000000000 -0400
+++ openmpi-1.2.2.environ/orte/mca/pls/slurm/pls_slurm_module.c 2007-05-28
16:15:54.000000000 -0400
@@ -110,7 +110,12 @@
* External
*/
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#endif /* !defined(__WINDOWS__) */
static int pls_slurm_launch_job(orte_jobid_t jobid)
diff -uNr openmpi-1.2.2/orte/mca/pls/tm/pls_tm_module.c
openmpi-1.2.2.environ/orte/mca/pls/tm/pls_tm_module.c
--- openmpi-1.2.2/orte/mca/pls/tm/pls_tm_module.c 2007-04-19
12:30:57.000000000 -0400
+++ openmpi-1.2.2.environ/orte/mca/pls/tm/pls_tm_module.c 2007-05-28
16:16:38.000000000 -0400
@@ -111,7 +111,12 @@
};
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#endif /* !defined(__WINDOWS__) */
static int pls_tm_launch_job(orte_jobid_t jobid)
diff -uNr openmpi-1.2.2/orte/mca/rmgr/base/rmgr_base_check_context.c
openmpi-1.2.2.environ/orte/mca/rmgr/base/rmgr_base_check_context.c
--- openmpi-1.2.2/orte/mca/rmgr/base/rmgr_base_check_context.c 2006-11-09
13:54:04.000000000 -0500
+++ openmpi-1.2.2.environ/orte/mca/rmgr/base/rmgr_base_check_context.c
2007-05-28 16:19:18.000000000 -0400
@@ -47,7 +47,12 @@
#include "orte/mca/rmgr/base/rmgr_private.h"
#if !defined(__WINDOWS__)
+# ifdef __APPLE_
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#endif /* !defined(__WINDOWS__) */
int orte_rmgr_base_check_context_cwd(orte_app_context_t *context,
diff -uNr openmpi-1.2.2/orte/runtime/orte_setup_hnp.c
openmpi-1.2.2.environ/orte/runtime/orte_setup_hnp.c
--- openmpi-1.2.2/orte/runtime/orte_setup_hnp.c 2007-01-13 21:39:47.000000000
-0500
+++ openmpi-1.2.2.environ/orte/runtime/orte_setup_hnp.c 2007-05-28
16:20:05.000000000 -0400
@@ -67,7 +67,12 @@
#include "orte/runtime/orte_setup_hnp.h"
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#endif /* !defined(__WINDOWS__) */
/* Local condition variables and mutex
diff -uNr openmpi-1.2.2/orte/tools/orted/orted.c
openmpi-1.2.2.environ/orte/tools/orted/orted.c
--- openmpi-1.2.2/orte/tools/orted/orted.c 2007-04-19 12:30:57.000000000
-0400
+++ openmpi-1.2.2.environ/orte/tools/orted/orted.c 2007-05-28
17:41:50.000000000 -0400
@@ -76,7 +76,12 @@
#include "orte/tools/orted/orted.h"
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char** environ;
+# endif
#endif /* !defined(__WINDOWS__) */
/*
diff -uNr openmpi-1.2.2/orte/tools/orterun/orterun.c
openmpi-1.2.2.environ/orte/tools/orterun/orterun.c
--- openmpi-1.2.2/orte/tools/orterun/orterun.c 2007-04-19 12:30:57.000000000
-0400
+++ openmpi-1.2.2.environ/orte/tools/orterun/orterun.c 2007-05-28
17:42:54.000000000 -0400
@@ -291,7 +291,12 @@
};
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char** environ;
+# endif
#endif /* !defined(__WINDOWS__) */
/*
* Local functions
diff -uNr openmpi-1.2.2/orte/tools/orterun/totalview.c
openmpi-1.2.2.environ/orte/tools/orterun/totalview.c
--- openmpi-1.2.2/orte/tools/orterun/totalview.c 2006-11-09
13:54:10.000000000 -0500
+++ openmpi-1.2.2.environ/orte/tools/orterun/totalview.c 2007-05-28
16:20:46.000000000 -0400
@@ -53,7 +53,12 @@
* The environment
*/
#if !defined(__WINDOWS__)
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#endif /* !defined(__WINDOWS__) */
#include "opal/util/opal_environ.h"