9

I am a bit confused about how to install R (via compilation) as a shared library.

The instructions here (Rpy2) say that I should do the following:

  # <go to the R source directory>
  make distclean
  ./configure --enable-R-shlib
  make
  make install

but the first make (make distclean) would remove any previous installation of R under the same directory tree (e.g. the contents of the bin folder).

What if I want to use the same installation for the R interpreter and the shared libraries? For example, say I want to use the interpreter to install R packages, and then the shared library of the installation to call R (and those packages) from Rpy2.

Otherwise, how can I install R packages for use through Rpy2?

Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564

1 Answers1

10
./configure --enable-R-shlib

Will tell to build R's shared libraries in addition to what is normally built (the executable, the documentation, etc...)

Also

make install

will install R (default is /usr/local). This is where you'll want to find your R executable. Calling make distclean will only affect the build directory, not the installed R.

lgautier
  • 11,363
  • 29
  • 42
  • +1 -- and what Laurent describes has been the default on Debian (and hence derivatives such as Ubuntu) for over a decade. And for what it is worth, I do look after the R as well as RPy and RPy2 packages which you could just install pre-built. – Dirk Eddelbuettel Nov 05 '12 at 02:11
  • Thanks! With this, if I install packages using the interpreter, will the packages be available later from the Python-RPy2 interface? – Amelio Vazquez-Reina Nov 05 '12 at 02:14
  • Yes. If custom settings for R_LIBS or the install path, you'll have to pay attention to it. – lgautier Nov 05 '12 at 16:56