Installing Rstan

I am new to Stan and am trying to install R-stan. When I try to run the Demo, I get the following error message. I have trying to implement solutions suggested in previous posts without any success

Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) :
C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.rdata$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): multiple definition of `boost::math::detail::bessel_j0(long double)::P1’; file5b854b61ca6.o:file5b854b61ca6.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): first defined hereC:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.rdata$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QC[ZZN5boost4math6detail9bessel_j0IeEE
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
'C:/Users/ALPHON~1.BER/DOCUME~1/rtools40/usr/mingw
/bin/g++’ not found

Can you try restarting R and reinstalling RStan and StanHeaders from source:

# Compile packages using all cores
Sys.setenv(MAKEFLAGS = paste0("-j",parallel::detectCores()))

install.packages(c("StanHeaders","rstan"),type="source")

Thanks for your response. Now there is a new problem

University of Venda/Documents/R/R-4.0.3/library/00LOCK-StanHeaders/00new/StanHeaders
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package ‘StanHeaders’
finding HTML links … done
CxxFlags html
stanFunction html
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘StanHeaders’ in library.dynam(lib, package, package.lib):
DLL ‘StanHeaders’ not found: maybe not installed for this architecture?
Error: loading failed
Execution halted
ERROR: loading failed

  • removing ‘C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders’
    Warning in install.packages :
    installation of package ‘StanHeaders’ had non-zero exit status
    ERROR: failed to lock directory ‘C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library’ for modifying
    Try removing ‘C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/00LOCK-rstan’
    Warning in install.packages :
    installation of package ‘rstan’ had non-zero exit status

The downloaded source packages are in
‘C:\Users\Alphonce.bere\AppData\Local\Temp\RtmpWmfjgU\downloaded_packages’

Ah, your home directory (where the packages are being installed) is a OneDrive folder. That can cause some issues. First thing to try, can you pause the synchronisation/backup for OneDrive and try the install again?

I have paused the sync but I still get

** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘StanHeaders’ in library.dynam(lib, package, package.lib):
DLL ‘StanHeaders’ not found: maybe not installed for this architecture?
Error: loading failed
Execution halted
ERROR: loading failed

  • removing ‘C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders’
    Warning in install.packages :
    installation of package ‘StanHeaders’ had non-zero exit status
    ERROR: failed to lock directory ‘C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library’ for modifying
    Try removing ‘C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/00LOCK-rstan’
    Warning in install.packages :
    installation of package ‘rstan’ had non-zero exit status

The downloaded source packages are in
‘C:\Users\Alphonce.bere\AppData\Local\Temp\RtmpwXvMEK\downloaded_packages’

Can you install any packages from source? What output do you get from:

install.packages("jsonlite",type="source")

Thanks for your response. See below

gcc.exe: error: C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/rstan/lib/x64/libStanServices.a: No such file or directory
no DLL was created
ERROR: compilation failed for package ‘jsonlite’

  • removing ‘C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/jsonlite’
  • restoring previous ‘C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/jsonlite’
    Warning in install.packages :
    installation of package ‘jsonlite’ had non-zero exit status

The downloaded source packages are in
‘C:\Users\Alphonce.bere\AppData\Local\Temp\RtmpwXvMEK\downloaded_packages’

Interesting. Can you run:

remove.packages(c("StanHeaders","rstan"))

Then restart R (need to physically close and re-open, .rs.restartR() isn’t always sufficient).

Then try jsonlite again:

install.packages("jsonlite",type="source")

If that works, then try the StanHeaders and RStan source installs again

See below and I still have non-zero exit status for Rstan and stanHeaders

install.packages(“jsonlite”,type=“source”)
trying URL ‘https://cran.rstudio.com/src/contrib/jsonlite_1.7.2.tar.gz
Content type ‘application/x-gzip’ length 421716 bytes (411 KB)
downloaded 411 KB

  • installing source package ‘jsonlite’ …
    ** package ‘jsonlite’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c collapse_array.c -o collapse_array.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c collapse_object.c -o collapse_object.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c collapse_pretty.c -o collapse_pretty.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c escape_chars.c -o escape_chars.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c integer64_to_na.c -o integer64_to_na.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c is_datelist.c -o is_datelist.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c is_recordlist.c -o is_recordlist.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c is_scalarlist.c -o is_scalarlist.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c modp_numtoa.c -o modp_numtoa.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c null_to_na.c -o null_to_na.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c num_to_char.c -o num_to_char.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c parse.c -o parse.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c prettify.c -o prettify.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c push_parser.c -o push_parser.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c r-base64.c -o r-base64.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c register.c -o register.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c row_collapse.c -o row_collapse.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c transpose_list.c -o transpose_list.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c validate.c -o validate.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c yajl/yajl.c -o yajl/yajl.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c yajl/yajl_alloc.c -o yajl/yajl_alloc.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c yajl/yajl_buf.c -o yajl/yajl_buf.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c yajl/yajl_encode.c -o yajl/yajl_encode.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c yajl/yajl_gen.c -o yajl/yajl_gen.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c yajl/yajl_lex.c -o yajl/yajl_lex.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c yajl/yajl_parser.c -o yajl/yajl_parser.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c yajl/yajl_tree.c -o yajl/yajl_tree.o
    "C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/"ar rcs yajl/libstatyajl.a yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o
    C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/gcc -shared -s -static-libgcc -o jsonlite.dll tmp.def base64.o collapse_array.o collapse_object.o collapse_pretty.o escape_chars.o integer64_to_na.o is_datelist.o is_recordlist.o is_scalarlist.o modp_numtoa.o null_to_na.o num_to_char.o parse.o prettify.o push_parser.o r-base64.o register.o row_collapse.o transpose_list.o validate.o -Lyajl -lstatyajl -LC:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/bin/x64 -lR
    installing to C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/00LOCK-jsonlite/00new/jsonlite/libs/x64
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    in method for ‘asJSON’ with signature ‘“blob”’: no definition for class “blob”
    ** help
    *** installing help indices
    converting help for package ‘jsonlite’
    finding HTML links … done
    base64 html
    flatten html
    fromJSON html
    prettify html
    rbind_pages html
    read_json html
    serializeJSON html
    stream_in html
    unbox html
    validate html
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded from temporary location
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
  • DONE (jsonlite)

The downloaded source packages are in
‘C:\Users\Alphonce.bere\AppData\Local\Temp\RtmpiyVKuO\downloaded_packages’

Can you post the full error and output for the RStan/StanHeaders installation?

Sys.setenv(MAKEFLAGS = paste0("-j",parallel::detectCores()))

install.packages(c(“StanHeaders”,“rstan”),type=“source”)
trying URL ‘https://cran.rstudio.com/src/contrib/StanHeaders_2.21.0-7.tar.gz
Content type ‘application/x-gzip’ length 1402572 bytes (1.3 MB)
downloaded 1.3 MB

  • installing source package ‘StanHeaders’ …
    ** package ‘StanHeaders’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodes_nls_stg1.c -o cvodes/cvodes_nls_stg1.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodes_nls_sim.c -o cvodes/cvodes_nls_sim.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodes_ls.c -o cvodes/cvodes_ls.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodea_io.c -o cvodes/cvodea_io.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodes_spils.c -o cvodes/cvodes_spils.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodes.c -o cvodes/cvodes.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodes_bandpre.c -o cvodes/cvodes_bandpre.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodes_bbdpre.c -o cvodes/cvodes_bbdpre.o
    cvodes/cvodes_bandpre.c: In function ‘cvBandPrecSetup’:
    cvodes/cvodes_bandpre.c:550:14: warning: ‘cns_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    conj = cns_data[j];
    ~^~~~~~~~~
    cvodes/cvodes_bandpre.c:492:35: note: ‘cns_data’ was declared here
    realtype *y_data, *ytemp_data, *cns_data;
    ^~~~~~~~
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodes_nls_stg.c -o cvodes/cvodes_nls_stg.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodea.c -o cvodes/cvodea.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodes_io.c -o cvodes/cvodes_io.o
    cvodes/cvodes_bbdpre.c: In function ‘cvBBDPrecSetup’:
    cvodes/cvodes_bbdpre.c:699:14: warning: ‘cns_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    conj = cns_data[j];
    ~^~~~~~~~~
    cvodes/cvodes_bbdpre.c:629:34: note: ‘cns_data’ was declared here
    realtype *ytemp_data, *col_j, *cns_data;
    ^~~~~~~~
    cvodes/cvodes_ls.c: In function ‘cvLsDenseDQJac’:
    cvodes/cvodes_ls.c:931:12: warning: ‘cns_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    conj = cns_data[j];
    ~^~~~~~~~~
    cvodes/cvodes.c: In function ‘cvErrHandler’:
    cvodes/cvodes.c:8793:12: warning: variable ‘cv_mem’ set but not used [-Wunused-but-set-variable]
    CVodeMem cv_mem;
    ^~~~~~
    cvodes/cvodes_ls.c: In function ‘cvLsBandDQJac’:
    cvodes/cvodes_ls.c:1023:14: warning: ‘cns_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    conj = cns_data[j];
    ~^~~~~~~~~
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodes_direct.c -o cvodes/cvodes_direct.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodes_diag.c -o cvodes/cvodes_diag.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cvodes/cvodes_nls.c -o cvodes/cvodes_nls.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_sparse.c -o sundials/sundials_sparse.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_dense.c -o sundials/sundials_dense.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_nvector_senswrapper.c -o sundials/sundials_nvector_senswrapper.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_nvector.c -o sundials/sundials_nvector.o
    sundials/sundials_sparse.c: In function ‘SparsePrintMat’:
    sundials/sundials_sparse.c:737:9: warning: variable ‘indexname’ set but not used [-Wunused-but-set-variable]
    char *indexname;
    ^~~~~~~~~
    sundials/sundials_sparse.c:736:9: warning: variable ‘matrixtype’ set but not used [-Wunused-but-set-variable]
    char *matrixtype;
    ^~~~~~~~~~
    sundials/sundials_sparse.c:735:12: warning: variable ‘NNZ’ set but not used [-Wunused-but-set-variable]
    int i,j, NNZ;
    ^~~
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_pcg.c -o sundials/sundials_pcg.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_math.c -o sundials/sundials_math.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_sptfqmr.c -o sundials/sundials_sptfqmr.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_mpi.c -o sundials/sundials_mpi.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_linearsolver.c -o sundials/sundials_linearsolver.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_iterative.c -o sundials/sundials_iterative.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_spbcgs.c -o sundials/sundials_spbcgs.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_band.c -o sundials/sundials_band.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_version.c -o sundials/sundials_version.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_nonlinearsolver.c -o sundials/sundials_nonlinearsolver.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_direct.c -o sundials/sundials_direct.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sundials/sundials_matrix.c -o sundials/sundials_matrix.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sunmatrix/band/sunmatrix_band.c -o sunmatrix/band/sunmatrix_band.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sunmatrix/dense/sunmatrix_dense.c -o sunmatrix/dense/sunmatrix_dense.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sunlinsol/band/sunlinsol_band.c -o sunlinsol/band/sunlinsol_band.o
    sundials/sundials_direct.c: In function ‘PrintMat’:
    sundials/sundials_direct.c:305:14: warning: variable ‘a’ set but not used [-Wunused-but-set-variable]
    realtype **a;
    ^
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sunlinsol/dense/sunlinsol_dense.c -o sunlinsol/dense/sunlinsol_dense.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sunnonlinsol/newton/sunnonlinsol_newton.c -o sunnonlinsol/newton/sunnonlinsol_newton.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c sunnonlinsol/fixedpoint/sunnonlinsol_fixedpoint.c -o sunnonlinsol/fixedpoint/sunnonlinsol_fixedpoint.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c idas/idas_nls.c -o idas/idas_nls.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c idas/idas_nls_sim.c -o idas/idas_nls_sim.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c idas/idas_ls.c -o idas/idas_ls.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c idas/idas.c -o idas/idas.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c idas/idas_bbdpre.c -o idas/idas_bbdpre.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c idas/idas_nls_stg.c -o idas/idas_nls_stg.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c idas/idaa_io.c -o idas/idaa_io.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c idas/idas_direct.c -o idas/idas_direct.o
    idas/idas.c: In function ‘IDAErrHandler’:
    idas/idas.c:7396:10: warning: variable ‘IDA_mem’ set but not used [-Wunused-but-set-variable]
    IDAMem IDA_mem;
    ^~~~~~~
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c idas/idas_io.c -o idas/idas_io.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c idas/idaa.c -o idas/idaa.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c idas/idas_ic.c -o idas/idas_ic.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c idas/idas_spils.c -o idas/idas_spils.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c nvector/serial/nvector_serial.c -o nvector/serial/nvector_serial.o
    “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“gcc -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -DNO_FPRINTF_OUTPUT -I”…/inst/include" -include stan_sundials_printf_override.hpp -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include’ -I’C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include’ -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c init.c -o init.o
    nvector/serial/nvector_serial.c: In function ‘N_VPrintFile_Serial’:
    nvector/serial/nvector_serial.c:289:13: warning: variable ‘xd’ set but not used [-Wunused-but-set-variable]
    realtype *xd;
    ^~
    sundials/sundials_matrix.o sunmatrix/band/sunmatrix_band.o sunmatrix/dense/sunmatrix_dense.o sunlinsol/band/sunlinsol_band.o sunlinsol/dense/sunlinsol_dense.o sunnonlinsol/newton/sunnonlinsol_newton.o sunnonlinsol/fixedpoint/sunnonlinsol_fixedpoint.o idas/idas_nls.o idas/idas_nls_sim.o idas/idas_ls.o idas/idas.o idas/idas_bbdpre.o idas/idas_nls_stg.o idas/idaa_io.o idas/idas_direct.o idas/idas_io.o idas/idaa.o idas/idas_ic.o idas/idas_spils.o nvector/serial/nvector_serial.o init.o -LC:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/bin/x64 -lR
    installing via ‘install.libs.R’ to C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/00LOCK-StanHeaders/00new/StanHeaders
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    converting help for package ‘StanHeaders’
    finding HTML links … done
    CxxFlags html
    stanFunction html
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded from temporary location
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
  • DONE (StanHeaders)
    ERROR: failed to lock directory ‘C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library’ for modifying
    Try removing ‘C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/00LOCK-rstan’
    Warning in install.packages :
    installation of package ‘rstan’ had non-zero exit status

The downloaded source packages are in
‘C:\Users\Alphonce.bere\AppData\Local\Temp\RtmpiyVKuO\downloaded_packages’

Great! Looks like StanHeaders has installed successfuly. Can you try deleting the folder that they recommended:

ERROR: failed to lock directory ‘C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library’ for modifying
Try removing ‘C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/00LOCK-rstan’

Then running the rstan-only install:

install.packages("rstan",type="source")

example(stan_model, package = “rstan”, run.dontrun = TRUE)

stn_md> stancode ← ‘data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}’

stn_md> mod ← stan_model(model_code = stancode, verbose = TRUE)

TRANSLATING MODEL ‘73fc79f8b1915e8208c736914c86d1a1’ FROM Stan CODE TO C++ CODE NOW.
successful in parsing the Stan model ‘73fc79f8b1915e8208c736914c86d1a1’.
COMPILING THE C++ CODE FOR MODEL ‘73fc79f8b1915e8208c736914c86d1a1’ NOW.
OS: x86_64, mingw32; rstan: 2.21.2; Rcpp: 1.0.5; inline: 0.3.17

setting environment variables:
LOCAL_LIBS = “C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/rstan/lib/x64/libStanServices.a” -L"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/lib/x64" -ltbb
PKG_CPPFLAGS = -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/Rcpp/include/" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include/" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include/unsupported" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/BH/include" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders/include/src/" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders/include/" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include/" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include “C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp” -std=c++1y

Program source :

1 :
2 : // includes from the plugin
3 : // [[Rcpp::plugins(cpp14)]]
4 :
5 :
6 : // user includes
7 : #include <Rcpp.h>
8 : #include <rstan/io/rlist_ref_var_context.hpp>
9 : #include <rstan/io/r_ostream.hpp>
10 : #include <rstan/stan_args.hpp>
11 : #include <boost/integer/integer_log2.hpp>
12 : // Code generated by Stan version 2.21.0
13 :
14 : #include <stan/model/model_header.hpp>
15 :
16 : namespace model1374425ea2_73fc79f8b1915e8208c736914c86d1a1_namespace {
17 :
18 : using std::istream;
19 : using std::string;
20 : using std::stringstream;
21 : using std::vector;
22 : using stan::io::dump;
23 : using stan::math::lgamma;
24 : using stan::model::prob_grad;
25 : using namespace stan::math;
26 :
27 : static int current_statement_begin__;
28 :
29 : stan::io::program_reader prog_reader__() {
30 : stan::io::program_reader reader;
31 : reader.add_event(0, 0, “start”, “model1374425ea2_73fc79f8b1915e8208c736914c86d1a1”);
32 : reader.add_event(3, 1, “end”, “model1374425ea2_73fc79f8b1915e8208c736914c86d1a1”);
33 : return reader;
34 : }
35 :
36 : class model1374425ea2_73fc79f8b1915e8208c736914c86d1a1
37 : : public stan::model::model_base_crtp<model1374425ea2_73fc79f8b1915e8208c736914c86d1a1> {
38 : private:
39 : double y_mean;
40 : public:
41 : model1374425ea2_73fc79f8b1915e8208c736914c86d1a1(rstan::io::rlist_ref_var_context& context__,
42 : std::ostream* pstream__ = 0)
43 : : model_base_crtp(0) {
44 : ctor_body(context__, 0, pstream__);
45 : }
46 :
47 : model1374425ea2_73fc79f8b1915e8208c736914c86d1a1(stan::io::var_context& context__,
48 : unsigned int random_seed__,
49 : std::ostream* pstream__ = 0)
50 : : model_base_crtp(0) {
51 : ctor_body(context__, random_seed__, pstream__);
52 : }
53 :
54 : void ctor_body(stan::io::var_context& context__,
55 : unsigned int random_seed__,
56 : std::ostream* pstream__) {
57 : typedef double local_scalar_t__;
58 :
59 : boost::ecuyer1988 base_rng__ =
60 : stan::services::util::create_rng(random_seed__, 0);
61 : (void) base_rng__; // suppress unused var warning
62 :
63 : current_statement_begin__ = -1;
64 :
65 : static const char* function__ = “model1374425ea2_73fc79f8b1915e8208c736914c86d1a1_namespace::model1374425ea2_73fc79f8b1915e8208c736914c86d1a1”;
66 : (void) function__; // dummy to suppress unused var warning
67 : size_t pos__;
68 : (void) pos__; // dummy to suppress unused var warning
69 : std::vector vals_i__;
70 : std::vector vals_r__;
71 : local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN());
72 : (void) DUMMY_VAR__; // suppress unused var warning
73 :
74 : try {
75 : // initialize data block variables from context__
76 : current_statement_begin__ = 1;
77 : context__.validate_dims(“data initialization”, “y_mean”, “double”, context__.to_vec());
78 : y_mean = double(0);
79 : vals_r__ = context__.vals_r(“y_mean”);
80 : pos__ = 0;
81 : y_mean = vals_r__[pos__++];
82 :
83 :
84 : // initialize transformed data variables
85 : // execute transformed data statements
86 :
87 : // validate transformed data
88 :
89 : // validate, set parameter ranges
90 : num_params_r__ = 0U;
91 : param_ranges_i__.clear();
92 : current_statement_begin__ = 1;
93 : num_params_r__ += 1;
94 : } catch (const std::exception& e) {
95 : stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
96 : // Next line prevents compiler griping about no return
97 : throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ");
98 : }
99 : }
100 :
101 : ~model1374425ea2_73fc79f8b1915e8208c736914c86d1a1() { }
102 :
103 :
104 : void transform_inits(const stan::io::var_context& context__,
105 : std::vector& params_i__,
106 : std::vector& params_r__,
107 : std::ostream
pstream__) const {
108 : typedef double local_scalar_t__;
109 : stan::io::writer writer__(params_r__, params_i__);
110 : size_t pos__;
111 : (void) pos__; // dummy call to supress warning
112 : std::vector vals_r__;
113 : std::vector vals_i__;
114 :
115 : current_statement_begin__ = 1;
116 : if (!(context__.contains_r(“y”)))
117 : stan::lang::rethrow_located(std::runtime_error(std::string(“Variable y missing”)), current_statement_begin__, prog_reader__());
118 : vals_r__ = context__.vals_r(“y”);
119 : pos__ = 0U;
120 : context__.validate_dims(“parameter initialization”, “y”, “double”, context__.to_vec());
121 : double y(0);
122 : y = vals_r__[pos__++];
123 : try {
124 : writer__.scalar_unconstrain(y);
125 : } catch (const std::exception& e) {
126 : stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable y: ") + e.what()), current_statement_begin__, prog_reader__());
127 : }
128 :
129 : params_r__ = writer__.data_r();
130 : params_i__ = writer__.data_i();
131 : }
132 :
133 : void transform_inits(const stan::io::var_context& context,
134 : Eigen::Matrix<double, Eigen::Dynamic, 1>& params_r,
135 : std::ostream
pstream__) const {
136 : std::vector params_r_vec;
137 : std::vector params_i_vec;
138 : transform_inits(context, params_i_vec, params_r_vec, pstream__);
139 : params_r.resize(params_r_vec.size());
140 : for (int i = 0; i < params_r.size(); ++i)
141 : params_r(i) = params_r_vec[i];
142 : }
143 :
144 :
145 : template <bool propto__, bool jacobian__, typename T__>
146 : T__ log_prob(std::vector<T__>& params_r__,
147 : std::vector& params_i__,
148 : std::ostream
pstream__ = 0) const {
149 :
150 : typedef T__ local_scalar_t__;
151 :
152 : local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN());
153 : (void) DUMMY_VAR__; // dummy to suppress unused var warning
154 :
155 : T__ lp__(0.0);
156 : stan::math::accumulator<T__> lp_accum__;
157 : try {
158 : stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);
159 :
160 : // model parameters
161 : current_statement_begin__ = 1;
162 : local_scalar_t__ y;
163 : (void) y; // dummy to suppress unused var warning
164 : if (jacobian__)
165 : y = in__.scalar_constrain(lp__);
166 : else
167 : y = in__.scalar_constrain();
168 :
169 : // model body
170 :
171 : current_statement_begin__ = 1;
172 : lp_accum__.add(normal_log<propto__>(y, y_mean, 1));
173 :
174 : } catch (const std::exception& e) {
175 : stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
176 : // Next line prevents compiler griping about no return
177 : throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ");
178 : }
179 :
180 : lp_accum__.add(lp__);
181 : return lp_accum__.sum();
182 :
183 : } // log_prob()
184 :
185 : template <bool propto, bool jacobian, typename T_>
186 : T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,
187 : std::ostream
pstream = 0) const {
188 : std::vector<T_> vec_params_r;
189 : vec_params_r.reserve(params_r.size());
190 : for (int i = 0; i < params_r.size(); ++i)
191 : vec_params_r.push_back(params_r(i));
192 : std::vector vec_params_i;
193 : return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream);
194 : }
195 :
196 :
197 : void get_param_names(std::vectorstd::string& names__) const {
198 : names__.resize(0);
199 : names__.push_back(“y”);
200 : }
201 :
202 :
203 : void get_dims(std::vector<std::vector<size_t> >& dimss__) const {
204 : dimss__.resize(0);
205 : std::vector<size_t> dims__;
206 : dims__.resize(0);
207 : dimss__.push_back(dims__);
208 : }
209 :
210 : template
211 : void write_array(RNG& base_rng__,
212 : std::vector& params_r__,
213 : std::vector& params_i__,
214 : std::vector& vars__,
215 : bool include_tparams__ = true,
216 : bool include_gqs__ = true,
217 : std::ostream
pstream__ = 0) const {
218 : typedef double local_scalar_t__;
219 :
220 : vars__.resize(0);
221 : stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);
222 : static const char
function__ = “model1374425ea2_73fc79f8b1915e8208c736914c86d1a1_namespace::write_array”;
223 : (void) function__; // dummy to suppress unused var warning
224 :
225 : // read-transform, write parameters
226 : double y = in__.scalar_constrain();
227 : vars__.push_back(y);
228 :
229 : double lp__ = 0.0;
230 : (void) lp__; // dummy to suppress unused var warning
231 : stan::math::accumulator lp_accum__;
232 :
233 : local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN());
234 : (void) DUMMY_VAR__; // suppress unused var warning
235 :
236 : if (!include_tparams__ && !include_gqs__) return;
237 :
238 : try {
239 : if (!include_gqs__ && !include_tparams__) return;
240 : if (!include_gqs__) return;
241 : } catch (const std::exception& e) {
242 : stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
243 : // Next line prevents compiler griping about no return
244 : throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ");
245 : }
246 : }
247 :
248 : template
249 : void write_array(RNG& base_rng,
250 : Eigen::Matrix<double,Eigen::Dynamic,1>& params_r,
251 : Eigen::Matrix<double,Eigen::Dynamic,1>& vars,
252 : bool include_tparams = true,
253 : bool include_gqs = true,
254 : std::ostream
pstream = 0) const {
255 : std::vector params_r_vec(params_r.size());
256 : for (int i = 0; i < params_r.size(); ++i)
257 : params_r_vec[i] = params_r(i);
258 : std::vector vars_vec;
259 : std::vector params_i_vec;
260 : write_array(base_rng, params_r_vec, params_i_vec, vars_vec, include_tparams, include_gqs, pstream);
261 : vars.resize(vars_vec.size());
262 : for (int i = 0; i < vars.size(); ++i)
263 : vars(i) = vars_vec[i];
264 : }
265 :
266 : std::string model_name() const {
267 : return “model1374425ea2_73fc79f8b1915e8208c736914c86d1a1”;
268 : }
269 :
270 :
271 : void constrained_param_names(std::vectorstd::string& param_names__,
272 : bool include_tparams__ = true,
273 : bool include_gqs__ = true) const {
274 : std::stringstream param_name_stream__;
275 : param_name_stream__.str(std::string());
276 : param_name_stream__ << “y”;
277 : param_names__.push_back(param_name_stream__.str());
278 :
279 : if (!include_gqs__ && !include_tparams__) return;
280 :
281 : if (include_tparams__) {
282 : }
283 :
284 : if (!include_gqs__) return;
285 : }
286 :
287 :
288 : void unconstrained_param_names(std::vectorstd::string& param_names__,
289 : bool include_tparams__ = true,
290 : bool include_gqs__ = true) const {
291 : std::stringstream param_name_stream__;
292 : param_name_stream__.str(std::string());
293 : param_name_stream__ << “y”;
294 : param_names__.push_back(param_name_stream__.str());
295 :
296 : if (!include_gqs__ && !include_tparams__) return;
297 :
298 : if (include_tparams__) {
299 : }
300 :
301 : if (!include_gqs__) return;
302 : }
303 :
304 : }; // model
305 :
306 : } // namespace
307 :
308 : typedef model1374425ea2_73fc79f8b1915e8208c736914c86d1a1_namespace::model1374425ea2_73fc79f8b1915e8208c736914c86d1a1 stan_model;
309 :
310 : #ifndef USING_R
311 :
312 : stan::model::model_base& new_model(
313 : stan::io::var_context& data_context,
314 : unsigned int seed,
315 : std::ostream
msg_stream) {
316 : stan_model
m = new stan_model(data_context, seed, msg_stream);
317 : return m;
318 : }
319 :
320 : #endif
321 :
322 :
323 :
324 : #include <rstan_next/stan_fit.hpp>
325 :
326 : struct stan_model_holder {
327 : stan_model_holder(rstan::io::rlist_ref_var_context rcontext,
328 : unsigned int random_seed)
329 : : rcontext_(rcontext), random_seed_(random_seed)
330 : {
331 : }
332 :
333 : //stan::math::ChainableStack ad_stack;
334 : rstan::io::rlist_ref_var_context rcontext_;
335 : unsigned int random_seed_;
336 : };
337 :
338 : Rcpp::XPtrstan::model::model_base model_ptr(stan_model_holder
smh) {
339 : Rcpp::XPtrstan::model::model_base model_instance(new stan_model(smh->rcontext_, smh->random_seed_), true);
340 : return model_instance;
341 : }
342 :
343 : Rcpp::XPtrrstan::stan_fit_base fit_ptr(stan_model_holder* smh) {
344 : return Rcpp::XPtrrstan::stan_fit_base(new rstan::stan_fit(model_ptr(smh), smh->random_seed_), true);
345 : }
346 :
347 : std::string model_name(stan_model_holder* smh) {
348 : return model_ptr(smh).get()->model_name();
349 : }
350 :
351 : RCPP_MODULE(stan_fit4model1374425ea2_73fc79f8b1915e8208c736914c86d1a1_mod){
352 : Rcpp::class_<stan_model_holder>(“stan_fit4model1374425ea2_73fc79f8b1915e8208c736914c86d1a1”)
353 : .constructor<rstan::io::rlist_ref_var_context, unsigned int>()
354 : .method(“model_ptr”, &model_ptr)
355 : .method(“fit_ptr”, &fit_ptr)
356 : .method(“model_name”, &model_name)
357 : ;
358 : }
359 :
360 :
361 : // declarations
362 : extern “C” {
363 : SEXP file137456ae2e38( ) ;
364 : }
365 :
366 : // definition
367 : SEXP file137456ae2e38() {
368 : return Rcpp::wrap(“73fc79f8b1915e8208c736914c86d1a1”);
369 : }
make cmd is
make -f “C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/etc/x64/Makeconf” -f “C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/share/make/winshlib.mk” -f “C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/.R/Makevars” CXX=’(CXX14) (CXX14STD)’ CXXFLAGS=’(CXX14FLAGS)' CXXPICFLAGS='(CXX14PICFLAGS)’ SHLIB_LDFLAGS=’(SHLIB_CXX14LDFLAGS)' SHLIB_LD='(SHLIB_CXX14LD)’ SHLIB=“file137456ae2e38.dll” WIN=64 TCLBIN=64 OBJECTS=“file137456ae2e38.o”

make would use
“C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“g++ -std=gnu++14 -I"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/include” -DNDEBUG -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/Rcpp/include/” -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include/" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppEigen/include/unsupported" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/BH/include" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders/include/src/" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders/include/" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/include/" -I"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include “C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp” -std=c++1y -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c file137456ae2e38.cpp -o file137456ae2e38.o
if test “zfile137456ae2e38.o” != “z”; then
if test -e “file137456ae2e38-win.def”; then
echo “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file137456ae2e38.dll file137456ae2e38-win.def file137456ae2e38.o “C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/rstan/lib/x64/libStanServices.a” -L"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders/libs/x64” -lStanHeaders -L"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/lib/x64” -ltbb -L"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/bin/x64" -lR ;
“C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file137456ae2e38.dll file137456ae2e38-win.def file137456ae2e38.o “C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/rstan/lib/x64/libStanServices.a” -L"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders/libs/x64” -lStanHeaders -L"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/lib/x64” -ltbb -L"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/bin/x64" -lR ;
else
echo EXPORTS > tmp.def;
“C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“nm file137456ae2e38.o | sed -n ‘s/^.* [BCDRT] / /p’ | sed -e ‘/[.]refptr[.]/d’ -e ‘/[.]weak[.]/d’ | sed 's/[^ ][^ ]*/”&”/g’ >> tmp.def;
echo “C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file137456ae2e38.dll tmp.def file137456ae2e38.o “C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/rstan/lib/x64/libStanServices.a” -L"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders/libs/x64” -lStanHeaders -L"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/lib/x64” -ltbb -L"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/bin/x64" -lR ;
“C:/Users/Alphonce.bere/Documents/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file137456ae2e38.dll tmp.def file137456ae2e38.o “C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/rstan/lib/x64/libStanServices.a” -L"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/StanHeaders/libs/x64” -lStanHeaders -L"C:/Users/Alphonce.bere/OneDrive - University of Venda/Documents/R/R-4.0.3/library/RcppParallel/lib/x64” -ltbb -L"C:/Users/ALPHON~1.BER/ONEDRI~1/DOCUME~1/R/R-40~1.3/bin/x64" -lR ;
rm -f tmp.def;
fi
fi

stn_md> fit ← sampling(mod, data = list(y_mean = 0))

stn_md> fit2 ← sampling(mod, data = list(y_mean = 5))
Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/Users/ALPHON~1.BER/DOCUME~1/rtools40/usr/mingw_/bin/g++’ not found

Great, that looks like it’s all installed and working.

The warning:

Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/Users/ALPHON~1.BER/DOCUME~1/rtools40/usr/mingw_/bin/g++’ not found

Is safe to ignore.

I appreciate your assistance

1 Like

Hi,
I also got the same error when trying to install the stan, but I couldn’t handle it. Could someone help me?

When I try the following code:

# Compile packages using all cores
Sys.setenv(MAKEFLAGS = paste0("-j",parallel::detectCores()))

install.packages(c("StanHeaders","rstan"),type="source")

I got the error

trying URL 'https://cran.rstudio.com/src/contrib/StanHeaders_2.21.0-7.tar.gz'
Content type 'application/x-gzip' length 1402572 bytes (1.3 MB)
downloaded 1.3 MB

trying URL 'https://cran.rstudio.com/src/contrib/rstan_2.21.5.tar.gz'
Content type 'application/x-gzip' length 1189130 bytes (1.1 MB)
downloaded 1.1 MB

* installing *source* package 'StanHeaders' ...
** package 'StanHeaders' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc  -I"C:/PROGRA~1/R/R-42~1.0/include" -DNDEBUG -DNO_FPRINTF_OUTPUT -I"../inst/include" -include stan_sundials_printf_override.hpp -I'C:/Program Files/R/R-4.2.0/library/RcppEigen/include' -I'C:/Program Files/R/R-4.2.0/library/RcppParallel/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c cvodes/cvodea.c -o cvodes/cvodea.o
gcc  -I"C:/PROGRA~1/R/R-42~1.0/include" -DNDEBUG -DNO_FPRINTF_OUTPUT -I"../inst/include" -include stan_sundials_printf_override.hpp -I'C:/Program Files/R/R-4.2.0/library/RcppEigen/include' -I'C:/Program Files/R/R-4.2.0/library/RcppParallel/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c cvodes/cvodea_io.c -o cvodes/cvodea_io.o
gcc  -I"C:/PROGRA~1/R/R-42~1.0/include" -DNDEBUG -DNO_FPRINTF_OUTPUT -I"../inst/include" -include stan_sundials_printf_override.hpp -I'C:/Program Files/R/R-4.2.0/library/RcppEigen/include' -I'C:/Program Files/R/R-4.2.0/library/RcppParallel/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c cvodes/cvodes.c -o cvodes/cvodes.o
gcc  -I"C:/PROGRA~1/R/R-42~1.0/include" -DNDEBUG -DNO_FPRINTF_OUTPUT -I"../inst/include" -include stan_sundials_printf_override.hpp -I'C:/Program Files/R/R-4.2.0/library/RcppEigen/include' -I'C:/Program Files/R/R-4.2.0/library/RcppParallel/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c cvodes/cvodes_bandpre.c -o cvodes/cvodes_bandpre.o
sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.0/etc/x64/Makeconf:252: cvodes/cvodea.o] Error 127
make: *** Waiting for unfinished jobs....
sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.0/etc/x64/Makeconf:252: cvodes/cvodea_io.o] Error 127
sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.0/etc/x64/Makeconf:252: cvodes/cvodes.o] Error 127
sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.0/etc/x64/Makeconf:252: cvodes/cvodes_bandpre.o] Error 127
ERROR: compilation failed for package 'StanHeaders'
* removing 'C:/Program Files/R/R-4.2.0/library/StanHeaders'
Warning in install.packages :
  installation of package ‘StanHeaders’ had non-zero exit status
ERROR: dependency 'StanHeaders' is not available for package 'rstan'
* removing 'C:/Program Files/R/R-4.2.0/library/rstan'
Warning in install.packages :
  installation of package ‘rstan’ had non-zero exit status

The downloaded source packages are in
	‘C:\Users\Administrator\AppData\Local\Temp\2\Rtmp234nIg\downloaded_packages’

I appreciate your help!

Doria

Then, we can try the following code

install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE)

I got

also installing the dependency ‘StanHeaders’

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/StanHeaders_2.21.0-7.zip'
Content type 'application/zip' length 2175305 bytes (2.1 MB)
downloaded 2.1 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/rstan_2.21.5.zip'
Content type 'application/zip' length 3584789 bytes (3.4 MB)
downloaded 3.4 MB

package ‘StanHeaders’ successfully unpacked and MD5 sums checked
package ‘rstan’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\Administrator\AppData\Local\Temp\2\RtmpoZCmho\downloaded_packages

But when I verify my installation via run the RStan example/test model:

example(stan_model, package = "rstan", run.dontrun = TRUE)

I got the error

Loading required package: StanHeaders
Loading required package: ggplot2
rstan (Version 2.21.5, GitRev: 2e1f913d3ca3)
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores()).
To avoid recompilation of unchanged Stan programs, we recommend calling
rstan_options(auto_write = TRUE)
Do not specify '-march=native' in 'LOCAL_CPPFLAGS' or a Makevars file

stn_md> stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}'

stn_md> mod <- stan_model(model_code = stancode, verbose = TRUE)

TRANSLATING MODEL '73fc79f8b1915e8208c736914c86d1a1' FROM Stan CODE TO C++ CODE NOW.
successful in parsing the Stan model '73fc79f8b1915e8208c736914c86d1a1'.
COMPILING THE C++ CODE FOR MODEL '73fc79f8b1915e8208c736914c86d1a1' NOW.
OS: x86_64, mingw32; rstan: 2.21.5; Rcpp: 1.0.8.3; inline: 0.3.19 
 >> setting environment variables: 
LOCAL_LIBS =  "C:/Program Files/R/R-4.2.0/library/rstan/lib/x64/libStanServices.a" -L"C:/Program Files/R/R-4.2.0/library/StanHeaders/libs/x64" -lStanHeaders -L"C:/Program Files/R/R-4.2.0/library/RcppParallel/lib/x64" -ltbb
PKG_CPPFLAGS =   -I"C:/Program Files/R/R-4.2.0/library/Rcpp/include/"  -I"C:/Program Files/R/R-4.2.0/library/RcppEigen/include/"  -I"C:/Program Files/R/R-4.2.0/library/RcppEigen/include/unsupported"  -I"C:/Program Files/R/R-4.2.0/library/BH/include" -I"C:/Program Files/R/R-4.2.0/library/StanHeaders/include/src/"  -I"C:/Program Files/R/R-4.2.0/library/StanHeaders/include/"  -I"C:/Program Files/R/R-4.2.0/library/RcppParallel/include/"  -I"C:/Program Files/R/R-4.2.0/library/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include "C:/Program Files/R/R-4.2.0/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp"  -std=c++1y
 >> Program source :

 
make cmd is
  make -f "C:/PROGRA~1/R/R-42~1.0/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-42~1.0/share/make/winshlib.mk" -f "C:/Users/Administrator/Documents/.R/Makevars.win" CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB="file62876db59ed.dll" WIN=64 TCLBIN= OBJECTS="file62876db59ed.o"

make would use
g++  -std=gnu++14 -I"C:/PROGRA~1/R/R-42~1.0/include" -DNDEBUG   -I"C:/Program Files/R/R-4.2.0/library/Rcpp/include/"  -I"C:/Program Files/R/R-4.2.0/library/RcppEigen/include/"  -I"C:/Program Files/R/R-4.2.0/library/RcppEigen/include/unsupported"  -I"C:/Program Files/R/R-4.2.0/library/BH/include" -I"C:/Program Files/R/R-4.2.0/library/StanHeaders/include/src/"  -I"C:/Program Files/R/R-4.2.0/library/StanHeaders/include/"  -I"C:/Program Files/R/R-4.2.0/library/RcppParallel/include/"  -I"C:/Program Files/R/R-4.2.0/library/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include "C:/Program Files/R/R-4.2.0/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp"  -std=c++1y    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -mtune=native -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -c file62876db59ed.cpp -o file62876db59ed.o
if test "zfile62876db59ed.o" != "z"; then \
  if test -e "file62876db59ed-win.def"; then \
    echo g++  -shared -s -static-libgcc -o file62876db59ed.dll file62876db59ed-win.def file62876db59ed.o  -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib"  -L"C:/PROGRA~1/R/R-42~1.0/bin/x64" -lR ; \
    g++  -shared -s -static-libgcc -o file62876db59ed.dll file62876db59ed-win.def file62876db59ed.o  -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib"  -L"C:/PROGRA~1/R/R-42~1.0/bin/x64" -lR ; \
  else \
    echo EXPORTS > tmp.def; \
    nm file62876db59ed.o | sed -n 's/^.* [BCDRT] / /p' | sed -e '/[.]refptr[.]/d' -e '/[.]weak[.]/d' | sed 's/[^ ][^ ]*/"&"/g'  >> tmp.def; \
    echo g++  -shared -s -static-libgcc -o file62876db59ed.dll tmp.def file62876db59ed.o  -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib"  -L"C:/PROGRA~1/R/R-42~1.0/bin/x64" -lR ; \
    g++  -shared -s -static-libgcc -o file62876db59ed.dll tmp.def file62876db59ed.o  -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib"  -L"C:/PROGRA~1/R/R-42~1.0/bin/x64" -lR ; \
    rm -f tmp.def; \
  fi \
fi

ERROR(s) during compilation: source code errors or compiler configuration errors!

Program source:
  1: 
  2: // includes from the plugin
  3: // [[Rcpp::plugins(cpp14)]]
  4: 
  5: 
  6: // user includes
  7: #include <Rcpp.h>
  8: #include <rstan/io/rlist_ref_var_context.hpp>
  9: #include <rstan/io/r_ostream.hpp>
 10: #include <rstan/stan_args.hpp>
 11: #include <boost/integer/integer_log2.hpp>
 12: // Code generated by Stan version 2.21.0
 13: 
 14: #include <stan/model/model_header.hpp>
 15: 
 16: namespace model628597753cd_73fc79f8b1915e8208c736914c86d1a1_namespace {
 17: 
 18: using std::istream;
 19: using std::string;
 20: using std::stringstream;
 21: using std::vector;
 22: using stan::io::dump;
 23: using stan::math::lgamma;
 24: using stan::model::prob_grad;
 25: using namespace stan::math;
 26: 
 27: static int current_statement_begin__;
 28: 
 29: stan::io::program_reader prog_reader__() {
 30:     stan::io::program_reader reader;
 31:     reader.add_event(0, 0, "start", "model628597753cd_73fc79f8b1915e8208c736914c86d1a1");
 32:     reader.add_event(3, 1, "end", "model628597753cd_73fc79f8b1915e8208c736914c86d1a1");
 33:     return reader;
 34: }
 35: 
 36: class model628597753cd_73fc79f8b1915e8208c736914c86d1a1
 37:   : public stan::model::model_base_crtp<model628597753cd_73fc79f8b1915e8208c736914c86d1a1> {
 38: private:
 39:         double y_mean;
 40: public:
 41:     model628597753cd_73fc79f8b1915e8208c736914c86d1a1(rstan::io::rlist_ref_var_context& context__,
 42:         std::ostream* pstream__ = 0)
 43:         : model_base_crtp(0) {
 44:         ctor_body(context__, 0, pstream__);
 45:     }
 46: 
 47:     model628597753cd_73fc79f8b1915e8208c736914c86d1a1(stan::io::var_context& context__,
 48:         unsigned int random_seed__,
 49:         std::ostream* pstream__ = 0)
 50:         : model_base_crtp(0) {
 51:         ctor_body(context__, random_seed__, pstream__);
 52:     }
 53: 
 54:     void ctor_body(stan::io::var_context& context__,
 55:                    unsigned int random_seed__,
 56:                    std::ostream* pstream__) {
 57:         typedef double local_scalar_t__;
 58: 
 59:         boost::ecuyer1988 base_rng__ =
 60:           stan::services::util::create_rng(random_seed__, 0);
 61:         (void) base_rng__;  // suppress unused var warning
 62: 
 63:         current_statement_begin__ = -1;
 64: 
 65:         static const char* function__ = "model628597753cd_73fc79f8b1915e8208c736914c86d1a1_namespace::model628597753cd_73fc79f8b1915e8208c736914c86d1a1";
 66:         (void) function__;  // dummy to suppress unused var warning
 67:         size_t pos__;
 68:         (void) pos__;  // dummy to suppress unused var warning
 69:         std::vector<int> vals_i__;
 70:         std::vector<double> vals_r__;
 71:         local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
 72:         (void) DUMMY_VAR__;  // suppress unused var warning
 73: 
 74:         try {
 75:             // initialize data block variables from context__
 76:             current_statement_begin__ = 1;
 77:             context__.validate_dims("data initialization", "y_mean", "double", context__.to_vec());
 78:             y_mean = double(0);
 79:             vals_r__ = context__.vals_r("y_mean");
 80:             pos__ = 0;
 81:             y_mean = vals_r__[pos__++];
 82: 
 83: 
 84:             // initialize transformed data variables
 85:             // execute transformed data statements
 86: 
 87:             // validate transformed data
 88: 
 89:             // validate, set parameter ranges
 90:             num_params_r__ = 0U;
 91:             param_ranges_i__.clear();
 92:             current_statement_begin__ = 1;
 93:             num_params_r__ += 1;
 94:         } catch (const std::exception& e) {
 95:             stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
 96:             // Next line prevents compiler griping about no return
 97:             throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
 98:         }
 99:     }
100: 
101:     ~model628597753cd_73fc79f8b1915e8208c736914c86d1a1() { }
102: 
103: 
104:     void transform_inits(const stan::io::var_context& context__,
105:                          std::vector<int>& params_i__,
106:                          std::vector<double>& params_r__,
107:                          std::ostream* pstream__) const {
108:         typedef double local_scalar_t__;
109:         stan::io::writer<double> writer__(params_r__, params_i__);
110:         size_t pos__;
111:         (void) pos__; // dummy call to supress warning
112:         std::vector<double> vals_r__;
113:         std::vector<int> vals_i__;
114: 
115:         current_statement_begin__ = 1;
116:         if (!(context__.contains_r("y")))
117:             stan::lang::rethrow_located(std::runtime_error(std::string("Variable y missing")), current_statement_begin__, prog_reader__());
118:         vals_r__ = context__.vals_r("y");
119:         pos__ = 0U;
120:         context__.validate_dims("parameter initialization", "y", "double", context__.to_vec());
121:         double y(0);
122:         y = vals_r__[pos__++];
123:         try {
124:             writer__.scalar_unconstrain(y);
125:         } catch (const std::exception& e) {
126:             stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable y: ") + e.what()), current_statement_begin__, prog_reader__());
127:         }
128: 
129:         params_r__ = writer__.data_r();
130:         params_i__ = writer__.data_i();
131:     }
132: 
133:     void transform_inits(const stan::io::var_context& context,
134:                          Eigen::Matrix<double, Eigen::Dynamic, 1>& params_r,
135:                          std::ostream* pstream__) const {
136:       std::vector<double> params_r_vec;
137:       std::vector<int> params_i_vec;
138:       transform_inits(context, params_i_vec, params_r_vec, pstream__);
139:       params_r.resize(params_r_vec.size());
140:       for (int i = 0; i < params_r.size(); ++i)
141:         params_r(i) = params_r_vec[i];
142:     }
143: 
144: 
145:     template <bool propto__, bool jacobian__, typename T__>
146:     T__ log_prob(std::vector<T__>& params_r__,
147:                  std::vector<int>& params_i__,
148:                  std::ostream* pstream__ = 0) const {
149: 
150:         typedef T__ local_scalar_t__;
151: 
152:         local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
153:         (void) DUMMY_VAR__;  // dummy to suppress unused var warning
154: 
155:         T__ lp__(0.0);
156:         stan::math::accumulator<T__> lp_accum__;
157:         try {
158:             stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);
159: 
160:             // model parameters
161:             current_statement_begin__ = 1;
162:             local_scalar_t__ y;
163:             (void) y;  // dummy to suppress unused var warning
164:             if (jacobian__)
165:                 y = in__.scalar_constrain(lp__);
166:             else
167:                 y = in__.scalar_constrain();
168: 
169:             // model body
170: 
171:             current_statement_begin__ = 1;
172:             lp_accum__.add(normal_log<propto__>(y, y_mean, 1));
173: 
174:         } catch (const std::exception& e) {
175:             stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
176:             // Next line prevents compiler griping about no return
177:             throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
178:         }
179: 
180:         lp_accum__.add(lp__);
181:         return lp_accum__.sum();
182: 
183:     } // log_prob()
184: 
185:     template <bool propto, bool jacobian, typename T_>
186:     T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,
187:                std::ostream* pstream = 0) const {
188:       std::vector<T_> vec_params_r;
189:       vec_params_r.reserve(params_r.size());
190:       for (int i = 0; i < params_r.size(); ++i)
191:         vec_params_r.push_back(params_r(i));
192:       std::vector<int> vec_params_i;
193:       return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream);
194:     }
195: 
196: 
197:     void get_param_names(std::vector<std::string>& names__) const {
198:         names__.resize(0);
199:         names__.push_back("y");
200:     }
201: 
202: 
203:     void get_dims(std::vector<std::vector<size_t> >& dimss__) const {
204:         dimss__.resize(0);
205:         std::vector<size_t> dims__;
206:         dims__.resize(0);
207:         dimss__.push_back(dims__);
208:     }
209: 
210:     template <typename RNG>
211:     void write_array(RNG& base_rng__,
212:                      std::vector<double>& params_r__,
213:                      std::vector<int>& params_i__,
214:                      std::vector<double>& vars__,
215:                      bool include_tparams__ = true,
216:                      bool include_gqs__ = true,
217:                      std::ostream* pstream__ = 0) const {
218:         typedef double local_scalar_t__;
219: 
220:         vars__.resize(0);
221:         stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);
222:         static const char* function__ = "model628597753cd_73fc79f8b1915e8208c736914c86d1a1_namespace::write_array";
223:         (void) function__;  // dummy to suppress unused var warning
224: 
225:         // read-transform, write parameters
226:         double y = in__.scalar_constrain();
227:         vars__.push_back(y);
228: 
229:         double lp__ = 0.0;
230:         (void) lp__;  // dummy to suppress unused var warning
231:         stan::math::accumulator<double> lp_accum__;
232: 
233:         local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
234:         (void) DUMMY_VAR__;  // suppress unused var warning
235: 
236:         if (!include_tparams__ && !include_gqs__) return;
237: 
238:         try {
239:             if (!include_gqs__ && !include_tparams__) return;
240:             if (!include_gqs__) return;
241:         } catch (const std::exception& e) {
242:             stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
243:             // Next line prevents compiler griping about no return
244:             throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
245:         }
246:     }
247: 
248:     template <typename RNG>
249:     void write_array(RNG& base_rng,
250:                      Eigen::Matrix<double,Eigen::Dynamic,1>& params_r,
251:                      Eigen::Matrix<double,Eigen::Dynamic,1>& vars,
252:                      bool include_tparams = true,
253:                      bool include_gqs = true,
254:                      std::ostream* pstream = 0) const {
255:       std::vector<double> params_r_vec(params_r.size());
256:       for (int i = 0; i < params_r.size(); ++i)
257:         params_r_vec[i] = params_r(i);
258:       std::vector<double> vars_vec;
259:       std::vector<int> params_i_vec;
260:       write_array(base_rng, params_r_vec, params_i_vec, vars_vec, include_tparams, include_gqs, pstream);
261:       vars.resize(vars_vec.size());
262:       for (int i = 0; i < vars.size(); ++i)
263:         vars(i) = vars_vec[i];
264:     }
265: 
266:     std::string model_name() const {
267:         return "model628597753cd_73fc79f8b1915e8208c736914c86d1a1";
268:     }
269: 
270: 
271:     void constrained_param_names(std::vector<std::string>& param_names__,
272:                                  bool include_tparams__ = true,
273:                                  bool include_gqs__ = true) const {
274:         std::stringstream param_name_stream__;
275:         param_name_stream__.str(std::string());
276:         param_name_stream__ << "y";
277:         param_names__.push_back(param_name_stream__.str());
278: 
279:         if (!include_gqs__ && !include_tparams__) return;
280: 
281:         if (include_tparams__) {
282:         }
283: 
284:         if (!include_gqs__) return;
285:     }
286: 
287: 
288:     void unconstrained_param_names(std::vector<std::string>& param_names__,
289:                                    bool include_tparams__ = true,
290:                                    bool include_gqs__ = true) const {
291:         std::stringstream param_name_stream__;
292:         param_name_stream__.str(std::string());
293:         param_name_stream__ << "y";
294:         param_names__.push_back(param_name_stream__.str());
295: 
296:         if (!include_gqs__ && !include_tparams__) return;
297: 
298:         if (include_tparams__) {
299:         }
300: 
301:         if (!include_gqs__) return;
302:     }
303: 
304: }; // model
305: 
306: }  // namespace
307: 
308: typedef model628597753cd_73fc79f8b1915e8208c736914c86d1a1_namespace::model628597753cd_73fc79f8b1915e8208c736914c86d1a1 stan_model;
309: 
310: #ifndef USING_R
311: 
312: stan::model::model_base& new_model(
313:         stan::io::var_context& data_context,
314:         unsigned int seed,
315:         std::ostream* msg_stream) {
316:   stan_model* m = new stan_model(data_context, seed, msg_stream);
317:   return *m;
318: }
319: 
320: #endif
321: 
322: 
323: 
324: #include <rstan_next/stan_fit.hpp>
325: 
326: struct stan_model_holder {
327:     stan_model_holder(rstan::io::rlist_ref_var_context rcontext,
328:                       unsigned int random_seed)
329:     : rcontext_(rcontext), random_seed_(random_seed)
330:      {
331:      }
332: 
333:    //stan::math::ChainableStack ad_stack;
334:    rstan::io::rlist_ref_var_context rcontext_;
335:    unsigned int random_seed_;
336: };
337: 
338: Rcpp::XPtr<stan::model::model_base> model_ptr(stan_model_holder* smh) {
339:   Rcpp::XPtr<stan::model::model_base> model_instance(new stan_model(smh->rcontext_, smh->random_seed_), true);
340:   return model_instance;
341: }
342: 
343: Rcpp::XPtr<rstan::stan_fit_base> fit_ptr(stan_model_holder* smh) {
344:   return Rcpp::XPtr<rstan::stan_fit_base>(new rstan::stan_fit(model_ptr(smh), smh->random_seed_), true);
345: }
346: 
347: std::string model_name(stan_model_holder* smh) {
348:   return model_ptr(smh).get()->model_name();
349: }
350: 
351: RCPP_MODULE(stan_fit4model628597753cd_73fc79f8b1915e8208c736914c86d1a1_mod){
352:   Rcpp::class_<stan_model_holder>("stan_fit4model628597753cd_73fc79f8b1915e8208c736914c86d1a1")
353:   .constructor<rstan::io::rlist_ref_var_context, unsigned int>()
354:   .method("model_ptr", &model_ptr)
355:   .method("fit_ptr", &fit_ptr)
356:   .method("model_name", &model_name)
357:   ;
358: }
359: 
360: 
361: // declarations
362: extern "C" {
363: SEXP file62876db59ed( ) ;
364: }
365: 
366: // definition
367: SEXP file62876db59ed() {
368:  return Rcpp::wrap("73fc79f8b1915e8208c736914c86d1a1");
369: }

Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) : 
  C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file62876db59ed.o:file62876db59ed.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file62876db59ed.o:file62876db59ed.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file62876db59ed.o:file62876db59ed.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x3a): undefined reference to `tbb::internal::task_scheduler_observer_v3::

Can someone help me? I appreciate it very much!

Thanks,
Doria