[Rcpp-devel] Error running RInside examples
Dirk Eddelbuettel
edd at debian.org
Fri Jan 14 18:04:32 CET 2011
On 14 January 2011 at 11:45, amao oluwole wrote:
| Hi all,
| I hope this is the correct mailing list for this question. I have
Yes! Thanks for posting here, and welcome!
| successfully installed R-2.12.1, and the latest version of the Rcpp and RInside
| packages on a linux operating system by using the commands:
|
| install.packages("Rcpp", repos="http://R-Forge.R-project.org")
| install.packages("RInside", repos="http://R-Forge.R-project.org")
|
| I then added the bin and lib paths to my environmental variable.
|
| To test the install, I compiled the examples in RInside/inst/examples/standard
| successfully. When I tried to run the simple hello world application,
| rinside_sample0.cpp program, I got the following error:
|
| examples/standard> ./rinside_sample0
| terminate called after throwing an instance of 'Rcpp::index_out_of_bounds'
| what(): index out of bounds
| Abort
|
| examples/standard>
|
| Am I running the example executable correctly? I do not understand why the
| error occurs.
You did not supply sufficient detail.
Despite what a certain malcontent keeps repeating and misrepresenting here,
there is a release process for Rcpp. Which, inter alia, involves running all
known examples, tests, ... in Rcpp and some other packages, including RInside.
So see below for a quick 'make clean; make; ./rinside_sample0' on my machine.
I may right now be current with Rcpp from SVN rather than the released 0.9.0
but the same tests where ran with the preceding releases, incl 0.9.0, and I
could easily flip back to Rcpp if you needed to validate something.
So in short: make sure you have current and correct packages, R correctly
configured (ie the last person requesting help had not built R as a shared
library, that cannot work) and run the examples documented (ie 'make' should
do). If there are errors or warning with make, look at those.
Please do feel free to come back with further questions.
Hope this helps, Dirk
Below is a cut and pasted session copy from an emacs shell buffer where the
command gets echo'ed. This uses some compile/link flags I have in
~/.R/Makevars but that is not material either.
edd at max:~/svn/rinside/pkg/inst/examples/standard$ make clean
make clean
rm -vf rinside_callbacks0 rinside_module_sample0 rinside_sample0 rinside_sample1 rinside_sample2 rinside_sample3 rinside_sample4 rinside_sample5 rinside_sample6 rinside_sample7 rinside_sample8 rinside_sample9 rinside_test0 rinside_test1
removed `rinside_callbacks0'
removed `rinside_module_sample0'
removed `rinside_sample0'
removed `rinside_sample1'
removed `rinside_sample2'
removed `rinside_sample3'
removed `rinside_sample4'
removed `rinside_sample5'
removed `rinside_sample6'
removed `rinside_sample7'
removed `rinside_sample8'
removed `rinside_sample9'
removed `rinside_test0'
removed `rinside_test1'
rm -vrf *.dSYM
edd at max:~/svn/rinside/pkg/inst/examples/standard$ make
make
g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I"/usr/local/lib/R/site-library/RInside/include" -O3 -pipe -g -Wall rinside_callbacks0.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_callbacks0
g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I"/usr/local/lib/R/site-library/RInside/include" -O3 -pipe -g -Wall rinside_module_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_module_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" -O3 -pipe -g -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
g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I"/usr/local/lib/R/site-library/RInside/include" -O3 -pipe -g -Wall 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/include" -O3 -pipe -g -Wall 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/include" -O3 -pipe -g -Wall 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/include" -O3 -pipe -g -Wall 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/include" -O3 -pipe -g -Wall 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/include" -O3 -pipe -g -Wall 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/include" -O3 -pipe -g -Wall 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/include" -O3 -pipe -g -Wall 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/include" -O3 -pipe -g -Wall rinside_sample9.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_sample9
g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I"/usr/local/lib/R/site-library/RInside/include" -O3 -pipe -g -Wall 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/include" -O3 -pipe -g -Wall 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
edd at max:~/svn/rinside/pkg/inst/examples/standard$ ./rinside_sample0
./rinside_sample0
Hello, world!
edd at max:~/svn/rinside/pkg/inst/examples/standard$ ./rinside_sample1
./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
edd at max:~/svn/rinside/pkg/inst/examples/standard$
| Thanks!
|
| ----------------------------------------------------------------------
| _______________________________________________
| 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
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list