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

I tried to reinstall R, Rstudio, Rtools, but it still didn’t work. Thank you for your help

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/zhangsen/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): multiple definition of boost::math::detail::bessel_j0<long double>(long double)::P1'; file3dfc2ff67f5.o:file3dfc2ff67f5.cpp:(.rdata$_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/zhangsen/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QS[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QS]+0x0): multiple definition of boost::math::detail::bessel_j0(long double)::QS’; file3dfc2ff67f5.o:file3dfc2ff67f
Error in sink(type = “output”) : 链结不对

Hi Sen, sorry about these troubles! There was a recent update to the BH package that has broken rstan a little.

Can you restart R, and then reinstall the packages from source:

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

Thank you for your attention, your code works.

1 Like