Error in compileCode(f, code, language = language, verbose = verbose)

Hi there,
I am new to rstan. I installed rstan but kept getting this error trying with example. The error persists even after I tried reinstall R, rstan, and StanHeaders.
Can anyone help me check what is going on here?

The following code will generate errors in complileCode.

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

"Error in compileCode(f, code, language = language, verbose = verbose) :
C:/rtools40/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: C:/Users/siman/Documents/R/win-library/4.0/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>(long double)::P1'; file3a986db11e2.o:file3a986db11e2.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): first defined hereC:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/siman/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.rdata$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QC[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QC]+0x0): multiple definition of boost::math::detail::bessel_j0(long double)::QC’; file3a986db11e2.o:file3a986db11e2.cpp

Here are my computer info:

  • Operating System- windows
  • RStan Version- 2.21.2
    strong text
  • Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))

writeLines(readLines(file.path(Sys.getenv(“HOME”), “.R/Makevars”)))
Error in file(con, “r”) : unable to open link : Warning message:
In file(con, “r”) :
cannot open file ‘C:\Users\siman\Documents/.R/Makevars’: No such file or directory

  • Output of devtools::session_info("rstan")

"

  • Session info -------------------------------------------------------------------------------
    setting value
    version R version 4.0.5 (2021-03-31)
    os Windows 8.1 x64
    system x86_64, mingw32
    ui RStudio
    language (EN)
    collate Chinese (Simplified)_China.936
    ctype Chinese (Simplified)_China.936
    tz America/Los_Angeles
    date 2021-05-11

  • Packages -----------------------------------------------------------------------------------
    ! package * version date lib source
    assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.2)
    backports 1.1.10 2020-09-15 [1] CRAN (R 4.0.2)
    BH 1.72.0-3 2020-01-08 [1] CRAN (R 4.0.5)
    callr 3.4.4 2020-09-07 [1] CRAN (R 4.0.2)
    checkmate 2.0.0 2020-02-06 [1] CRAN (R 4.0.3)
    cli 2.0.2 2020-02-28 [1] CRAN (R 4.0.2)
    colorspace 1.4-1 2019-03-18 [1] CRAN (R 4.0.2)
    crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.2)
    curl 4.3 2019-12-02 [1] CRAN (R 4.0.2)
    desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.2)
    digest 0.6.25 2020-02-23 [1] CRAN (R 4.0.2)
    ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.2)
    evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.2)
    fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.2)
    farver 2.0.3 2020-01-16 [1] CRAN (R 4.0.2)
    ggplot2 * 3.3.2 2020-06-19 [1] CRAN (R 4.0.2)
    glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2)
    gridExtra 2.3 2017-09-09 [1] CRAN (R 4.0.2)
    gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.2)
    inline 0.3.17 2020-12-01 [1] CRAN (R 4.0.4)
    isoband 0.2.2 2020-06-20 [1] CRAN (R 4.0.2)
    jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.0.5)
    labeling 0.3 2014-08-23 [1] CRAN (R 4.0.0)
    lattice 0.20-41 2020-04-02 [2] CRAN (R 4.0.5)
    lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.2)
    loo 2.4.1 2020-12-09 [1] CRAN (R 4.0.4)
    magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.2)
    MASS 7.3-53 2020-09-09 [1] CRAN (R 4.0.2)
    Matrix 1.3-2 2021-01-06 [2] CRAN (R 4.0.5)
    matrixStats 0.57.0 2020-09-25 [1] CRAN (R 4.0.2)
    mgcv 1.8-33 2020-08-27 [1] CRAN (R 4.0.2)
    munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.2)
    nlme 3.1-149 2020-08-23 [1] CRAN (R 4.0.2)
    pillar 1.4.6 2020-07-10 [1] CRAN (R 4.0.2)
    pkgbuild 1.1.0 2020-07-13 [1] CRAN (R 4.0.2)
    pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.2)
    pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.2)
    praise 1.0.0 2015-08-11 [1] CRAN (R 4.0.2)
    prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.2)
    processx 3.4.4 2020-09-03 [1] CRAN (R 4.0.2)
    ps 1.3.4 2020-08-11 [1] CRAN (R 4.0.2)
    R6 2.4.1 2019-11-12 [1] CRAN (R 4.0.2)
    RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 4.0.0)
    Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.0.2)
    RcppEigen 0.3.3.7.0 2019-11-16 [1] CRAN (R 4.0.2)
    D RcppParallel 5.0.3 2021-02-24 [1] CRAN (R 4.0.4)
    rlang 0.4.7 2020-07-09 [1] CRAN (R 4.0.2)
    rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.0.2)
    rstan * 2.21.2 2020-07-27 [1] CRAN (R 4.0.5)
    rstudioapi 0.11 2020-02-07 [1] CRAN (R 4.0.2)
    scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.2)
    StanHeaders * 2.21.0-7 2020-12-17 [1] CRAN (R 4.0.5)
    testthat 2.3.2 2020-03-02 [1] CRAN (R 4.0.2)
    tibble 3.0.3 2020-07-10 [1] CRAN (R 4.0.2)
    utf8 1.1.4 2018-05-24 [1] CRAN (R 4.0.2)
    V8 3.4.0 2020-11-04 [1] CRAN (R 4.0.3)
    vctrs 0.3.4 2020-08-29 [1] CRAN (R 4.0.2)
    viridisLite 0.3.0 2018-02-01 [1] CRAN (R 4.0.2)
    withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.2)

