When you try to install an R package it fails with segmentation fault when trying to load the package

Problem

Their are a few R packages available on CRAN that need statically linked R libraries that are part of base R to install successfully.

We currently do not build Revolution R in a way that it creates these static R libraries. Specifically the R packages 'Rserve' and 'PreMiuM' depend on these static R libraries - their are some other R packages as well.

One way to tell if the package you are attempting to install needs static R libraries is to look at the output generated when you try to install it with the 'install.packages()' function. If you see a line that includes a reference to '<RHOME/lib64/R/lib' -lR' then chances are the package needs the static R libraries.

For example  (output from running 'install.packages')

g++ -shared -L/usr/local/lib64 -o PReMiuM.so PReMiuM.o postProcess.o -L/opt/revr/revr_7.3/lib64/Revo-7.3/R-3.1.1/lib64/R/lib -lR
installing to /shared/shape_tier3/common/conf/R/library_7.3/PReMiuM/libs

Solution

A workaround  for now is to wait for Revolution R 7.4. In 7.4 we provide a script to compile and install base R to customers,
'compile_cran_r.sh'. Edit this script with a text editor and add the flag:

                                                    --enable-R-static-lib

to the 'configure' line so it looks as follows:

# run configure
   
./configure --prefix=${r_prefix} --enable-R-shlib --enable-R-static-lib --with-blas --with-lapack --enable-BLAS-shlib --enable-memory-profiling CXXFLAGS=-m${bitness} CFLAGS=-m${bitness} FFLAGS=-m${bitness} LDFLAGS=-m${bitness} LIBR="-lpthread" || exit

 

After making this change, proceed with a new install of Revolution R 7.4 following the installation steps outlined
in the Linux Installation Guide for Revolution R Enterprise. Remove your existing install if necessary and reinstall
Revolution R after making this change.

When you have completed the install, try installing your R package again.  It should install successfully this time.
Properties

Article ID: 3103819 - Last Review: Nov 1, 2015 - Revision: 1

Feedback