[Rcpp-devel] RInside

Dirk Eddelbuettel edd at debian.org
Tue Jul 13 02:21:55 CEST 2010


David,

On 12 July 2010 at 16:38, Dirk Eddelbuettel wrote:
| 
| Hi David,
| 
| Thanks for hanging in there -- I think you just found a real bug on our side!
| 
| On 12 July 2010 at 17:21, David Rosengarten wrote:
| | The result of sudo apt-get install r-base-core is:
| | 
| | Reading package lists... Done
| | Building dependency tree       
| | Reading state information... Done
| | r-base-core is already the newest version.
| | r-base-core set to manually installed.
| | The following packages were automatically installed and are no longer required:
| |   linux-headers-2.6.32-21-generic linux-headers-2.6.32-21 dkms
| | Use 'apt-get autoremove' to remove them.
| | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
| | 
| | So, it looks like I should already have the shared libraries installed.  I
| | originally installed the R packages from the Ubuntu Software Center, and then I
| | installed Rcpp and RInside using install.packages() in R.  Does this give any
| | new information, or should I try uninstalling everything and starting from
| | scratch?
| 
| It's perfect. I had to scratch my head for a moment, but then I got an idea.
| 
| Here is the story I currently suspect:
| 
|  1)  r-base-core is built using shared libraries, but these are private to R
| 
|  2)  R itself sets a LD_LIBRARY_PATH in the shell script /usr/bin/R so all
|      is good for normal R use
| 
|  3)  I _used to_ add a file /etc/ld.so.conf.d/libR.conf which made the
|      'hidden' location of R visible to the system
| 
|  4)  Unfortunately, this is considered cheating and bad use by the so-called
|      Debian Policy my Debian R package has to conform to so I had to stop
|      that.
| 
|  5)  Because of 3), my systems still have /etc/ld.so.conf.d/libR.conf which
|      is why 'ldd rinside_sample0' resolves all shared libs for, but because
|      of 4) you no longer do !

That was a good theory, but it turns out that we also have a softlink in
/usr/lib/ which connects /usr/lib/libR.so to /usr/lib/R/lib/libR.so so
libR.so remains still visible even after I remove my
/etc/ld.so.conf.d/libR.conf

Hence, I don't have a good explanation as to why things to do not work at
your end.  They should. They sure do here:

edd at max:~/svn/rinside/pkg/inst/examples/standard$ rm rinside_sample0
edd at max:~/svn/rinside/pkg/inst/examples/standard$ make rinside_sample0
g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I"/usr/local/lib/R/site-library/RInside/include" -g -O2 -Wall    rinside_sample0.cpp  -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local/lib/R/site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -o rinside_sample0
edd at max:~/svn/rinside/pkg/inst/examples/standard$ ldd rinside_sample0
        linux-vdso.so.1 =>  (0x00007fffe19c9000)
        libR.so => /usr/lib/libR.so (0x00007fe40e15a000)
        libblas.so.3gf => /usr/lib/gotoblas2/libblas.so.3gf (0x00007fe40da4f000)
        liblapack.so.3gf => /usr/lib/gotoblas2/liblapack.so.3gf (0x00007fe40d05d000)
        libRcpp.so => /usr/local/lib/R/site-library/Rcpp/lib/libRcpp.so (0x00007fe40cdfb000)
        libRInside.so => /usr/local/lib/R/site-library/RInside/lib/libRInside.so (0x00007fe40cbe6000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fe40c8d1000)
        libm.so.6 => /lib/libm.so.6 (0x00007fe40c64e000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fe40c437000)
        libc.so.6 => /lib/libc.so.6 (0x00007fe40c0b3000)
        libgfortran.so.3 => /usr/lib/libgfortran.so.3 (0x00007fe40bdc6000)
        libreadline.so.6 => /lib/libreadline.so.6 (0x00007fe40bb85000)
        libpcre.so.3 => /lib/libpcre.so.3 (0x00007fe40b956000)
        libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x00007fe40b745000)
        libz.so.1 => /lib/libz.so.1 (0x00007fe40b52e000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007fe40b329000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe40e6f0000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007fe40b10c000)
        libncurses.so.5 => /lib/libncurses.so.5 (0x00007fe40aec8000)
