I’m trying to install an R package on my windows 10 PC that includes Rstan. I did not build the package myself (it was built on mac). Though the package installs fine on mac:
I believe this issue has something to do with the compiler being used: on Mac, where the installation works fine, it mentions clang as the compiler instead of g++. I know practically nothing about C, so any insight anyone has would be really appreciated. I’m happy to provide any other information that I might have left out. I’m using R version 3.6.1 and rstan version 2.19.2.
Thank you so much for your help!! Would you like to be more specific that where should I put this line on? I am so sorry about my limit knowledge in CS.
The Rstan package works well. I test with my codes. But it has problem install the DEEPest package we built based on RStan. And this package works well in MAC.
Besides I am able to install both RStan and RStanarm using “install.package” in RStudio. However I can’t use “devtools::install_github” to install RStanarm and the error message is above. g++: command not found
i need to install partialAR package but it showing the following error
Installing package into ‘C:/Users/hemant/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
installing source package ‘partialAR’ …
** using staged installation
** libs
g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-42~1.2/include" -DNDEBUG -I’C:/Users/hemant/AppData/Local/R/win-library/4.2/Rcpp/include’ -I"C:/RBuildTools/4.2/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-42~1.2/include" -DNDEBUG -I’C:/Users/hemant/AppData/Local/R/win-library/4.2/Rcpp/include’ -I"C:/RBuildTools/4.2/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c cfit.cc -o cfit.o
cfit.cc: In function ‘double loglik_par_c(Rcpp::NumericVector, double, double, double, double, double)’:
cfit.cc:171:41: error: ‘PI’ was not declared in this scope
171 | double nll = (n/2.0)log(tvar * 2.0PI) + esumsq/(2.0*tvar);
| ^~
cfit.cc: In function ‘double loglik_par_t_c(Rcpp::NumericVector, double, double, double, double, double, double)’:
cfit.cc:202:66: error: ‘PI’ was not declared in this scope
202 | double const_term = n * (lgamma((nu+1.0)0.5) - 0.5log(nu * PI) -
| ^~
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:258: cfit.o] Error 1
ERROR: compilation failed for package ‘partialAR’
removing ‘C:/Users/hemant/AppData/Local/R/win-library/4.2/partialAR’
Warning message:
In i.p(…) :
installation of package ‘C:/Users/hemant/AppData/Local/Temp/RtmpKG8NNY/file20cc1b6a198f/partialAR_1.0.12.tar.gz’ had non-zero exit status