Discussion:
[Rcpp-devel] installing Rcpp and working a compilation with C++
Benjamin Levy
2018-10-31 11:06:53 UTC
Permalink
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ñaki Ucar
2018-10-31 11:27:36 UTC
Permalink
Post by Benjamin Levy
Reply: bash: PKG_CXXFLAGS=-I/usr/local/lib/R/site-library[B/Rcpp/include: No such file or directory
Note the "[B" after "site-library". Was this line manually entered or
copied from somewhere? Maybe you involuntarily copied a backspace
character.
--
Iñaki Ucar
Dirk Eddelbuettel
2018-10-31 11:52:57 UTC
Permalink
On 31 October 2018 at 12:27, Iñaki Ucar wrote:
| On Wed, 31 Oct 2018 at 12:07, Benjamin Levy <***@windstream.net> wrote:
| >
| > Reply: bash: PKG_CXXFLAGS=-I/usr/local/lib/R/site-library[B/Rcpp/include: No such file or directory
|
| Note the "[B" after "site-library". Was this line manually entered or
| copied from somewhere? Maybe you involuntarily copied a backspace
| character.

Good catch.

Also while the book is still valid, it uses the older approach. Maybe also
read the newer Rcpp-introduction vignette (included with Rcpp, also at the
CRAN page) and glance at the Rcpp-attributes vignette. Using cppFunction()
and sourceCpp() is much easier.

Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | ***@debian.org
Jeff Newmiller
2018-10-31 13:37:56 UTC
Permalink
OT:

I think this action
Edited all instances in source.list from ‘bionics’ to ‘trusty’ per
recommendation from
https://askubuntu.com/questions/0uris-in-your-sources-list>
was an ill-advised mis-interpretation of the solution you reference. The question was asked at a time when bionic did not exist, and the correct interpretation would be to first look for a solution referencing bionic or failing that to take the clue that the existing lines from yuhhour sources mention might need to mention all the trailing terms they pointed out after the distribution keyword... but they might not as these can change between distributions and over the life of a distro.

This is off-topic here... but you can really screw up your system with this mistake so I wanted to warn you and others reading this at least.
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.
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/
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
PKG_CXXFLAGS=-I/usr/local/lib/R/site-library[B/Rcpp/include: No such
file or directory
--
Sent from my phone. Please excuse my brevity.
Dirk Eddelbuettel
2018-10-31 13:58:07 UTC
Permalink
On 31 October 2018 at 06:37, Jeff Newmiller wrote:
| OT:
|
| I think this action
|
| >Edited all instances in source.list from ‘bionics’ to ‘trusty’ per
| >recommendation from
| >https://askubuntu.com/questions/0uris-in-your-sources-list>
|
| was an ill-advised mis-interpretation of the solution you reference. The question was asked at a time when bionic did not exist, and the correct interpretation would be to first look for a solution referencing bionic or failing that to take the clue that the existing lines from yuhhour sources mention might need to mention all the trailing terms they pointed out after the distribution keyword... but they might not as these can change between distributions and over the life of a distro.
|
| This is off-topic here... but you can really screw up your system with this mistake so I wanted to warn you and others reading this at least.

Agreed, and I missed that as the original message was somewhat ill-formatted.

In short: don't do that. *Every* Ubuntu release will have R (package r-base,
pulling in r-base-core and a few others) and Rcpp (package r-cran-rcpp).

Learn about Ubuntu using the appropriate forums and tutorials. We help on the
r-sig-debian list (which is for Debian and its derivatives).

Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | ***@debian.org
Dirk Eddelbuettel
2018-10-31 14:11:27 UTC
Permalink
On 31 October 2018 at 08:58, Dirk Eddelbuettel wrote:
| In short: don't do that. *Every* Ubuntu release will have R (package r-base,
| pulling in r-base-core and a few others) and Rcpp (package r-cran-rcpp).

PS Unless of course you know what you are doing. The README at
https://cloud.r-project.org/bin/linux/ubuntu/README.html
is still good.

And you don't have to use a VM to do Rcpp. It works quite well on Windows too.

Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | ***@debian.org
Loading...