[R-SIG-Mac] R.app doesn't respect DYLD_FALLBACK_LIBRARY_PATH

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Aug 9 09:10:57 CEST 2013


R.app is a process. R is a shell script that launches a process.  Both 
inherit the environment they are launched from, but it is usually 
different from the GUI and from a terminal.

It is regarded as a security hole to allow a running process to change 
the settings of its dynamic loader (dyld on OS X), so I would not expect 
that setting such environment variables from within R.app (including 
from reading .Renviron) to affect dyld.  So if it did for Marc, I am 
surprised and would expect that hole to be plugged in due course.

It is not 'R.app doesn't respect DYLD_FALLBACK_LIBRARY_PATH': R.app 
knows nothing about it.  Rather, it is dyld which I would expect to read 
its environment variables only when the process is launched (and as 
Steve Lianoglou has pointed out, which plists are read before dyld is 
initialized for a process has changed over time).

This is not really the best way to extend the library search path.  In 
this case, for one package, the simplest way is to use -rpath when the 
package was installed (and I believe you can set or edit the runpath 
after the .so is made with install_name_tool).

On 08/08/2013 22:00, Marc Schwartz wrote:
> On Aug 8, 2013, at 3:42 PM, Tom Schoenemann <toms at indiana.edu> wrote:
>
>> Hello,
>>
>> I am trying to get a custom R package (from another group) to run on my system. If I call it from the command line r, it works fine.  If I call it from R.app, it complains with:
>>
>> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>>   unable to load shared object '/Library/Frameworks/R.framework/Versions/3.0/Resources/library/ANTsR/libs/libRantsRegistration.so':
>>   dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/ANTsR/libs/libRantsRegistration.so, 6): Library not loaded: libitkdouble-conversion-4.5.1.dylib
>>   Referenced from: /Applications/image-processing/ANTsR/src/ANTS/ANTS-build/lib/libl_antsRegistration.dylib
>>   Reason: image not found
>> Error: package or namespace load failed for ‘ANTsR’
>>
>> (ANTsR is the package I'm trying to get working)
>>
>> I CAN get it to work by doing this on the command line first:
>>
>> export DYLD_FALLBACK_LIBRARY_PATH=/Library/Frameworks/R.framework/Resources/lib
>>
>> and then also opening the R.app from the command line:
>>
>> open /Applications/R.app/
>>
>> However, I can't seem to get R.app to know about
>> export DYLD_FALLBACK_LIBRARY_PATH=/Library/Frameworks/R.framework/Resources/lib
>> unless I do it this way.
>>
>> So my questions are:
>>
>> 1) how can I get R.app to know about the DYLD_FALLBACK_LIBRARY_PATH?  I tried putting it into my .Renviron file, but it doesn't work  (maybe the syntax is supposed to be different?)
>>
>> 2) why does r on the command line know about dynamic libraries, but R.app does not?? This seems like a bug, but maybe there is a good reason for it?
>>
>> Thanks for any suggestions,
>>
>> -Tom
>
>
> In general, OSX GUI based apps do not inherit the shell environment. This is the case with Emacs on OSX for example.
>
> What is the syntax that you used in .Renviron? It should be along the lines of:
>
>    DYLD_FALLBACK_LIBRARY_PATH=/Library/Frameworks/R.framework/Resources/lib
>
> Note, do not use 'export' before the above. I just tried it here and it worked.
>
> Take a look at ?Startup for more details.
>
> Regards,
>
> Marc Schwartz
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-SIG-Mac mailing list