[R-SIG-Mac] rpy on macbook

Simon Urbanek simon.urbanek at r-project.org
Fri Jun 9 00:03:29 CEST 2006


On Jun 5, 2006, at 4:33 PM, Ruedi Fries wrote:

> There are actually two problems:
>
> [macbook:/rpy-0.99.2] fries% python setup.py build
> RHOMES= []
> Setting RHOMES to  ['/Library/Frameworks/R.framework/Resources']
> Traceback (most recent call last):
>   File "setup.py", line 80, in ?
>     RVERSION = rpy_tools.get_R_VERSION(RHOME, force_exec=True)
>   File "/rpy-0.99.2/rpy_tools.py", line 102, in get_R_VERSION
>     raise RuntimeError("Couldn't obtain version number from output\n"
> RuntimeError: Couldn't obtain version number from output
> of `R --version'.
>

This is not really Mac specific - the version string changed in R  
2.3.0 so rpy_tools needs to be adjusted:

--- rpy_tools.py        2006-06-08 23:47:09.000000000 +0200
+++ rpy-0.99.2/rpy_tools.py     2006-06-08 23:47:55.000000000 +0200
@@ -99,6 +99,8 @@
                           " `%s'.\n" % rexec )
      version = re.search("R +([0-9]\.[0-9]\.[0-9])", output)
      if not version:
+      version = re.search("R version +([0-9]\.[0-9]\.[0-9])", output)
+    if not version:
        raise RuntimeError("Couldn't obtain version number from output 
\n"
                                 "of `R --version'.\n")
      rver = version.group(1)


> [...]
> -L/Library/Frameworks/R.framework/Resources/lib -LC -LnGW\lib;C -L 
> \WinNT\System32;C -L\Windows\System32

^^ - although irrelevant (gcc ignores it) Rpy includes Windows linker  
paths here - a bad idea :)


> [...]
> /usr/bin/ld: warning can't open dynamic library:
> /Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks/R.framework/ 
> Versions/2.3/Resources/lib/libgfortran.0.dylib
> referenced fro
> /Library/Frameworks/R.framework/Resources/lib/libR.dylib (checking  
> for undefined symbols may be affected) (No such file or directory,  
> errno = 2)

For some reason you (or Rpy or python) is using the MacOSX10.4u SDK.  
If you want to do so, you have to make sure that R is included in the  
SDK. Probably the easiest solution is something like

sudo ln -s /Library /Developer/SDKs/MacOSX10.4u.sdk/Library


> [...]
> ___floatdidf referenced from libR expected to be defined in
> /Library/Frameworks/R.framework/Versions/2.3/Resources/lib/libgcc_s. 
> 1.0.dylib


Another problem - you must use the gcc 4.0.3 compiler to compile Rpy,  
otherwise wrong libraries will be pulled. Make sure it's first on the  
PATH, like

export PATH=/usr/local/gcc4.0/bin:$PATH

before compiling Rpy. To make things even more complicated, Rpy/ 
python uses flags that are Apple-only and thus incompatible with that  
compiler (at least on my PPC Mac). If that is the case for you,  
you'll need a filter that strips those parameters. You can install it  
as follows:

curl -O http://www.rosuda.org/gccf.c
gcc -s -o gcc gccf.c
sudo rm -f /usr/local/gcc4.0/bin/gcc
sudo cp gcc /usr/local/gcc4.0/bin/gcc

I'm currently on the road without access to an Intel Mac so I can do  
the forensics on my PowerMac only - let me know if you encounter  
other problems (and the above works for me).

Cheers,
Simon



More information about the R-SIG-Mac mailing list