edd at max:~/svn/rinside/pkg/inst/examples/standard$ ./rinside_sample0
Hello, world!
edd at max:~/svn/rinside/pkg/inst/examples/standard$ 

Dirk

 
| To fix this, try placing these two line in a  file /etc/ld.so.conf.d/libR.conf
| (without the leading psace, though)
| 
|        # make libR.so visible to ld.so
|        /usr/lib/R/lib
| 
| On amd64, you could also use
| 
|        # make libR.so visible to ld.so
|        /usr/lib64/R/lib
| 
| The run 'sudo ldconfig' and repeat 'ldd rinside_sample0'.  It should now find
| libR.so, and if so, you should be able to run all examples.
| 
| If this hunch is wrong we need to look somewhere else.  If the hunch is
| right, I need to modify the examples so that libR.so gets an Rpath invocation
| as we do for libRcpp.so and libRInside.so.
| 
| Hope this helps,  Dirk
| 
| 
| 
|   
| | 
| | Thanks,
| | David
| | 
| | On Mon, Jul 12, 2010 at 4:52 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
| | 
| | 
| |     David,
| | 
| |     Thanks for bringing the discussion here with is more topical for Rcpp and
| |     RInside.
| | 
| |     On 12 July 2010 at 16:34, David Rosengarten wrote:
| |     | Hi,
| |     |
| |     | I originally emailed the r-sig-debian list and was directed here.   I
| |     am
| |     | trying to run the examples in /RInside/examples/standard such as
| |     | rinside_sample_0, but I am getting the error: 
| |     |
| |     | error while loading shared libraries: libR.so: cannot open shared object
| |     file:
| |     | No such file or directory
| |     |
| |     | Does anyone know how to deal with this?  I was told to include the
| |     output of
| |     | 'make' and 'ldd ./rinside_sample0', so they are as follows:
| |     |
| |     | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include
| |     -I/usr/
| |     | local/lib/R/site-library/RInside/lib -g -O2 -Wall  -s
| |      rinside_sample0.cpp
| |     |  -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/
| |     Rcpp/
| |     | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local
| |     /lib/R
| |     | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/
| |     site-library/
| |     | RInside/lib -o rinside_sample0
| |     | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include
| |     -I/usr/
| |     | local/lib/R/site-library/RInside/lib -g -O2 -Wall  -s
| |      rinside_sample1.cpp
| |     |  -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/
| |     Rcpp/
| |     | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local
| |     /lib/R
| |     | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/
| |     site-library/
| |     | RInside/lib -o rinside_sample1
| |     | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include
| |     -I/usr/
| |     | local/lib/R/site-library/RInside/lib -g -O2 -Wall  -s
| |      rinside_sample2.cpp
| |     |  -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/
| |     Rcpp/
| |     | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local
| |     /lib/R
| |     | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/
| |     site-library/
| |     | RInside/lib -o rinside_sample2
| |     | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include
| |     -I/usr/
| |     | local/lib/R/site-library/RInside/lib -g -O2 -Wall  -s
| |      rinside_sample3.cpp
| |     |  -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/
| |     Rcpp/
| |     | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local
| |     /lib/R
| |     | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/
| |     site-library/
| |     | RInside/lib -o rinside_sample3
| |     | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include
| |     -I/usr/
| |     | local/lib/R/site-library/RInside/lib -g -O2 -Wall  -s
| |      rinside_sample4.cpp
| |     |  -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/
| |     Rcpp/
| |     | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local
| |     /lib/R
| |     | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/
| |     site-library/
| |     | RInside/lib -o rinside_sample4
| |     | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include
| |     -I/usr/
| |     | local/lib/R/site-library/RInside/lib -g -O2 -Wall  -s
| |      rinside_sample5.cpp
| |     |  -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/
| |     Rcpp/
| |     | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local
| |     /lib/R
| |     | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/
| |     site-library/
| |     | RInside/lib -o rinside_sample5
| |     | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include
| |     -I/usr/
| |     | local/lib/R/site-library/RInside/lib -g -O2 -Wall  -s
| |      rinside_sample6.cpp
| |     |  -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/
| |     Rcpp/
| |     | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local
| |     /lib/R
| |     | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/
| |     site-library/
| |     | RInside/lib -o rinside_sample6
| |     | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include
| |     -I/usr/
| |     | local/lib/R/site-library/RInside/lib -g -O2 -Wall  -s
| |      rinside_sample7.cpp
| |     |  -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/
| |     Rcpp/
| |     | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local
| |     /lib/R
| |     | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/
| |     site-library/
| |     | RInside/lib -o rinside_sample7
| |     | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include
| |     -I/usr/
| |     | local/lib/R/site-library/RInside/lib -g -O2 -Wall  -s
| |      rinside_sample8.cpp
| |     |  -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/
| |     Rcpp/
| |     | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local
| |     /lib/R
| |     | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/
| |     site-library/
| |     | RInside/lib -o rinside_sample8
| |     | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include
| |     -I/usr/
| |     | local/lib/R/site-library/RInside/lib -g -O2 -Wall  -s
| |      rinside_test0.cpp  -L
| |     | /usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/Rcpp
| |     /lib
| |     | -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local/lib
| |     /R/
| |     | site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/
| |     site-library/
| |     | RInside/lib -o rinside_test0
| |     | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include
| |     -I/usr/
| |     | local/lib/R/site-library/RInside/lib -g -O2 -Wall  -s
| |      rinside_test1.cpp  -L
| |     | /usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/Rcpp
| |     /lib
| |     | -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local/lib
| |     /R/
| |     | site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/
| |     site-library/
| |     | RInside/lib -o rinside_test1
| |     |
| |     | linux-vdso.so.1 =>  (0x00007fff30bff000)
| |     | libR.so => not found
| |     | libblas.so.3gf => /usr/lib/atlas/libblas.so.3gf (0x00007f50d2512000)
| |     | liblapack.so.3gf => /usr/lib/atlas/liblapack.so.3gf (0x00007f50d190a000)
| |     | libRcpp.so => /usr/local/lib/R/site-library/Rcpp/lib/libRcpp.so
| |     | (0x00007f50d16b2000)
| |     | libRInside.so => /usr/local/lib/R/site-library/RInside/lib/libRInside.so
| |     | (0x00007f50d149d000)
| |     | libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f50d1188000)
| |     | libm.so.6 => /lib/libm.so.6 (0x00007f50d0f05000)
| |     | libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f50d0cee000)
| |     | libc.so.6 => /lib/libc.so.6 (0x00007f50d096a000)
| |     | libgfortran.so.3 => /usr/lib/libgfortran.so.3 (0x00007f50d067d000)
| |     | /lib64/ld-linux-x86-64.so.2 (0x00007f50d2ecd000)
| |     | libR.so => not found
| |     | libR.so => not found
| | 
| |     There is your problem.
| | 
| |     | I have R and r-base-dev installed, so I don't understand why this is
| |     happening.
| |     |  Any help would be much appreciated.
| | 
| |     You may have R, but I suspect you do not have R built with shared
| |     libraries.
| |     The quickest fix, given that you started on r-sig-debian, may be
| | 
| |        $ sudo apt-get install r-base-core
| | 
| |     Else you can of course rebuild R from source etc, but you have to tell
| |     configure to use   --enable-R-shlib     or else you cannot embed R. And
| |     RInside wants to embed R, so you can't the latter witout the former.
| | 
| |     Hope this helps.
| | 
| |     --
| |      Regards, Dirk
| | 
| | 
| | 
| | ----------------------------------------------------------------------
| | _______________________________________________
| | Rcpp-devel mailing list
| | Rcpp-devel at lists.r-forge.r-project.org
| | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
| 
| -- 
|   Regards, Dirk
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-- 
  Regards, Dirk


More information about the Rcpp-devel mailing list