diff --git a/libgomp/env.c b/libgomp/env.c --- a/libgomp/env.c +++ b/libgomp/env.c @@ -54,6 +54,13 @@ #include #include "thread-stacksize.h" +#ifdef __APPLE__ +# include +# define environ (*_NSGetEnviron ()) +#else +extern char **environ; +#endif + #ifndef HAVE_STRTOULL # define strtoull(ptr, eptr, base) strtoul (ptr, eptr, base) #endif @@ -2033,7 +2040,6 @@ startswith (const char *str, const char static void __attribute__((constructor)) initialize_env (void) { - extern char **environ; char **env; int omp_var, dev_num = 0, dev_num_len = 0, i; bool ignore = false;