[R-SIG-Mac] Cocoa gui with embedded R framework

Simon Urbanek simon.urbanek at r-project.org
Wed Mar 23 20:58:04 CET 2005

Hi Kjell,

On Mar 23, 2005, at 1:28 PM, Kjell Konis wrote:

> I am trying to build the cocoa gui with R.framework embedded as a  
> private framework.  The first thing I did was make a copy of  
> R.framework and use install_name_tool to change the install  
> location of libR.dylib to "@executable_path/../Frameworks/ 
> R.framework/Versions/2.0.1/Resources/lib/libR.dylib".  Then I  
> changed the settings in the R.xcode project to link against this  
> custom R.framework and copy it into R.app/Contents/Frameworks (for  
> some reason I had to add the full paths to R.framework/Headers and  
> R.framework/PrivateHeaders even with the framework search path set  
> to the directory containing R.framework - weird).

This is a relict from "C" ways of R - I'm not 100% sure that the fix  
is trivial, though: If you have a framework, all includes are  
referenced as <framework_name>/<includes> so instead of #include  
<R.h> it should read #include <R/R.h>. Since this affect the includes  
themselves, I'm not sure we can do this in a portable way. I didn't  
look into it more deeply yet, though. Maybe there are ways around  
this. In the meantime, you just have to add the include paths manually.

>   Anyway, the project builds successfully but fails to start  
> because the R_HOME environment variable is not set.  The only  
> mention of R_HOME I can find in R.xcode is in the Info.plist file  
> but changing the value there doesn't seem to have any effect.
> Question:
> How does the R_HOME get set when the R is launched from the cocoa gui?

Using the Info.plist file. Note, however, that if you run an  
application in Xcode, it ignores the Info.plist, so you have to set  
it in the properties of the executable instead. I think it's  
described either in the README or FAQ.


More information about the R-SIG-Mac mailing list