Benjamin Levy
2018-10-31 11:06:53 UTC
Hello. Thanks for granting me privileges to ask a new-person question. With all respect and hopes for some help. BSL
Iâm working with Dirk Eddelbuettelâs book and trying to conduct the first manual compilation with Rcpp (Listing 2.1). Iâm hitting a snag. Here are the circumstances. Perhaps the problem is my location of R in /usr/bin/ and the Rccp packages (and friends) in usr/local/lib/R/site-library/Rcpp? I put the error message at the bottom, after the system-level detail.
Operating system:
VMWare Ubuntu 18.04
Software
R (command line) 3.5.1 (it is functional); R is installed at /usr/bin/
packages installed from CRAN: Rcpp, Rcpp11, RcppArmadillo, SPREDA, RUnit, inline, rbenchmark, RInside
Installation location: /home/myDir/R/x86_64-pc-linux-gnu-library/3.5/
Visual Studio 1.28.2 with c++ and gcc (it is functional)
Installed texlive-latex-extra at command line
Edited all instances in source.list from âbionicsâ to âtrustyâ per recommendation from https://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list <https://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list>
Located in /etc/apt/
Lines added/changed are:
deb-src http://archive.ubuntu.com/ubuntu <http://archive.ubuntu.com/ubuntu> trusty main restricted #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ <http://gb.archive.ubuntu.com/ubuntu/> trusty restricted main universe multiverse #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ <http://gb.archive.ubuntu.com/ubuntu/> trusty-updates restricted main universe multiverse #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ <http://gb.archive.ubuntu.com/ubuntu/> trusty-backports main restricted universe multiverse #Added by software-properties
deb-src http://security.ubuntu.com/ubuntu <http://security.ubuntu.com/ubuntu> trusty-security restricted main universe multiverse #Added by software-properties
Fibonacci code
Located in /home/myDir/Documents/seamlessR/R examples/fibonacci.cpp
Code snippet
int fibonacci( const int x){
if(x == 0) return(0);
if(x == 1) return(1);
return(fibonacci(x-1) + fibonacci(x-2));
}
extern âCâ SEXP fibWrapper(SEXP xs){
int x = Rcpp::as<int>(as);
int fib = fibonacci(x);
return( Rcpp:wrap(fib));
}
Issued first command at Ubuntu terminal prompt from Listing 2.1
sh> PKG_CXXFLAGS="-I/usr/local/lib/R/site-library/Rcpp/include" \ PKG_LIBS="-L/home/myDir/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/libs -lRcpp" \ R CMD SHLIB fibonacci.cpp
Reply: bash: PKG_CXXFLAGS=-I/usr/local/lib/R/site-library[B/Rcpp/include: No such file or directory
Iâm working with Dirk Eddelbuettelâs book and trying to conduct the first manual compilation with Rcpp (Listing 2.1). Iâm hitting a snag. Here are the circumstances. Perhaps the problem is my location of R in /usr/bin/ and the Rccp packages (and friends) in usr/local/lib/R/site-library/Rcpp? I put the error message at the bottom, after the system-level detail.
Operating system:
VMWare Ubuntu 18.04
Software
R (command line) 3.5.1 (it is functional); R is installed at /usr/bin/
packages installed from CRAN: Rcpp, Rcpp11, RcppArmadillo, SPREDA, RUnit, inline, rbenchmark, RInside
Installation location: /home/myDir/R/x86_64-pc-linux-gnu-library/3.5/
Visual Studio 1.28.2 with c++ and gcc (it is functional)
Installed texlive-latex-extra at command line
Edited all instances in source.list from âbionicsâ to âtrustyâ per recommendation from https://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list <https://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list>
Located in /etc/apt/
Lines added/changed are:
deb-src http://archive.ubuntu.com/ubuntu <http://archive.ubuntu.com/ubuntu> trusty main restricted #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ <http://gb.archive.ubuntu.com/ubuntu/> trusty restricted main universe multiverse #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ <http://gb.archive.ubuntu.com/ubuntu/> trusty-updates restricted main universe multiverse #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ <http://gb.archive.ubuntu.com/ubuntu/> trusty-backports main restricted universe multiverse #Added by software-properties
deb-src http://security.ubuntu.com/ubuntu <http://security.ubuntu.com/ubuntu> trusty-security restricted main universe multiverse #Added by software-properties
Fibonacci code
Located in /home/myDir/Documents/seamlessR/R examples/fibonacci.cpp
Code snippet
int fibonacci( const int x){
if(x == 0) return(0);
if(x == 1) return(1);
return(fibonacci(x-1) + fibonacci(x-2));
}
extern âCâ SEXP fibWrapper(SEXP xs){
int x = Rcpp::as<int>(as);
int fib = fibonacci(x);
return( Rcpp:wrap(fib));
}
Issued first command at Ubuntu terminal prompt from Listing 2.1
sh> PKG_CXXFLAGS="-I/usr/local/lib/R/site-library/Rcpp/include" \ PKG_LIBS="-L/home/myDir/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/libs -lRcpp" \ R CMD SHLIB fibonacci.cpp
Reply: bash: PKG_CXXFLAGS=-I/usr/local/lib/R/site-library[B/Rcpp/include: No such file or directory