r - Rcpp compilation error with Shiny -
i'm getting odd behavior using latest rcpp
, r
, r-shiny-pro
, , ubuntu
. in r-studio server
can run shiny::runapp()
, see application working properly. however, when go straight to website see in chrome's javascript
console:
g++: error trying exec 'cc1plus': execvp: no such file or directory make: *** [file314215611f5d.o] error 1 warning: tools required build c++ code r not found. please install gnu development tools including c++ compiler. error in sourcecpp(code = code, env = env, rebuild = rebuild, showoutput = showoutput, : error 1 occurred building shared library.
i've tried re-installing rcpp
apt-get install r-cran-rcpp
, perhaps wrongly tried sudo apt-get install --reinstall g++-4.6
prior 1 attempt. other it's been:
follow instructions on http://cran.r-project.org/bin/linux/ubuntu/readme.html follow instructions on http://www.rstudio.com/products/shiny/download-commercial/ follow instructions on http://www.rstudio.com/products/rstudio/download-server/ sudo su - -c "r -e \"install.packages('rcpp', repos='http://cran.cnr.berkeley.edu/')\""
barring easy fix, i'm going seek on different server , perhaps create sample shiny app can share. worked fine on previous server not latest ubuntu
or professional version of r-shiny
. much appreciation help may provide. fwiw i'm using cppfunction
.
added:
i created minimal illustration , works on different server free version of shiny not other server same exact setup other shiny version. here's ui.r:
library(shiny) shinyui(fluidpage( titlepanel("rcpp check fibonacci"), sidebarlayout( sidebarpanel( numericinput("inputnumber", "input number:", 10, min = 1, max = 100) ), mainpanel( textoutput("text1") ) ) ))
and server.r:
library(shiny);library(rcpp) cppfunction( 'int fibonacci(const int x) { if (x == 0) return(0); if (x == 1) return(1); homecoming (fibonacci(x - 1)) + fibonacci(x - 2); }') shinyserver(function(input, output) { output$text1 <- rendertext({as.character(fibonacci(input$inputnumber)) }) })
added: next along able create project in r studio server bundle rcpp sourcing .cpp file:
#include <rcpp.h> using namespace rcpp; // [[rcpp::export]] int fibonacci(const int x) { if (x == 0) return(0); if (x == 1) return(1); homecoming (fibonacci(x - 1)) + fibonacci(x - 2); }
the issue first ran resolved making sure ran compileattributes()
described here. works both servers.
r shiny rcpp
No comments:
Post a Comment