[1] C:/Users/siman/Documents/R/win-library/4.0
[2] C:/Program Files/R/R-4.0.5/library

D – DLL MD5 mismatch, broken installation.
"

Hi Siman, you just need to reinstall the packages from source.

Restart R, making sure that rstan doesn’t get loaded, and run:

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

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

Thanks for your response!
I tried with your code, but the R session seems to get into an endless loop.
The following is part of the result…

“In file included from C:/Users/siman/Documents/R/win-library/4.0/BH/include/boost/shared_ptr.hpp:17,
from C:/Users/siman/Documents/R/win-library/4.0/BH/include/boost/spirit/home/qi/string/symbols.hpp:29,
from C:/Users/siman/Documents/R/win-library/4.0/BH/include/boost/spirit/home/qi/string.hpp:15,
from C:/Users/siman/Documents/R/win-library/4.0/BH/include/boost/spirit/home/qi.hpp:28,
from C:/Users/siman/Documents/R/win-library/4.0/BH/include/boost/spirit/include/qi.hpp:16,
from C:/Users/siman/Documents/R/win-library/4.0/StanHeaders/include/src/stan/lang/grammars/whitespace_grammar.hpp:4,
from C:/Users/siman/Documents/R/win-library/4.0/StanHeaders/include/src/stan/lang/grammars/local_var_decls_grammar.hpp:6,
from C:/Users/siman/Documents/R/win-library/4.0/StanHeaders/include/src/stan/lang/grammars/local_var_decls_grammar_def.hpp:5,
from stan/lang/grammars/local_var_decls_grammar_inst.cpp:1:
C:/Users/siman/Documents/R/win-library/4.0/BH/include/boost/smart_ptr/shared_ptr.hpp:567:34: warning: ‘template class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
shared_ptr & operator=( std::auto_ptr & r )
^~~~~~~~”

Those are just compiler warnings, and are safe to ignore. You will likely see a large number scroll by, but after a while the compilation should finish.

If it fails there should be an Error: at the very bottom. Does it install if you leave it running?

I ran again until it finished. Yes there was an error message:

