[R] Solaris installation problem resolved

Richard A. O'Keefe ok at cs.otago.ac.nz
Thu Dec 9 05:27:14 CET 2004

Installing the e1071 package seemed to go fine, but when I tried to
library(e1071) it didn't work.

> library(e1071)
Loading required package: class
Error in dyn.load(x, as.logical(local), as.logical(now)) :
        unable to load shared library "/users/local/lib/R/library/e1071/libs/e1
  ld.so.1: /users/local/lib/R/bin/exec/R: fatal: relocation error: file /users/
Error in library(e1071) : package/namespace load failed for 'e1071'

This was in R 2.0.1 on Solaris 2.9:

platform sparc-sun-solaris2.9
arch     sparc               
os       solaris2.9          
system   sparc, solaris2.9   
major    2                   
minor    0.1                 
year     2004                
month    11                  
day      15                  
language R                   

It turns out that the missing function is the __Crun::pure_error() function
that the Sun C++ compiler installs in a class's virtual function table for
an abstract (= 0) method.  Still I didn't get it, and patched around the
problem, only to find that operator [] new was missing.  It finally dawned
on me that something about my installation setup was the problem, not
anything to do with e1071 as such:  it just wasn't picking up the C++
runtime libraries.

If you have installed R on a Solaris box using the Sun compilers, you can
check if you made my mistake by doing

f% /users/local/bin/R CMD config SHLIB_CXXLDFLAGS

Patching $INSTALL/lib/R/etc/Makeconf so that

f% /users/local/bin/R CMD config SHLIB_CXXLDFLAGS
-G /opt/SUNWspro/lib/CC4/libC.so /opt/SUNWspro/lib/libCrun.so

made the problem go away for me.  For other releases of the Sun C++
compiler these files will probably be different.  I found the names
libC.so and libCrun.so in the NOTES section of the CC manual page,
and used find /opt/SUNWspro ... to locate them.

There is almost certainly a better way to do this, but I thought someone
else might find this useful.

More information about the R-help mailing list