[petsc-dev] Mac OS X El Capitan does not propagate DYLD_LIBRARY_PATH from parent process

Munson, Todd S. tmunson at mcs.anl.gov
Wed Oct 7 16:41:55 CDT 2015


Can you create a copy of the /usr/bin/env executable in your home directory and call that?  
I wonder if its based on the directory where the executable resides.  /usr is "protected".

Todd.

> On Oct 7, 2015, at 4:36 PM, Jed Brown <jed at jedbrown.org> wrote:
> 
> Satish Balay <balay at mcs.anl.gov> writes:
> 
>> So 'env' and 'printenv' cannont find DYLD_LIBRARY_PATH? - but 'echo' can?
> 
> $DYLD_LIBRARY_PATH is expanded by the calling shell, so this doesn't say
> anything about "echo".  Also,
> 
> $ type echo
> echo is a shell builtin
> $ type env
> env is /usr/bin/env
> $ type printenv
> printenv is /usr/bin/printenv
> 
>> Trying out code from http://stackoverflow.com/questions/2085302/printing-all-environment-variables-in-c-c
>> 
>>>>>>>>>>> 
>> balay at imav^~/junk $ cat env2.c
>> #include <stdio.h>
>> 
>> int main(int argc, char **argv, char** envp)
>> {
>>  char** env;
>>  for (env = envp; *env != 0; env++)
>>    {
>>      char* thisEnv = *env;
>>      printf("%s\n", thisEnv);    
>>    }
>>  return(0);
>> }
>> balay at imav^~/junk $ gcc env2.c
>> alay at imav^~/junk $ ./a.out |grep DYLD
>> DYLD_LIBRARY_PATH=foobar
>> balay at imav^~/junk $ 
>> 
>> <<<<<<<<<<
>> 
>> This works - but not env, printenv?
> 
> Are those executables?  If the behavior different if you copy them to
> HOME and/or rename them?




More information about the petsc-dev mailing list