Error in sink(type = "output") : invalid connection

The code is a pretty standard model:

m <- brm(
  RT ~ Congruency + age_mo_c + (Congruency | id),
  data = fs_data,
  )

The error

Compiling Stan program...
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" -f "C:/Users/USER/Documents/.R/Makevars" CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB="file3f442a45d9.dll" WIN=64 TCLBIN=64 OBJECTS="file3f442a45d9.o"

make would use
if test "zfile3f442a45d9.o" != "z"; then \
  if test -e "file3f442a45d9-win.def"; then \
    echo "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o file3f442a45d9.dll file3f442a45d9-win.def file3f442a45d9.o   "C:/Users/USER/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a" -L"C:/Users/USER/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/USER/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 file3f442a45d9.dll file3f442a45d9-win.def file3f442a45d9.o   "C:/Users/USER/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a" -L"C:/Users/USER/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/USER/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 file3f442a45d9.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 file3f442a45d9.dll tmp.def file3f442a45d9.o   "C:/Users/USER/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a" -L"C:/Users/USER/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/USER/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 file3f442a45d9.dll tmp.def file3f442a45d9.o   "C:/Users/USER/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a" -L"C:/Users/USER/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/USER/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/USER/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'; file3f442a45d9.o:file3f442a45d9.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/USER/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'; file3f442a45d9.o:file3f442a45d9.cpp:(.r
Error in sink(type = "output") : invalid connection

I tried installing StanHeader but couldn’t find an updated link… Help?

Hi

please try,

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

and then restart.

2 Likes

Yup that did it!
Sorry for spamming the board …