[R] relocation error in grDevices.so

Skip Montanaro skip at pobox.com
Mon Jul 2 18:00:00 CEST 2007


(Warning: I'm not an R guy.  I'm a Python guy trying to get the
R-Python interface working again after some upgrades.)

I'm trying to upgrade our numpy/rpy/matplotlib environment (Solaris
10/Intel, Python 2.4).  In the process I found I needed to rebuild R
(2.1.1) because it was compiled with gcc 3.3.2 and we have since
migrated to gcc 3.4.1.  I'm using this configure setup:

    export CPPFLAGS=-I/opt/app/include
    export LDFLAGS='-L/opt/app/lib -R/opt/app/lib'
    ./configure --prefix=/opt/app/R-2.1.1-gcc-3.4.1

After building and installing R I downloaded and installed the
contributed quadprog library.  I ran this simple solver example using
Python+rpy which works (well, except for some R error I haven't
figured out yet) in the old installation:

    import numpy
    import rpy
    rpy.r("library(quadprog)")

    Dmat = numpy.identity(3, numpy.float_)
    print Dmat
    rpy.r.assign("Dmat", Dmat)

    dvec = numpy.array([0,5,0], numpy.float_)
    print dvec
    rpy.r.assign("dvec", dvec)

    Amat = numpy.array([[-4,-3,0], [2,1,0], [0,-2,1]], numpy.float_)
    print Amat
    rpy.r.assign("Amat", Amat.transpose())

    bvec = numpy.array([-8,2,0], numpy.float_)
    print bvec
    rpy.r.assign("bvec", bvec)

    result = rpy.r("solve.QP(Dmat, dvec, Amat, bvec=bvec)")
    print result['solution']

and get this error:

    Error in dyn.load(x, as.logical(local), as.logical(now)) :
	    unable to load shared library
'/opt/app/R-2.1.1-gcc-3.4.1/lib/R/library/grDevices/libs/grDevices.so':
      ld.so.1: python: fatal: relocation error: file
/opt/app/R-2.1.1-gcc-3.4.1/lib/R/library/grDevices/libs/grDevices.so: symbol
R_NilValue: referenced symbol not found
    Loading required package: grDevices
    Error in dyn.load(x, as.logical(local), as.logical(now)) :
	    unable to load shared library
'/opt/app/R-2.1.1-gcc-3.4.1/lib/R/library/grDevices/libs/grDevices.so':
      ld.so.1: python: fatal: relocation error: file
/opt/app/R-2.1.1-gcc-3.4.1/lib/R/library/grDevices/libs/grDevices.so: symbol
R_NilValue: referenced symbol not found
    In addition: Warning message:
    package grDevices in options("defaultPackages") was not found
    Error: package 'grDevices' could not be loaded
    Traceback (most recent call last):
      File "rpytest.py", line 3, in ?
	rpy.r("library(quadprog)")
      File
"/opt/app/g++lib6/python-2.4-pre-release/lib/python2.4/site-packages/rpy.py",
line 299, in __call__
	return self.eval(self.parse(text=s))
    rpy.RException: Error: package/namespace load failed for 'quadprog'

Looking at grDevices.so I see that it wasn't even linked against the R
library:

    % ldd /opt/app/R-2.1.1-gcc-3.4.1/lib/R/library/grDevices/libs/grDevices.so
	    libc.so.1 =>     /lib/libc.so.1
	    libm.so.2 =>     /lib/libm.so.2

so I can't see how it could possibly resolve the R_NilValue symbol.

Can someone tell me where I've gone awry?

Thanks,

Skip Montanaro
skip at pobox.com



More information about the R-help mailing list