Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compilation failed when installing Rcpp

Tags:

r

rcpp

I'm running a virtual machine with 8GB RAM, Debian 9, R version 3.3.

I have this R script.

install.packages("Rcpp")

My machine gave me this error.

* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c api.cpp -o api.o
In file included from ../inst/include/RcppCommon.h:135:0,
                 from ../inst/include/Rcpp.h:27,
                 from api.cpp:24:
../inst/include/Rcpp/lang.h: In function ‘SEXPREC* Rcpp::Rcpp_list7(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP)’:
../inst/include/Rcpp/lang.h:45:55: error: ‘Rf_list6’ was not declared in this scope
     x0 = Rf_cons(x0, Rcpp_list6(x1, x2, x3, x4, x5, x6));
                                                       ^
../inst/include/Rcpp/lang.h: In function ‘SEXPREC* Rcpp::Rcpp_lang7(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP)’:
../inst/include/Rcpp/lang.h:53:56: error: ‘Rf_list6’ was not declared in this scope
     x0 = Rf_lcons(x0, Rcpp_list6(x1, x2, x3, x4, x5, x6));
                                                        ^
/usr/lib/R/etc/Makeconf:141: recipe for target 'api.o' failed
make: *** [api.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/home/chris/R/x86_64-pc-linux-gnu-library/3.3/Rcpp’

The downloaded source packages are in
        ‘/tmp/RtmppHiNzX/downloaded_packages’
Warning message:
In install.packages("Rcpp") :
  installation of package ‘Rcpp’ had non-zero exit status

I need to install this package. Why won't it work?

like image 626
Username Avatar asked Mar 21 '20 01:03

Username


1 Answers

You are running R 3.3.* -- a major release version made almost four years ago that is now outdated -- and you are trying to install Rcpp 1.0.4 which was released this week. A mismatch.

R 3.3.* is no longer checked at CRAN which is how the bug was missed pre-release. So you should consider upgrading---there are even backports at CRAN giving you Debian binaries for your release. Or, if you prefer old software like R 3.3.*, use an Rcpp version from four years ago as well. Demanding that mixing and matching works for all combinations is a stretch.

Now, the build issue has been discussed in issue ticket #1048 at the repo -- and a related issue #1053 affected another package. And all of this has been fixed in the PRs chronicled in the closed PR tab. So now you can access a new interim version, currently Rcpp 1.0.4.3, from the usual Rcpp 'drat' repo via

install.packages("Rcpp", repos="https://rcppcore.github.io/drat")

All this has been discussed on the rcpp-devel mailing list pointed at by the Rcpp FAQ, the package DESCRIPTION file and lot of other places.

In short, Rcpp 1.0.4 was extensively tested against all CRAN reference platforms (but that does NOT include the outdated R 3.3.* you still choose to run). Similarly, we run complete reverse dependency checks against all 1800+ CRAN packages -- but only on Linux. This takes me days. And yet this time we were bitten by a single reverse dependency issue only affecting macOS. To catch that, we need testing help from macOS users.

Similarly, it appears one BioConductor package also had an issue (similar to yours). For that, it would be nice if BioConductor users could help in testing.

And a week prior to the release we made a pre-release available and asked for testing help. These bugs could have gotten caught, but it requires more people to get involved and actually test the pre-release.

To sum up: if you want current CRAN packages such as Rcpp 1.0.4 released this week, it really is best to use (at least reasonably) current R releases preferably on reasonably current OS releases as those will get the best test coverage. More exotic combinations like the one you run risk getting bitten as you have been. We try pretty hard to avoid that, but we alone cannot test all combinations. Help is always welcome!

Edit: Forgot to add at the time that sudo apt-get install r-cran-rcpp will of course install a guaranteed-to-work version of Rcpp for you. The one from your distribution. The difficulty you are in is due to the old Debian you are running (presumably for stability reasons) and the new Rcpp. If stability is paramount, use the Rcpp your distribution release contains.

Another Edit (2020-04-09): By now, and in coordination with CRAN, the patch release Rcpp 1.0.4.6 is now on CRAN and also avoids this issue. Once again, I can only urge folks with "non-standard setups" (as defined, say, by being different from what is tested at CRAN) to test pre-releases. There is simply no other way to find out prior to a release than to test the release candidate. Help in doing that is always appreciated.

like image 183
Dirk Eddelbuettel Avatar answered Sep 30 '22 07:09

Dirk Eddelbuettel