Error: package or namespace load failed for ‘rstan’ in library.dynam(lib, package, package.lib):
DLL ‘matrixStats’ not found: maybe not installed for this architecture?
错误: 载入失败
停止执行
*** arch - x64
ERROR: loading failed for ‘i386’

  • removing ‘C:/Users/siman/Documents/R/win-library/4.0/rstan’
  • restoring previous ‘C:/Users/siman/Documents/R/win-library/4.0/rstan’
    Warning in install.packages :
    installation of package ‘rstan’ had non-zero exit status

The downloaded source packages are in
‘C:\Users\siman\AppData\Local\Temp\RtmpobpGLD\downloaded_packages’

What should I do next?

The error there is: DLL ‘matrixStats’ not found: maybe not installed for this architecture?

Have you tried installing matrixStats?

Thank you. I reinstalled the ‘matrixStats’ package. Then I ran the

Compile packages using all cores

Sys.setenv(MAKEFLAGS = paste0(“-j”,parallel::detectCores()))
install.packages(c(“StanHeaders”,“rstan”),type=“source”)

This time I got another error:

Error in compileCode(f, code, language = language, verbose = verbose) :
file2ee01d5d79e2.cpp:7:10: fatal error: Rcpp.h: No such file or directory #include <Rcpp.h> ^~~~~~~~compilation terminated.make: *** [C:/PROGRA~1/R/R-40~1.5/etc/x64/Makeconf:229: file2ee01d5d79e2.o] Error 1

Now what should I do?

Hmm it’s saying that it doesn’t have the Rcpp package installed.

Can you run:

install.packages(c("BH","Rcpp","RcppEigen","RcppParallel"))

Then try the install again:

Sys.setenv(MAKEFLAGS = paste0("-j",parallel::detectCores()))
install.packages(c("StanHeaders","rstan"),type="source")

Thank you! Initially, there was still a problem running the code related to the i386 system.(Unfortunately, I didn’t record the error message).

Then I tried a few things and somehow it worked. I don’t know which one of them worked but this problem was fixed. Here was what I did:

  1. I changed the system environment variable of R. I am using R 4.0.5 right now but somehow the system environment was showing R 3.5 version. So I reset it to the R4.0.5 folder.
  2. I restarted my computer and started installation following the code you provide.
  3. Addition to that, I also forced the rstan and StanHeaders to be installed with additional argument forcing to x64 installation. The trick can be found here R is using the mingw_32 to compile packages for 64-bit architecture - Stack Overflow

Hope this can be useful to other people who encountered the same problem.

1 Like

hello I meet the same question,can you help me ???my e-mail is 1963507387@qq.com,thanks

Can you copy and paste the full error message you’re getting?

I run this:
stanfit ← stan(model_code = model, data = input.data,
warmup = 40,
iter = 140,
chains = 1)

result:Error in open.connection(con, open = mode) :
schannel: failed to receive handshake, SSL/TLS connection failed
此外: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found
make cmd is
make -f “D:/R/R-4.0.2/etc/x64/Makeconf” -f “D:/R/R-4.0.2/share/make/winshlib.mk” -f “C:/Users/LENOVO/Documents/.R/Makevars.win” CXX=’(CXX14) (CXX14STD)’ CXXFLAGS=’(CXX14FLAGS)' CXXPICFLAGS='(CXX14PICFLAGS)’ SHLIB_LDFLAGS=’(SHLIB_CXX14LDFLAGS)' SHLIB_LD='(SHLIB_CXX14LD)’ SHLIB=“file21805cab45bc.dll” WIN=64 TCLBIN=64 OBJECTS=“file21805cab45bc.o”

