Compilation error on Windows 10



I am triying to use a rstan model that fails to compile on my computer but the same file runs properly on my professor computer. Also, I can run said model without error if my professors sends me both .stan and .rds files. The problem seems to occurr when there is a need to recompile after I modify something in the .rtan file.

Current Output: That’s the error it returns

Error in compileCode(f, code, language = language, verbose = verbose) :
C:/RBuildTools/4.0/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: C:/Users/Usuario/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'; file43dc6a613de5.o:file43dc6a613de5.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): first defined hereC:/RBuildTools/4.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Usuario/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’; file43dc6a613d
Also: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘-E’ not found
Error in sink(type = “output”) : invalid connection

Expected Output:

No compilation error

Versions info:
Windows 10
R version 4.0.2 (2020-06-22)
rstan 2.21.2

I have tried reinstalling rstan and StanHeaders from source and github as suggested in other threads but no luck.

Would really appreciate some help!!!

It’s likely package BH breaks rstan. @andrjohns @jonah any idea?

Can you try installing the development version of rstan by running the following:

remove.packages(c("rstan", "StanHeaders"))
install.packages("rstan", repos = c("", getOption("repos")))
1 Like

Did that. Run some tests. No compilation error!!
A million thanks to you!!

1 Like