[R-SIG-Mac] shared library

Simon Urbanek simon.urbanek at r-project.org
Wed Sep 28 23:57:21 CEST 2005


Richard,

On Sep 28, 2005, at 12:04 PM, richard mendes wrote:

> currently i'm doing an intern ship where my assignment is building a
> pipeline between a database and r ,this has to be written in python. I
> build R from the source to try and create a shared library

You can ignore both points a) and b) on OS X. The CRAN R release  
comes with R shared library, so there is no need to re-compile R from  
that perspective.

> so that you
> can create an interface using the rpy package from python.
>
> the problem is that when i build R from the source like the readme
> tells me it still doesn't create a shared library.

It does and is called libR.dylib.

> this is what the
> readme tells me to do
>
> make distclean
> ./configure --enable-R-shlib
> make
> make install
>
> put the following line in your .bashrc (or equivalent)
> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:RHOME/bin

Those instructions are for Linux and other unices, but not for Mac OS  
X. There is no LD_LIBRARY_PATH in OS X and no need for it, either.

Unfortunately RPy is broken for any system that uses external BLAS,  
including OS X. You need to edit "setup.py" and replace
libraries=['R','Rlapack']
with
libraries=['R']
(see diff below).

@Greg: I would recommend using R CMD config to determine LDFLAGS,  
LAPACK_LIBS and friends, because the flags vary from system to system.

Once you do that, it builds and installs out of the box.

Cheers,
Simon

--- setup.py   2005-09-28 17:49:55.000000000 -0400
+++ setup.py.new    2005-09-28 17:50:06.000000000 -0400
@@ -109,7 +109,7 @@
      elif sys.platform=='darwin':
          include_dirs = [ os.path.join(RHOME.strip(), 'include'),
                           'src' ]
-        libraries=['R','Rlapack']
+        libraries=['R']
          library_dirs= r_libs
          runtime_libs = r_libs
          extra_compile_args=[]



More information about the R-SIG-Mac mailing list