make would use
C:/rtools40/usr/mingw_64/bin/g++ -std=gnu++14 -I"D:/R/R-4.0.2/include" -DNDEBUG -I"D:/R/R-4.0.2/library/Rcpp/include/" -I"D:/R/R-4.0.2/library/RcppEigen/include/" -I"D:/R/R-4.0.2/library/RcppEigen/include/unsupported" -I"D:/R/R-4.0.2/library/BH/include" -I"D:/R/R-4.0.2/library/StanHeaders/include/src/" -I"D:/R/R-4.0.2/library/StanHeaders/include/" -I"D:/R/R-4.0.2/library/RcppParallel/include/" -I"D:/R/R-4.0.2/library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include “D:/R/R-4.0.2/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp” -std=c++1y -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -mtune=native -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -c file21805cab45bc.cpp -o file21805cab45bc.o
if test “zfile21805cab45bc.o” != “z”; then
if test -e “file21805cab45bc-win.def”; then
echo C:/rtools40/usr/mingw_64/bin/g++ -shared -s -static-libgcc -o file21805cab45bc.dll file21805cab45bc-win.def file21805cab45bc.o “D:/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a” -L"D:/R/R-4.0.2/library/StanHeaders/libs/x64" -lStanHeaders -L"D:/R/R-4.0.2/library/RcppParallel/lib/x64" -ltbb -L"D:/R/R-4.0.2/bin/x64" -lR ;
C:/rtools40/usr/mingw_64/bin/g++ -shared -s -static-libgcc -o file21805cab45bc.dll file21805cab45bc-win.def file21805cab45bc.o “D:/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a” -L"D:/R/R-4.0.2/library/StanHeaders/libs/x64" -lStanHeaders -L"D:/R/R-4.0.2/library/RcppParallel/lib/x64" -ltbb -L"D:/R/R-4.0.2/bin/x64" -lR ;
else
echo EXPORTS > tmp.def;
C:/rtools40/usr/mingw_64/bin/nm file21805cab45bc.o | sed -n ‘s/^.* [BCDRT] / /p’ | sed -e ‘/[.]refptr[.]/d’ -e ‘/[.]weak[.]/d’ | sed ‘s/[^ ][^ ]*/"&"/g’ >> tmp.def;
echo C:/rtools40/usr/mingw_64/bin/g++ -shared -s -static-libgcc -o file21805cab45bc.dll tmp.def file21805cab45bc.o “D:/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a” -L"D:/R/R-4.0.2/library/StanHeaders/libs/x64" -lStanHeaders -L"D:/R/R-4.0.2/library/RcppParallel/lib/x64" -ltbb -L"D:/R/R-4.0.2/bin/x64" -lR ;
C:/rtools40/usr/mingw_64/bin/g++ -shared -s -static-libgcc -o file21805cab45bc.dll tmp.def file21805cab45bc.o “D:/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a” -L"D:/R/R-4.0.2/library/StanHeaders/libs/x64" -lStanHeaders -L"D:/R/R-4.0.2/library/RcppParallel/lib/x64" -ltbb -L"D:/R/R-4.0.2/bin/x64" -lR ;
rm -f tmp.def;
fi
fi

Error in compileCode(f, code, language = language, verbose = verbose) :
sh: line 1: C:/rtools40/usr/mingw_64/bin/g++: No such file or directorymake: *** [D:/R/R-4.0.2/etc/x64/Makeconf:229: file21805cab45bc.o] Error 127
Error in sink(type = “output”) : 链结不对

What output do you get from:

Sys.getenv("BINPREF")
readLines("~/.Renviron")

now ,it’s ok,but it changed:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1:
Chain 1: Initialization between (-2, 2) failed after 100 attempts.
Chain 1: Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.
[1] “Error in sampler$call_sampler(args_list[[i]]) : Initialization failed.”
[1] "error occurred during calling the sampler; sampling not done

my friend used rstan2.19.2 ,ha can get corret result,
My rstan version is 2.21.2,it cannot get ,I don’t know why

Are you both using the exact same model and data?

yes ,now I get
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
Chain 1:
Chain 1: Initialization between (-2, 2) failed after 100 attempts.
Chain 1: Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.
[1] “Error in sampler$call_sampler(args_list[[i]]) : Initialization failed.”
[1] "error occurred during calling the sampler; sampling not done

