Hi everyone I am curremtly trying to build my package following the process in vignette but when I run the option:
pkgbuild::compile_dll()
I get the next error:
C:/Users/asael/Documents/R/win-library/3.6/StanHeaders/include/stan/math/prim/scal/meta/is_constant.hpp:27:39: error: expected primary-expression before ‘,’ token
enum { value = std::is_convertible<T, double>::value };
^
C:/Users/asael/Documents/R/win-library/3.6/StanHeaders/include/stan/math/prim/scal/meta/is_constant.hpp:27:41: error: expected identifier before ‘double’
enum { value = std::is_convertible<T, double>::value };
^
C:/Users/asael/Documents/R/win-library/3.6/StanHeaders/include/stan/math/prim/scal/meta/is_constant.hpp:27:41: error: expected ‘}’ before ‘double’
C:/Users/asael/Documents/R/win-library/3.6/StanHeaders/include/stan/math/prim/scal/meta/is_constant.hpp:27:47: error: expected unqualified-id before ‘>’ token
enum { value = std::is_convertible<T, double>::value };
^
C:/Users/asael/Documents/R/win-library/3.6/StanHeaders/include/stan/math/prim/scal/meta/is_constant.hpp:30:1: error: expected declaration before ‘}’ token
} // namespace stan
^
make: *** [C:/PROGRA~1/R/R-36~1.1/etc/x64/Makeconf:213: stanExports_NVarBekk.o] Error 1
ERROR: compilation failed for package ‘varstan’
removing ‘C:/Users/asael/AppData/Local/Temp/RtmpMRBfkL/devtools_install_3954150845bd/varstan’
Error in (function (command = NULL, args = character(), error_on_status = TRUE, :
System command error
And dont know how to solve it. Thanks for the help
bgoodri
September 25, 2019, 1:19am
#2
Most likely a C++14 thing. Make sure you have this configuration for building source packages related to RStan
jonah
September 25, 2019, 1:34am
#3
@bgoodri is there a way we can add something in rstantools to check for that config and avoid the confusing error that @asael_am had?
bgoodri
September 25, 2019, 1:46am
#4
I think we would have to do something like
Sys.setenv(CXX14 = 1)
Rcpp::evalCpp("__cplusplus >= 201402L")
@bgoodri @jonah I already have that config that I did when I install rstan for the first time.
Now when I run:
rstan_create_package(“foo_packg”)
In the src carpet rstantools creates makevar and makevars.win default files
And I put the config you recomend on it but doesnt work either way. Throws the same error
bgoodri
September 25, 2019, 3:51am
#6
Maybe do
Sys.setenv(USE_CXX14 = 1)
before doing
pkgbuild::compile_dll()
?
Now I got this error:
g++ -m64 -std=c++1y -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -I"…/inst/include" -I"C:/Users/asael/Documents/R/win-library/3.6/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I"C:/Users/asael/Documents/R/win-library/3.6/BH/include" -I"C:/Users/asael/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/asael/Documents/R/win-library/3.6/RcppEigen/include" -I"C:/Users/asael/Documents/R/win-library/3.6/rstan/include" -I"C:/Users/asael/Documents/R/win-library/3.6/StanHeaders/include" -O3 -march=native -c RcppExports.cpp -o RcppExports.o
sh: g++: command not found
make: *** [C:/PROGRA~1/R/R-36~1.1/etc/x64/Makeconf:215: RcppExports.o] Error 127
ERROR: compilation failed for package ‘varstan’
removing ‘C:/Users/asael/AppData/Local/Temp/Rtmp02QNVL/devtools_install_708259d180b/varstan’
Error in (function (command = NULL, args = character(), error_on_status = TRUE, :
System command error
When I run
pkgbuild::compile_dll()
The Makevars file in src returns to its default code
bgoodri
September 25, 2019, 4:43am
#8
What does
pkgbuild::has_build_tools(debug = TRUE)
say?
It says this:
pkgbuild::has_build_tools(debug = TRUE)
[1] TRUE
jonah
September 25, 2019, 7:58pm
#10
@bgoodri Any other ideas? Is it possibly not a C++14 issue?
@asael_am Sorry it’s still not working. Does this happen if you create the demo rstanlm package from the vignette (I presume it does) or just with your package? Also, can you compile Stan programs in general just not in the package? Or is this happening with you compile regular Stan programs too?
I DONT KNOW It says that doesnt found the g++ file: And every time I ran it the makevars files became the deffault ones.
I even try with the linear model example in the vignettes and follow the code there, but doesnt work :(
I / users of my software regularly face this problem. The advice that rtools does not need to be in the system path doesn’t seem appropriate sometimes. The ctsem github page describes some changes that should resolve the issue, assuming rtools is installed in c:\Rtools
A better solution would be wonderful, not sure what is going wrong though.
Ok nice but I dont understand you sorry, this is my first try building an R package using stan
bgoodri
September 25, 2019, 10:18pm
#14
Possibly
pkgbuild::with_build_tools(pkgbuild::compile_dll())
?
asael_am
September 26, 2019, 12:34am
#15
Still having this error:
g++ -m64 -std=c++1y -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -I"…/inst/include" -I"C:/Users/asael/Documents/R/win-library/3.6/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I"C:/Users/asael/Documents/R/win-library/3.6/BH/include" -I"C:/Users/asael/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/asael/Documents/R/win-library/3.6/RcppEigen/include" -I"C:/Users/asael/Documents/R/win-library/3.6/rstan/include" -I"C:/Users/asael/Documents/R/win-library/3.6/StanHeaders/include" -O3 -march=native -c RcppExports.cpp -o RcppExports.o
sh: g++: command not found
make: *** [C:/PROGRA~1/R/R-36~1.1/etc/x64/Makeconf:215: RcppExports.o] Error 127
ERROR: compilation failed for package ‘varstan’
removing ‘C:/Users/asael/AppData/Local/Temp/RtmpkNVqs4/devtools_install_25d875c0f57/varstan’
Error in (function (command = NULL, args = character(), error_on_status = TRUE, :
System command error
:( :(
asael_am
September 26, 2019, 12:44am
#16
I cannot run the demo rstanlm package! A I can run stan programs I actually run my package functions with the precompiled models simulating the package dynamics and everything works fine, the problem is when I try to build the package itself
asael_am
September 26, 2019, 12:58am
#17
I follow what you use in the ctsem package:
Put my stan files in the folder stan_files inside src
Change my makevar and makevar.win
Copy your tools folder with the make_cc file
Abd ran again:
The error is:
“C:/PROGRA~1/R/R-36~1.1/bin/x64/Rscript” -e “source(file.path(’…’, ‘tools’, ‘make_cc.R’)); make_cc(commandArgs(TRUE))” stan_files/NVarBekk.stan
Wrote C++ file “stan_files/NVarBekk.cc”
g++ -m64 -std=c++1y -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -I"…/inst/include" -I"C:/Users/asael/Documents/R/win-library/3.6/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -I"C:/Users/asael/Documents/R/win-library/3.6/BH/include" -I"C:/Users/asael/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/asael/Documents/R/win-library/3.6/RcppEigen/include" -I"C:/Users/asael/Documents/R/win-library/3.6/rstan/include" -I"C:/Users/asael/Documents/R/win-library/3.6/StanHeaders/include" -O3 -march=native -c stan_files/NVarBekk.cc -o stan_files/NVarBekk.o
sh: g++: command not found
make: *** [C:/PROGRA~1/R/R-36~1.1/etc/x64/Makeconf:213: stan_files/NVarBekk.o] Error 127
rm stan_files/NVarBekk.cc
ERROR: compilation failed for package ‘varstan’
removing ‘C:/Users/asael/AppData/Local/Temp/RtmpkNVqs4/devtools_install_25d8541b6ff0/varstan’
Error in (function (command = NULL, args = character(), error_on_status = TRUE, :
System command error
bgoodri
September 26, 2019, 1:56am
#18
Can you compile your package outside RStudio?
I dont know how to do that!
Do you know where I can read about it?
@bgoodri @jonah I think the real problem is here:
g++: command not found
But I dont know what it means