I hate to repost on a question that seems as if it has been answered, but I am running into an error that resists solutions. I cannot run even a simple brms model (see below) and the solution for previous people – install.packages(c("StanHeaders", "rstan"), type = "source")
– works for me.
install.packages(c("StanHeaders", "rstan"), type = "source")
install.packages("brms")
library(brms)
n <- 100
mus <- c(2, 4)
fake_d <- data.frame(
y = rnorm(n, mus[1], sd = 1),
x = rnorm(n, mus[2], sd = 1)
)
# plot(fake_d$x, fake_d$y, pch = 16)
m0 <- brm(y ~ x, cores = 2, chains = 2, data = fake_d)
- Windows: 10
- brms Version: 2.17.0
Apologies if this is a dumb error! I appreciate any assistance you can provide. For what it’s worth, I’ve been building and running models in cmdrstan successfully so far.
The full error is below:
Compiling Stan program...
make cmd is
make -f "C:/PROGRA~1/R/R-42~1.0/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-42~1.0/share/make/winshlib.mk" -f "C:/Users/jmalnight/Documents/.R/Makevars.win" CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB="file73d03a7a343.dll" WIN=64 TCLBIN= OBJECTS="file73d03a7a343.o"
make would use
if test "zfile73d03a7a343.o" != "z"; then \
if test -e "file73d03a7a343-win.def"; then \
echo g++ -shared -s -static-libgcc -o file73d03a7a343.dll file73d03a7a343-win.def file73d03a7a343.o -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib" -L"C:/PROGRA~1/R/R-42~1.0/bin/x64" -lR ; \
g++ -shared -s -static-libgcc -o file73d03a7a343.dll file73d03a7a343-win.def file73d03a7a343.o -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib" -L"C:/PROGRA~1/R/R-42~1.0/bin/x64" -lR ; \
else \
echo EXPORTS > tmp.def; \
nm file73d03a7a343.o | sed -n 's/^.* [BCDRT] / /p' | sed -e '/[.]refptr[.]/d' -e '/[.]weak[.]/d' | sed 's/[^ ][^ ]*/"&"/g' >> tmp.def; \
echo g++ -shared -s -static-libgcc -o file73d03a7a343.dll tmp.def file73d03a7a343.o -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib" -L"C:/PROGRA~1/R/R-42~1.0/bin/x64" -lR ; \
g++ -shared -s -static-libgcc -o file73d03a7a343.dll tmp.def file73d03a7a343.o -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib" -L"C:/PROGRA~1/R/R-42~1.0/bin/x64" -lR ; \
rm -f tmp.def; \
fi \
fi
Error in compileCode(f, code, language = language, verbose = verbose) :
C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file73d03a7a343.o:file73d03a7a343.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file73d03a7a343.o:file73d03a7a343.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file73d03a7a343.o:file73d03a7a343.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x3a): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file73d03a7a343.o:file73d03a7a343.cpp:(.text$_ZN3tbb10interface623task_
Error in sink(type = "output") : invalid connection