cannin
cannin

Reputation: 3285

Set R library directory during configure when building from source on Ubuntu 16.04

Building R with these commands on Ubuntu 16.04

wget http://cran.r-project.org/src/base/R-3/R-3.4.1.tar.gz
tar -xzf R-3.4.1.tar.gz
cd R-3.4.1; ./configure --prefix=/usr/local --enable-R-shlib; make; make install

leads to the R library being set to /usr/local/lib/R/library

Whereas installing R using "apt-get install r-base" installs packages to /usr/local/lib/R/site-library

Is there a configuration option for building from source that will create /usr/local/lib/R/site-library?

Upvotes: 1

Views: 193

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368221

You may confuse a compile-time option for the top-level directory with a run-time option / configuration time option.

At compile-time you can only set the top-level via --prefix as you have done.

At run-time (ie startup or during a session) you can set the .libPath() for library(). For Debian / Ubuntu we do that in /etc/R/Renviron with this:

# edd Apr 2003  Allow local install in /usr/local, also add a directory for
#               Debian packaged CRAN packages, and finally the default dir
# edd Jul 2007  Now use R_LIBS_SITE, not R_LIBS
R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library'}

You can customize this to your heart's content. See help(Startup).

Upvotes: 1

Related Questions