Problem with "brm"

When I use function “brm” my output is:

BlockquoteError in compileCode(f, code, language = language, verbose = verbose) :
C:/Rtools/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: C:/Users/39331/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'; file5e943de76984.o:file5e943de76984.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): first defined hereC:/Rtools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/39331/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’; file5e943de76984.o:file5e943de76984
Inoltre: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
'C:/Rtools/usr/mingw
/bin/g++’ not found
Error in sink(type = “output”) : connessione non valida

Can you help to fix it? Thank you so much!

Hi Francesco,

Can you restart R, making sure that rstan doesn’t get loaded, and reinstall rstan and StanHeaders from source:

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

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

Now after all require/library packages output is similar to:

Errore: package or namespace load failed for ‘ggplot2’ in get(method, envir = home):
lazy-load database ‘C:/Users/39331/Documents/R/win-library/4.0/lifecycle/R/lifecycle.rdb’ is corrupt
Inoltre: Warning messages:
1: package ‘ggplot2’ was built under R version 4.0.5
2: In .registerS3method(fin[i, 1], fin[i, 2], fin[i, 3], fin[i, 4], :
restarting interrupted promise evaluation
3: In get(method, envir = home) :
restarting interrupted promise evaluation
4: In get(method, envir = home) : internal error -3 in R_decompress1

I restart my R but nothing

Can you reinstall ggplot2 and lifecycle?