Background
My company is thinking about bringing R into our work environment in conjunction with RStudio. As part of the security checks, we have to compile each of the different C/C++ files in a package to scan for possible security flaws. I know that the binaries are available, and I really wish that I could use them, but we have to compile ourselves. I have no R experience and a little experience with c++ from about 5 years ago. I'm trying to compile just the Rcpp C++ code and I don't know if this is possible.
What I've tried
I first tried to compile using VisualStudio and found it's not c99 compliant. I then tried cygwin and it didn't support w_strings. I have now installed ubuntu and am getting a lot of "undefined reference" errors when I compile. I know (or at least I believe) that Rcpp is designed to help use C++ in R. Given this, can I even compile some of these files as stand alone binary?
Some of the null references that I am getting while compiling api.cpp (I don't believe a complete list would provide any more information than the partial as it's quite long):
undefined reference to 'R_NilValue' undefined reference to 'REprintf' undefined reference to 'R_FlushConsole' undefined reference to 'Rf_install' undefined reference to 'Rf_setAttrib' undefined reference to 'Rf_mkChar' undefined reference to 'SET_STRING_ELT' undefined reference to 'Rf_allocVactor' undefined reference to 'R_ExternalPtrAddr' etc... Right now I assume that this isn't working because I'm not using Rcpp in the way in which it is intended and passing in any values. If I tried using another R package that uses Rcpp would that compile the Rcpp C++ files and leave the binaries? Is there anything that I can do short of just taking the binaries off of CRAN?
Solution
This was actually a relatively easy solution that I was unable to find anywhere else, although most people will simply be able to download the binary files so it won't matter.
1) Download from CRAN (not apt-get which did not work for me)
2) sudo tar -xvf Rcpp_X.XX.X.tar.gz
3) R CMD INSTALL Rcpp
This will create the binary .SO for you.
sudoto install a package.R CMD INSTALL ...happily uses a (compressed) tarball, and you can combine 1), 2) and 3) either from inside R viainstall.packages(), or, and that is my preference, by usinginstall.rfrom the littler package. As @GSee states, ensure you are a member of the group owning the/usr/local/lib/R/site-library/directory, and you won't even needsudo.