This error implies an issue with the data and/or model specification, rather than an issue with Stan. Try starting with the simplest possible version of the model and iteratively add complexity until you experience the error

ok thank you

I installed rstan 2.19.2 ,run ,get

stanfit ← stan(model_code = model, data = input.data,

  •             warmup = 40,
    
  •             iter = 140, 
    
  •             chains = 1)
    

make cmd is
make -f “D:/R/R-4.0.2/etc/x64/Makeconf” -f “D:/R/R-4.0.2/share/make/winshlib.mk” -f “C:/Users/LENOVO/Documents/.R/Makevars.win” CXX=’(CXX14) (CXX14STD)’ CXXFLAGS=’(CXX14FLAGS)' CXXPICFLAGS='(CXX14PICFLAGS)’ SHLIB_LDFLAGS=’(SHLIB_CXX14LDFLAGS)' SHLIB_LD='(SHLIB_CXX14LD)’ SHLIB=“file13a84e7446dd.dll” WIN=64 TCLBIN=64 OBJECTS=“file13a84e7446dd.o”

make would use
“C:/rtools40/mingw64/bin/“g++ -std=gnu++14 -I"D:/R/R-4.0.2/include” -DNDEBUG -I"D:/R/R-4.0.2/library/Rcpp/include/” -I"D:/R/R-4.0.2/library/RcppEigen/include/" -I"D:/R/R-4.0.2/library/RcppEigen/include/unsupported" -I"D:/R/R-4.0.2/library/BH/include" -I"D:/R/R-4.0.2/library/StanHeaders/include/src/" -I"D:/R/R-4.0.2/library/StanHeaders/include/" -I"D:/R/R-4.0.2/library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -std=c++1y -march=core2 -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -mtune=native -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -c file13a84e7446dd.cpp -o file13a84e7446dd.o
if test “zfile13a84e7446dd.o” != “z”; then
if test -e “file13a84e7446dd-win.def”; then
echo “C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file13a84e7446dd.dll file13a84e7446dd-win.def file13a84e7446dd.o -L"D:/R/R-4.0.2/library/StanHeaders/libs/x64” -lStanHeaders -L"D:/R/R-4.0.2/bin/x64” -lR ;
“C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file13a84e7446dd.dll file13a84e7446dd-win.def file13a84e7446dd.o -L"D:/R/R-4.0.2/library/StanHeaders/libs/x64” -lStanHeaders -L"D:/R/R-4.0.2/bin/x64” -lR ;
else
echo EXPORTS > tmp.def;
“C:/rtools40/mingw64/bin/“nm file13a84e7446dd.o | sed -n ‘s/^.* [BCDRT] / /p’ | sed -e ‘/[.]refptr[.]/d’ -e ‘/[.]weak[.]/d’ | sed 's/[^ ][^ ]*/”&”/g’ >> tmp.def;
echo “C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file13a84e7446dd.dll tmp.def file13a84e7446dd.o -L"D:/R/R-4.0.2/library/StanHeaders/libs/x64” -lStanHeaders -L"D:/R/R-4.0.2/bin/x64” -lR ;
“C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file13a84e7446dd.dll tmp.def file13a84e7446dd.o -L"D:/R/R-4.0.2/library/StanHeaders/libs/x64” -lStanHeaders -L"D:/R/R-4.0.2/bin/x64” -lR ;
rm -f tmp.def;
fi
fi
**Error in compileCode(f, code, language = language, verbose = verbose) : **
** from file13a84e7446dd.cpp:8:D:/R/R-4.0.2/library/StanHeaders/include/stan/math/prim/core/init_threadpool_tbb.hpp:12:10: fatal error: tbb/task_scheduler_init.h: No such file or directory #include <tbb/task_scheduler_init.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~~compilation terminated.make: *** [D:/R/R-4.0.2/etc/x64/Makeconf:229: file13a84e7446dd.o] Error 1**
Error in sink(type = “output”) : 链结不对

why?please