rstan error in R 4.2.2 (not in R 4.1.3)

Hi everybody,

I encounter a problem with rstan or perhaps Rtools42.
I have a very simple script for a stan model. It runs without error in R4.1.3 but in R4.2.2 it fails when I compile the model giving the error

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

make would use
if test "zfile3b146f7e1882.o" != "z"; then
if test -e "file3b146f7e1882-win.def"; then
echo g++ -shared -s -static-libgcc -o file3b146f7e1882.dll file3b146f7e1882-win.def file3b146f7e1882.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.2/bin/x64" -lR ;
g++ -shared -s -static-libgcc -o file3b146f7e1882.dll file3b146f7e1882-win.def file3b146f7e1882.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.2/bin/x64" -lR ;
else
echo EXPORTS > tmp.def;
nm file3b146f7e1882.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 file3b146f7e1882.dll tmp.def file3b146f7e1882.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.2/bin/x64" -lR ;
g++ -shared -s -static-libgcc -o file3b146f7e1882.dll tmp.def file3b146f7e1882.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.2/bin/x64" -lR ;
rm -f tmp.def;
fi
fi
Error in compileCode(f, code, language = language, verbose = verbose) :
C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file3b146f7e1882.o:file3b146f7e1882.cpp:(.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: file3b146f7e1882.o:file3b146f7e1882.cpp:(.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: file3b146f7e1882.o:file3b146f7e1882.cpp:(.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: file3b146f7e1882.o:file3b146f7e1882.cpp:(.text$_ZN3tbb10interface
Error in sink(type = "output") : invalid connection

Does anybody knows what is the problem and how to solve it ? The problem is not related to Rstudio, the same error occurs in Rgui.

I already tried to reinstalled rstan with no effect.

Thank you in advance.

HI,

I found on the rstan (RStan Getting Started · stan-dev/rstan Wiki · GitHub) that the rstan version on cran is currently not compatible with Rtools42. You have to install the development version on github.

I did it and it works for me.

Best regards

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.