Undefined reference to stan_fit and invalid connection (sink)

When I run the following example model,

stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}'
mod <- rstan::stan_model(model_code = stancode, verbose = TRUE)

I get the following error message:

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! C:/rtools40/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file35943119371a.o:file35943119371a.cpp:(.text+0x118c): undefined reference to rstan::stan_fit::stan_fit(SEXPREC*, int)' C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file35943119371a.o:file35943119371a.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D1Ev[_ZN3tbb8internal26task_scheduler_observer_v3D1Ev]+0x14): undefined reference to tbb::internal::task_scheduler_observer_v3::observe(bool)’
C:/rtools40/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file35943119371a.o:file35943119371a.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1c): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)’
C:/rtools40/mingw64/bin/…/lib/gcc/

I installed rstan using the following code:
install.packages("rstan", type = "source", dependencies = TRUE)

Here is output from sessionInfo()

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

packageVersion("rstan")

2.21.1

packageVersion("StanHeaders"

2.21.0.5

Contents of Makevars.win:

CXX14FLAGS=-O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2

Contents of Makevars (empty):

.libPaths()

“C:/R/Library” “C:/Program Files/Microsoft/R Open/R-4.0.2/library”

I’ve tried almost every solution under the sun on this forum. Thanks in advance!

@andrjohns