expose_stan_function ends up with message:
Error in expose_stan_functions("NormRNG.stan", show_compiler_warnings = T) :
Compilation failed!
stan file “NormRNG.stan”
// This Stan defines a random normal number generator
functions {
real standard_normal_rng() {
return normal_rng(0,1);
}
}
Code for exposing:
sink("stan_model_compilation_log.txt")
expose_stan_functions("NormRNG.stan", show_compiler_warnings=T)
sink()
I tried to force C14++ but probably i have insufficient expertise.
I tried:
# Create .R directory if it doesn't exist
dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR)) dir.create(dotR)
# Create or edit Makevars.win file
makevars_path <- file.path(dotR, "Makevars.win")
if (!file.exists(makevars_path)) file.create(makevars_path)
# Add C++14 compiler flag
cat("CXX14 = g++ -std=c++1y\n", file = makevars_path, append = TRUE)
# Verify the configuration
readLines(makevars_path)
Output:
[1] "CXX14 = g++ -std=c++1y"
Then:
# Check the compiler flags
system("R CMD config CXX14")
Sys.setenv(R_MAKEVARS_USER = normalizePath("~/.R/Makevars.win"))
Still error.
Also first part of the sink if relevant:
using C++ compiler: 'G__~1.EXE (GCC) 13.2.0'
using C++17
g++ -std=gnu++17 -I"C:/PROGRA~1/R/R-44~1.0/include" -DNDEBUG -I"D:/_R/win_libary/4.0/Rcpp/include/" -I"D:/_R/win_libary/4.0/RcppEigen/include/" -I"D:/_R/win_libary/4.0/RcppEigen/include/unsupported" -I"D:/_R/win_libary/4.0/BH/include" -I"D:/_R/win_libary/4.0/StanHeaders/include/src/" -I"D:/_R/win_libary/4.0/StanHeaders/include/" -I"D:/_R/win_libary/4.0/RcppParallel/include/" -DRCPP_PARALLEL_USE_TBB=1 -I"D:/_R/win_libary/4.0/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DUSE_STANC3 -DSTRICT_R_HEADERS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -D_HAS_AUTO_PTR_ETC=0 -include "D:/_R/win_libary/4.0/StanHeaders/include/stan/math/prim/fun/Eigen.hpp" -std=c++1y -I"D:/_R/win_libary/4.0/Rcpp/include" -I"D:/_R/win_libary/4.0/StanHeaders/include" -I"D:/_R/win_libary/4.0/rstan/include" -I"D:/_R/win_libary/4.0/RcppEigen/include" -I"D:/_R/win_libary/4.0/BH/include" -I"C:/Users/censoreduser/AppData/Local/Temp/RtmpWGUQ9y/sourceCpp-x86_64-w64-mingw32-1.0.13.1" -I"c:/rtools44/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c file1628386e5dc2.cpp -o file1628386e5dc2.o
Versions in use:
Rcpp 1.0.13-1
RcppEigen 0.3.4.0.2
BH 1.84.0-0
StanHeaders 2.32.10
RcppParallel 5.1.9
Any suggestions?