Help, please, with "Compilation ERROR, function(s)/method(s) not created!"

Hey, I’ve been trying to get a fresh install going on my machine but ran into the “Compilation ERROR, function(s)/method(s) not created!”. I was running the “example(stan_model, package = “rstan”, run.dontrun = TRUE)”. Can you guys throw a suggestion my way?

Thanks,
-Mike

Operating System: Windows 10
Interface Version: Rstan:2.21.5
Compiler/Toolkit: R4.2/Rtools42

Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) : 
  C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file8782b186d3.o:file8782b186d3:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file8782b186d3.o:file8782b186d3:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file8782b186d3.o:file8782b186d3:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x3a): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file8782b186d3.o:file8782b186d3:(.text$_ZN3tbb10interface623task_scheduler_observerD0Ev[_

If I scroll up, I find this:

 369 : }
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/Mike/Documents/.R/Makevars.win" CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB="file8782b186d3.dll" WIN=64 TCLBIN= OBJECTS="file8782b186d3.o"

make would use
g++  -std=gnu++14 -I"C:/PROGRA~1/R/R-42~1.0/include" -DNDEBUG   -I"C:/Users/Mike/AppData/Local/R/win-library/4.2/Rcpp/include/"  -I"C:/Users/Mike/AppData/Local/R/win-library/4.2/RcppEigen/include/"  -I"C:/Users/Mike/AppData/Local/R/win-library/4.2/RcppEigen/include/unsupported"  -I"C:/Users/Mike/AppData/Local/R/win-library/4.2/BH/include" -I"C:/Users/Mike/AppData/Local/R/win-library/4.2/StanHeaders/include/src/"  -I"C:/Users/Mike/AppData/Local/R/win-library/4.2/StanHeaders/include/"  -I"C:/Users/Mike/AppData/Local/R/win-library/4.2/RcppParallel/include/"  -I"C:/Users/Mike/AppData/Local/R/win-library/4.2/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include "C:/Users/Mike/AppData/Local/R/win-library/4.2/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 file8782b186d3.cpp -o file8782b186d3.o
if test "zfile8782b186d3.o" != "z"; then \
  if test -e "file8782b186d3-win.def"; then \
    echo g++  -shared -s -static-libgcc -o file8782b186d3.dll file8782b186d3-win.def file8782b186d3.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 file8782b186d3.dll file8782b186d3-win.def file8782b186d3.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 file8782b186d3.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 file8782b186d3.dll tmp.def file8782b186d3.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 file8782b186d3.dll tmp.def file8782b186d3.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!

Standby, folks. Developer just told me R4.2 doesn’t play ‘good, or want to do other things good too.’ I’m referencing R4.2 and Stan.

I’ll update after I figure out some stuff.

-Mike

Yeah, I got R-Stan working for the first time ever thanks to that blog post I referenced above. Fantastic!

-Mike