An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-debian/attachments/20100712/278ed5dc/attachment.pl>
RInside
5 messages · David Rosengarten, Paul Johnson, Dirk Eddelbuettel
On 12 July 2010 at 02:24, David Rosengarten wrote:
| Hi, | | I am new to this list and apologize for my lack of experience in the | subject. Does anyone here use RInside? 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 Do you have R itself and the r-base-dev package installed? Are you Rcpp and RInside source recent and matching? Exactly what commands run when you say 'make' in that directory? We test these regularly when making new Rcpp release (just like days ago for Rcpp 0.8.4 currently waiting in CRAN's incoming and already in Debian unstable). | Does anyone know how to deal with this? I tried searching online and the | only things I found didn't help at all. We invite questions, discussions, etc for both Rcpp and RInside at the rcpp-devel list off R-Forge's page for Rcpp. You need to subscribe to post.
Regards, Dirk
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-debian/attachments/20100712/b723c7fe/attachment.pl>
6 days later
On Mon, Jul 12, 2010 at 12:40 PM, David Rosengarten
<save.of.ten at gmail.com> wrote:
Yes, I have R and r-base-dev installed, and I just did this yesterday so I am working with the newest versions of everything. ?The commands that run when I say 'make' in that directory are:
Hello, David:
I never tried RInside before, but after your post I became curious. I
checked your first message, it does not say if you installed R from
the standard packages. I think *how* R is built can have a big
effect. The instructions on RInstall say you must have R installed as
a shared library in order for this to work. Do you have a file
libR.so? (If not, then you don't) Here's what I have on Ubuntu.
$ ls -la /usr/lib64/R/lib
total 3376
drwxr-xr-x 2 root root 4096 2010-07-18 19:59 .
drwxr-xr-x 8 root root 4096 2010-06-07 11:55 ..
lrwxrwxrwx 1 root root 36 2010-07-18 19:56 libblas.so ->
/usr/lib64/libgoto2_penrynp-r1.13.so
-rw-r--r-- 1 root root 442200 2009-09-14 21:08 libguide.so
lrwxrwxrwx 1 root root 31 2010-07-18 19:59 liblapack.so ->
/usr/lib/atlas/liblapack.so.3gf
-rw-r--r-- 1 root root 3004504 2010-06-06 21:10 libR.so
If your system doesn't have libR.so, there's no happiness in your
future. Also, I notice that I have a symbolic link from that libR.so
to /usr/lib64, and if you don't have that, I expect you are in
trouble:
$ ls -la /usr/lib64/libR.so
lrwxrwxrwx 1 root root 13 2010-07-18 23:03 /usr/lib64/libR.so -> R/lib/libR.so
It is possible to build R without using the shared library. In fact,
that is the default. As far as I know, there may be some performance
advantage in NOT having libR.so. R Install manual footnote p. 38:
" We have measured 15?20% on ?i686? Linux and around 10% on ?x86_64? Linux."
RInside wants it.
But I am sure that Dirk's packages for R for Ubuntu do have the
configure line set to create an R shared library.
For me, RInside installed cleanly, but I ran into some trouble
compiling the examples. I had been fiddling around building shared
libRblas.so and changing to the GOTOBLAS2 shared blas, and I think
that confused the RInside example at runtime.
./rinside_sample3
./rinside_sample3: error while loading shared libraries: libblas.so:
cannot open shared object file: No such file or directory
That made me think that I needed to erase /usr/lib64/R/lib altogether,
make sure all that fiddling around I did was removed, and reinstall
r-base-core, r-base-dev, and the revolution-mkl package (because I
have been interested in the Intel Kernel Math library lately). After
that, I check to see where R's executable is looking for stuff
$ ldd /usr/lib64/R/bin/exec/R
linux-vdso.so.1 => (0x00007fff19fff000)
libR.so => /usr/lib/libR.so (0x00007f27542ed000)
libc.so.6 => /lib/libc.so.6 (0x00007f2753f6a000)
libblas.so.3gf => /usr/lib/atlas/libblas.so.3gf (0x00007f27535ce000)
libgfortran.so.3 => /usr/lib/libgfortran.so.3 (0x00007f27532e1000)
libm.so.6 => /lib/libm.so.6 (0x00007f275305e000)
libreadline.so.6 => /lib/libreadline.so.6 (0x00007f2752e1c000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007f2752bee000)
libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x00007f27529dd000)
libz.so.1 => /lib/libz.so.1 (0x00007f27527c5000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f27525c1000)
/lib64/ld-linux-x86-64.so.2 (0x00007f275488e000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f27523aa000)
libncurses.so.5 => /lib/libncurses.so.5 (0x00007f2752166000)
Well, it is not pointing at the Intel math libraries. Maybe that's a
good thing. I believe R is compiled against atlas, and it may be that
substituting the shared blas or lapack was causing trouble. I'll have
to try to track that down later.
Anyway, after putting R back the way nature intended, now the RInside
example does run.
Observe:
pauljohn at pols124:standard$ ./rinside_sample0
Hello, world!
pauljohn at pols124:standard$ ./rinside_sample1
Running ls()
[1] "argv" "M"
Showing M
[,1] [,2] [,3] [,4]
[1,] 0 1 2 3
[2,] 10 11 12 13
[3,] 20 21 22 23
[4,] 30 31 32 33
Showing colSums()
[1] 60 64 68 72
In C++ element 0 is 60
In C++ element 1 is 64
In C++ element 2 is 68
In C++ element 3 is 72
I'll let you know if I get to the bottom of the runtime "can't find
libblas.so" error I got before.
Oh, in case you wondered, when I compiled the example code before
reinstalling the R packages, I got the same kind of output you got
from make in the examples folder. So, clearly, being able to make the
example does not imply that the compiled example will run.
pauljohn at pols124:standard$ make
g++ -I/usr/share/R/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib -g -O2
-Wall -s rinside_sample0.cpp -L/usr/lib64/R/lib -lR -lblas -llapack
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib -lRcpp
-Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-lRInside -Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-o rinside_sample0
g++ -I/usr/share/R/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib -g -O2
-Wall -s rinside_sample1.cpp -L/usr/lib64/R/lib -lR -lblas -llapack
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib -lRcpp
-Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-lRInside -Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-o rinside_sample1
g++ -I/usr/share/R/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib -g -O2
-Wall -s rinside_sample2.cpp -L/usr/lib64/R/lib -lR -lblas -llapack
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib -lRcpp
-Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-lRInside -Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-o rinside_sample2
g++ -I/usr/share/R/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib -g -O2
-Wall -s rinside_sample3.cpp -L/usr/lib64/R/lib -lR -lblas -llapack
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib -lRcpp
-Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-lRInside -Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-o rinside_sample3
g++ -I/usr/share/R/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib -g -O2
-Wall -s rinside_sample4.cpp -L/usr/lib64/R/lib -lR -lblas -llapack
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib -lRcpp
-Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-lRInside -Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-o rinside_sample4
g++ -I/usr/share/R/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib -g -O2
-Wall -s rinside_sample5.cpp -L/usr/lib64/R/lib -lR -lblas -llapack
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib -lRcpp
-Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-lRInside -Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-o rinside_sample5
g++ -I/usr/share/R/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib -g -O2
-Wall -s rinside_sample6.cpp -L/usr/lib64/R/lib -lR -lblas -llapack
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib -lRcpp
-Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-lRInside -Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-o rinside_sample6
g++ -I/usr/share/R/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib -g -O2
-Wall -s rinside_sample7.cpp -L/usr/lib64/R/lib -lR -lblas -llapack
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib -lRcpp
-Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-lRInside -Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-o rinside_sample7
g++ -I/usr/share/R/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib -g -O2
-Wall -s rinside_sample8.cpp -L/usr/lib64/R/lib -lR -lblas -llapack
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib -lRcpp
-Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-lRInside -Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-o rinside_sample8
g++ -I/usr/share/R/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib -g -O2
-Wall -s rinside_test0.cpp -L/usr/lib64/R/lib -lR -lblas -llapack
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib -lRcpp
-Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-lRInside -Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-o rinside_test0
g++ -I/usr/share/R/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/include
-I/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib -g -O2
-Wall -s rinside_test1.cpp -L/usr/lib64/R/lib -lR -lblas -llapack
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib -lRcpp
-Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/Rcpp/lib
-L/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-lRInside -Wl,-rpath,/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.11/RInside/lib
-o rinside_test1
pauljohn at pols124:standard$
Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas
5 days later
Paul,
On 18 July 2010 at 23:43, Paul Johnson wrote:
| I never tried RInside before, but after your post I became curious. I | checked your first message, it does not say if you installed R from | the standard packages. I think *how* R is built can have a big | effect. The instructions on RInstall say you must have R installed as | a shared library in order for this to work. Do you have a file | libR.so? (If not, then you don't) Here's what I have on Ubuntu. [Lots of stuff deleted] I am not sure how helpful this post really was. You seem to spend a lot of time explaining how to overcome non-standard issue on your system --- which happens to be non-standard because of *your* local modifications. I don't believe that really warrants advertising an a list dedicated to helping Debian and Ubuntu users employ R which (at least in my book) should default to using the package management system. That is why we all use .deb-based systems in the first place. Generally speaking, on Debian/Ubuntu installing RInside is as simple as first installing Rcpp (which could even come from 'apt-get install r-cran-rcpp') followed by installing RInside from the respective CRAN sources. The default R packages (on Debian and Ubuntu) supports all this out of the box. After all, this is how I develop them, and it's similar for Romain even if he doesn't use Debian or Ubuntu. Regards, Dirk
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com