Updating R to 4.0.3 and brms to 2.14.4 killed brms

I committed the fatal error of trying to update R and brms. In my defense, I had a good reason, i.e. I hoped to access the new within-chain parallelization and other functionality that is reputed to speed up the sampling of complex models dramatically.

Result: I can no longer fit even a simple intercept-only model.

nullmod <- brm(dep.var ~ 1, family = categorical, data = d, prior = prior(normal(0,4), class = Intercept))

And I get:

Compiling Stan program...
Error in open.connection(con, open = mode) : 
  Could not resolve host: github.com
In addition: Warning messages:
1: Specifying global priors for regression coefficients in categorical models is deprecated. Please specify priors separately for each response category. 
2: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  '-E' not found
make cmd is
  make -f "C:/PROGRA~1/R/R-40~1.3/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-40~1.3/share/make/winshlib.mk" CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB="file21d872f22ea8.dll" WIN=64 TCLBIN=64 OBJECTS="file21d872f22ea8.o"

make would use
if test "zfile21d872f22ea8.o" != "z"; then \
  if test -e "file21d872f22ea8-win.def"; then \
    echo "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o file21d872f22ea8.dll file21d872f22ea8-win.def file21d872f22ea8.o   "C:/Users/Folio 1040/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a" -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/RcppParallel/lib/x64" -ltbb  -L"C:/PROGRA~1/R/R-40~1.3/bin/x64" -lR ; \
    "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o file21d872f22ea8.dll file21d872f22ea8-win.def file21d872f22ea8.o   "C:/Users/Folio 1040/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a" -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/RcppParallel/lib/x64" -ltbb  -L"C:/PROGRA~1/R/R-40~1.3/bin/x64" -lR ; \
  else \
    echo EXPORTS > tmp.def; \
    "C:/rtools40/mingw64/bin/"nm file21d872f22ea8.o | sed -n 's/^.* [BCDRT] / /p' | sed -e '/[.]refptr[.]/d' -e '/[.]weak[.]/d' | sed 's/[^ ][^ ]*/"&"/g'  >> tmp.def; \
    echo "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o file21d872f22ea8.dll tmp.def file21d872f22ea8.o   "C:/Users/Folio 1040/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a" -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/RcppParallel/lib/x64" -ltbb  -L"C:/PROGRA~1/R/R-40~1.3/bin/x64" -lR ; \
    "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o file21d872f22ea8.dll tmp.def file21d872f22ea8.o   "C:/Users/Folio 1040/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a" -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/RcppParallel/lib/x64" -ltbb  -L"C:/PROGRA~1/R/R-40~1.3/bin/x64" -lR ; \
    rm -f tmp.def; \
  fi \
fi
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/Folio 1040/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'; file21d872f22ea8.o:file21d872f22ea8.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/Folio 1040/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>(long double)::QS'; file21d872f22ea8.o:file
Error in sink(type = "output") : invalid connection

R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

other attached packages:
[1] brms_2.14.4 Rcpp_1.0.6

Any ideas?

Do you have an open connection to a GitHub repository?

There are several suggestions in this thread for addressing Windows issues.

This is caused by RStan testing whether your code will work with the new compiler (which is hosted on GitHub), but your network/firewall is blocking the connection.

The simple fix is to run:

rstan_options(javascript=FALSE)

When you first load RStan. This will disable that check.

Additionally I just noticed there’s a second error in the output, you’ll also need to reinstall rstan and StanHeaders from source:


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

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

I did the two things suggested by @andrjohns, and now I seem to have graduated to the next error message:

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

make would use
if test "zfile20a41fa52aa4.o" != "z"; then \
  if test -e "file20a41fa52aa4-win.def"; then \
    echo "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o file20a41fa52aa4.dll file20a41fa52aa4-win.def file20a41fa52aa4.o   "C:/Users/Folio 1040/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a" -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/RcppParallel/lib/x64" -ltbb  -L"C:/PROGRA~1/R/R-40~1.3/bin/x64" -lR ; \
    "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o file20a41fa52aa4.dll file20a41fa52aa4-win.def file20a41fa52aa4.o   "C:/Users/Folio 1040/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a" -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/RcppParallel/lib/x64" -ltbb  -L"C:/PROGRA~1/R/R-40~1.3/bin/x64" -lR ; \
  else \
    echo EXPORTS > tmp.def; \
    "C:/rtools40/mingw64/bin/"nm file20a41fa52aa4.o | sed -n 's/^.* [BCDRT] / /p' | sed -e '/[.]refptr[.]/d' -e '/[.]weak[.]/d' | sed 's/[^ ][^ ]*/"&"/g'  >> tmp.def; \
    echo "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o file20a41fa52aa4.dll tmp.def file20a41fa52aa4.o   "C:/Users/Folio 1040/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a" -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/RcppParallel/lib/x64" -ltbb  -L"C:/PROGRA~1/R/R-40~1.3/bin/x64" -lR ; \
    "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o file20a41fa52aa4.dll tmp.def file20a41fa52aa4.o   "C:/Users/Folio 1040/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a" -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/Folio 1040/Documents/R/win-library/4.0/RcppParallel/lib/x64" -ltbb  -L"C:/PROGRA~1/R/R-40~1.3/bin/x64" -lR ; \
    rm -f tmp.def; \
  fi \
fi
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/Folio 1040/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'; file20a41fa52aa4.o:file20a41fa52aa4.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/Folio 1040/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>(long double)::QS'; file20a41fa52aa4.o:file
In addition: Warning message:
Specifying global priors for regression coefficients in categorical models is deprecated. Please specify priors separately for each response category. 
Error in sink(type = "output") : invalid connection

I wonder if that stuff about ‘multiple definitions’ is significant.

It doesn’t look like the re-install happened properly. Can you restart R and then do the reinstall from source again?

Thank you for your patience. That seems to have done the trick.

2 Likes