[MacPorts] #59616: py37-numpy: Symbol not found: _environ, Referenced from: libgfortran.5.dylib, Expected in: flat namespace

MacPorts noreply at macports.org
Mon Mar 29 00:08:38 UTC 2021


#59616: py37-numpy: Symbol not found: _environ, Referenced from:
libgfortran.5.dylib, Expected in: flat namespace
-------------------------+-----------------------
  Reporter:  ryandesign  |      Owner:  michaelld
      Type:  defect      |     Status:  assigned
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:  2.6.2
Resolution:              |   Keywords:
      Port:  py-numpy    |
-------------------------+-----------------------

Comment (by kencu):

 No doubt this is a bug in libgfortran in gcc10 (at least gcc10).

 In
 {{{
 libgfortran/intrinsics/execute_command_line.c
 }}}
 we have this bit:
 {{{
 #ifdef HAVE_POSIX_SPAWN
 #include <spawn.h>
 extern char **environ;
 #endif
 }}}

 You will notice that this is just sitting loose like this:
 {{{
 extern char **environ;
 }}}

 In other files, gcc goes to great length to work around this issue, eg in
 {{{ada/env.c}}}:
 {{{
 char **
 __gnat_environ (void)
 {
 #if defined (__MINGW32__)
   return _environ;
 #elif defined (__sun__)
   extern char **_environ;
   return _environ;
 #elif defined (__APPLE__) \
      && !(defined (__arm__) \
           || defined (__arm64__)                \
           || defined (__IOS_SIMULATOR__))
   return *_NSGetEnviron ();
 #elif ! (defined (__vxworks))
   extern char **environ;
   return environ;
 #else
   #if defined (__RTP__) || defined (VTHREADS) || (_WRS_VXWORKS_MAJOR <= 6)
     return environ;
   #elif (_WRS_VXWORKS_MAJOR >= 7)
     char **task_environ;

     task_environ = envGet (taskIdSelf ());

     if (task_environ == NULL)
        return ppGlobalEnviron;
     else
        return task_environ;
   #endif
 #endif
 }
 }}}

 I'll report this upstream if it's not already reported.

 I'll see if I can come up with a workaround for us. Does anyone know with
 certainty what systems are affected by this? I can't actually see it being
 used in the 10.8 SDK, other than in PHP.
 {{{
 $ pwd
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include
 $ ag -Q *environ
 php/main/php.h
 261:extern char **environ;
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/59616#comment:9>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list