The following patch, against openmpi v1.1.5, 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.1.5/ompi/communicator/comm_dyn.c
openmpi-1.1.5.environ/ompi/communicator/comm_dyn.c
--- openmpi-1.1.5/ompi/communicator/comm_dyn.c 2007-05-27 20:27:37.000000000
-0400
+++ openmpi-1.1.5.environ/ompi/communicator/comm_dyn.c 2007-05-27
20:25:55.000000000 -0400
@@ -51,7 +51,12 @@
#include "orte/runtime/runtime.h"
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
int ompi_comm_connect_accept ( ompi_communicator_t *comm, int root,
orte_process_name_t *port, int send_first,
diff -uNr openmpi-1.1.5/opal/tools/wrappers/opal_wrapper.c
openmpi-1.1.5.environ/opal/tools/wrappers/opal_wrapper.c
--- openmpi-1.1.5/opal/tools/wrappers/opal_wrapper.c 2006-04-12
12:12:06.000000000 -0400
+++ openmpi-1.1.5.environ/opal/tools/wrappers/opal_wrapper.c 2007-05-27
20:05:22.000000000 -0400
@@ -48,7 +48,12 @@
#include "opal/util/path.h"
#include "opal/util/few.h"
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
struct {
char *language;
diff -uNr openmpi-1.1.5/opal/util/opal_environ.c
openmpi-1.1.5.environ/opal/util/opal_environ.c
--- openmpi-1.1.5/opal/util/opal_environ.c 2006-04-12 12:12:07.000000000
-0400
+++ openmpi-1.1.5.environ/opal/util/opal_environ.c 2007-05-27
20:07:07.000000000 -0400
@@ -26,7 +26,9 @@
#include "opal/util/argv.h"
#include "opal/util/opal_environ.h"
#include "opal/constants.h"
-
+# ifdef __APPLE__
+# include <crt_externs.h>
+# endif
/*
* Merge two environ-like char arrays, ensuring that there are no
@@ -93,7 +95,11 @@
int i;
char *newvalue, *compare;
size_t len;
+# ifdef __APPLE__
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
/* Make the new value */
diff -uNr openmpi-1.1.5/orte/mca/pls/base/pls_base_context.c
openmpi-1.1.5.environ/orte/mca/pls/base/pls_base_context.c
--- openmpi-1.1.5/orte/mca/pls/base/pls_base_context.c 2006-04-12
12:12:33.000000000 -0400
+++ openmpi-1.1.5.environ/orte/mca/pls/base/pls_base_context.c 2007-05-27
20:09:03.000000000 -0400
@@ -42,7 +42,12 @@
#include "orte/mca/pls/base/base.h"
#include "orte/mca/errmgr/errmgr.h"
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
int orte_pls_base_check_context_cwd(orte_app_context_t *context,
bool want_chdir)
diff -uNr openmpi-1.1.5/orte/mca/pls/bproc/pls_bproc.c
openmpi-1.1.5.environ/orte/mca/pls/bproc/pls_bproc.c
--- openmpi-1.1.5/orte/mca/pls/bproc/pls_bproc.c 2006-09-19
04:51:59.000000000 -0400
+++ openmpi-1.1.5.environ/orte/mca/pls/bproc/pls_bproc.c 2007-05-27
20:09:50.000000000 -0400
@@ -73,7 +73,12 @@
/**
* Our current evironment
*/
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#if OMPI_HAVE_POSIX_THREADS && OMPI_THREADS_HAVE_DIFFERENT_PIDS
int orte_pls_bproc_launch_threaded(orte_jobid_t);
diff -uNr openmpi-1.1.5/orte/mca/pls/fork/pls_fork_module.c
openmpi-1.1.5.environ/orte/mca/pls/fork/pls_fork_module.c
--- openmpi-1.1.5/orte/mca/pls/fork/pls_fork_module.c 2006-10-10
09:58:48.000000000 -0400
+++ openmpi-1.1.5.environ/orte/mca/pls/fork/pls_fork_module.c 2007-05-27
20:10:35.000000000 -0400
@@ -76,7 +76,12 @@
#include "orte/mca/soh/base/base.h"
#include "orte/mca/pls/fork/pls_fork.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_fork_launch_threaded(orte_jobid_t);
diff -uNr openmpi-1.1.5/orte/mca/pls/poe/pls_poe_component.c
openmpi-1.1.5.environ/orte/mca/pls/poe/pls_poe_component.c
--- openmpi-1.1.5/orte/mca/pls/poe/pls_poe_component.c 2006-04-12
12:12:33.000000000 -0400
+++ openmpi-1.1.5.environ/orte/mca/pls/poe/pls_poe_component.c 2007-05-27
20:12:18.000000000 -0400
@@ -31,6 +31,9 @@
#include "opal/util/argv.h"
#include "opal/mca/base/mca_base_param.h"
+# ifdef __APPLE__
+# include <crt_externs.h>
+# endif
/*
* Public string showing the pls ompi_poe component version number
@@ -156,7 +159,11 @@
*/
orte_pls_base_module_t *orte_pls_poe_component_init(int *priority)
{
+# ifdef __APPLE__
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
mca_pls_poe_component.path =
opal_path_findv(mca_pls_poe_component.argv[0], 0, environ, NULL);
if (NULL == mca_pls_poe_component.path) {
return NULL;
diff -uNr openmpi-1.1.5/orte/mca/pls/poe/pls_poe_module.c
openmpi-1.1.5.environ/orte/mca/pls/poe/pls_poe_module.c
--- openmpi-1.1.5/orte/mca/pls/poe/pls_poe_module.c 2006-09-19
04:51:59.000000000 -0400
+++ openmpi-1.1.5.environ/orte/mca/pls/poe/pls_poe_module.c 2007-05-27
20:13:12.000000000 -0400
@@ -48,7 +48,12 @@
#include "orte/util/session_dir.h"
#include "orte/runtime/orte_wait.h"
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
/*
* Local functions
diff -uNr openmpi-1.1.5/orte/mca/pls/rsh/pls_rsh_component.c
openmpi-1.1.5.environ/orte/mca/pls/rsh/pls_rsh_component.c
--- openmpi-1.1.5/orte/mca/pls/rsh/pls_rsh_component.c 2006-04-12
12:12:33.000000000 -0400
+++ openmpi-1.1.5.environ/orte/mca/pls/rsh/pls_rsh_component.c 2007-05-27
20:26:47.000000000 -0400
@@ -40,7 +40,12 @@
#include "opal/mca/base/mca_base_param.h"
#include "orte/mca/rml/rml.h"
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
/*
@@ -169,7 +174,6 @@
{
char *bname;
size_t i;
- extern char **environ;
/* Take the string that was given to us by the pla_rsh_agent MCA
param and search for it */
diff -uNr openmpi-1.1.5/orte/mca/pls/rsh/pls_rsh_module.c
openmpi-1.1.5.environ/orte/mca/pls/rsh/pls_rsh_module.c
--- openmpi-1.1.5/orte/mca/pls/rsh/pls_rsh_module.c 2006-07-14
12:18:58.000000000 -0400
+++ openmpi-1.1.5.environ/orte/mca/pls/rsh/pls_rsh_module.c 2007-05-27
20:16:00.000000000 -0400
@@ -84,7 +84,12 @@
#include "orte/mca/pls/rsh/pls_rsh.h"
#include "orte/util/sys_info.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
diff -uNr openmpi-1.1.5/orte/mca/pls/slurm/pls_slurm_module.c
openmpi-1.1.5.environ/orte/mca/pls/slurm/pls_slurm_module.c
--- openmpi-1.1.5/orte/mca/pls/slurm/pls_slurm_module.c 2006-07-14
12:18:58.000000000 -0400
+++ openmpi-1.1.5.environ/orte/mca/pls/slurm/pls_slurm_module.c 2007-05-27
20:16:51.000000000 -0400
@@ -99,8 +99,12 @@
/*
* External
*/
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
-
+# endif
static int pls_slurm_launch(orte_jobid_t jobid)
{
diff -uNr openmpi-1.1.5/orte/mca/pls/tm/pls_tm_module.c
openmpi-1.1.5.environ/orte/mca/pls/tm/pls_tm_module.c
--- openmpi-1.1.5/orte/mca/pls/tm/pls_tm_module.c 2006-07-14
22:08:39.000000000 -0400
+++ openmpi-1.1.5.environ/orte/mca/pls/tm/pls_tm_module.c 2007-05-27
20:17:42.000000000 -0400
@@ -95,7 +95,12 @@
};
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
static int
diff -uNr openmpi-1.1.5/orte/runtime/orte_setup_hnp.c
openmpi-1.1.5.environ/orte/runtime/orte_setup_hnp.c
--- openmpi-1.1.5/orte/runtime/orte_setup_hnp.c 2006-04-12 12:12:34.000000000
-0400
+++ openmpi-1.1.5.environ/orte/runtime/orte_setup_hnp.c 2007-05-27
20:20:07.000000000 -0400
@@ -66,7 +66,12 @@
#include "orte/runtime/runtime.h"
#include "orte/runtime/orte_setup_hnp.h"
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
/* Local condition variables and mutex
*/
diff -uNr openmpi-1.1.5/orte/tools/orted/orted.c
openmpi-1.1.5.environ/orte/tools/orted/orted.c
--- openmpi-1.1.5/orte/tools/orted/orted.c 2006-10-10 09:58:48.000000000
-0400
+++ openmpi-1.1.5.environ/orte/tools/orted/orted.c 2007-05-27
20:21:54.000000000 -0400
@@ -69,7 +69,12 @@
#include "orte/tools/orted/orted.h"
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
orted_globals_t orted_globals;
@@ -172,7 +177,6 @@
NULL, OPAL_CMD_LINE_TYPE_NULL, NULL }
};
-extern char **environ;
int main(int argc, char *argv[])
diff -uNr openmpi-1.1.5/orte/tools/orterun/orterun.c
openmpi-1.1.5.environ/orte/tools/orterun/orterun.c
--- openmpi-1.1.5/orte/tools/orterun/orterun.c 2006-10-05 22:39:54.000000000
-0400
+++ openmpi-1.1.5.environ/orte/tools/orterun/orterun.c 2007-05-27
20:23:13.000000000 -0400
@@ -74,7 +74,12 @@
/*
* The environment
*/
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char** environ;
+# endif
/*
* Globals
diff -uNr openmpi-1.1.5/orte/tools/orterun/totalview.c
openmpi-1.1.5.environ/orte/tools/orterun/totalview.c
--- openmpi-1.1.5/orte/tools/orterun/totalview.c 2006-07-14
12:21:40.000000000 -0400
+++ openmpi-1.1.5.environ/orte/tools/orterun/totalview.c 2007-05-27
20:24:03.000000000 -0400
@@ -52,7 +52,12 @@
/*
* The environment
*/
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
extern char **environ;
+# endif
#include "opal/util/opal_environ.h"
#include "opal/util/output.h"