Problems in installation

Hi,
I had to reset my computer and reinstall stan, R and Rstudio. Then I could never get rstan to work fine again. I have followed all instructions regarding rstan installation in RStan Getting Started · stan-dev/rstan Wiki · GitHub and in Configuring C Toolchain for Windows · stan-dev/rstan Wiki · GitHub.
At the end I could get it installed by installing R.4.0 rather than the latest. Also, by running install.packages(c(“StanHeaders”,“rstan”),type=“source”). Afterwards, I could run the model example(stan_model, package = “rstan”, run.dontrun = TRUE). Though some times it still crashes.

However, when I run models of my own that I know they are right (previously fitted in sstan); stan does not work. It provides me the following message
PART 1 (in black)
make cmd is
make -f “C:/PROGRA~1/R/R-40~1.0/etc/x64/Makeconf” -f “C:/PROGRA~1/R/R-40~1.0/share/make/winshlib.mk” -f “C:/Users/tmora/OneDrive/Documentos/.R/Makevars.win” CXX=‘(CXX14) (CXX14STD)’ CXXFLAGS=‘(CXX14FLAGS)' CXXPICFLAGS='(CXX14PICFLAGS)’ SHLIB_LDFLAGS=‘(SHLIB_CXX14LDFLAGS)' SHLIB_LD='(SHLIB_CXX14LD)’ SHLIB=“file4d084f8da1f.dll” WIN=64 TCLBIN=64 OBJECTS=“file4d084f8da1f.o”

make would use
“C:/rtools40/mingw64/bin/“g++ -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include” -DNDEBUG -I"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/Rcpp/include/” -I"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppEigen/include/" -I"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppEigen/include/unsupported" -I"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/BH/include" -I"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/StanHeaders/include/src/" -I"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/StanHeaders/include/" -I"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppParallel/include/" -DRCPP_PARALLEL_USE_TBB=1 -I"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DUSE_STANC3 -DSTRICT_R_HEADERS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -DBOOST_NO_AUTO_PTR -include “C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/StanHeaders/include/stan/math/prim/fun/Eigen.hpp” -std=c++1y -march=native -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -mtune=native -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -c file4d084f8da1f.cpp -o file4d084f8da1f.o
if test “zfile4d084f8da1f.o” != “z”; then
if test -e “file4d084f8da1f-win.def”; then
echo “C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file4d084f8da1f.dll file4d084f8da1f-win.def file4d084f8da1f.o “C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/rstan/lib/x64/libStanServices.a” -L"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/StanHeaders/libs/x64” -lStanHeaders -L"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppParallel/lib/x64” -ltbb -LC:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"C:/PROGRA~1/R/R-40~1.0/bin/x64" -lR ;
“C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file4d084f8da1f.dll file4d084f8da1f-win.def file4d084f8da1f.o “C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/rstan/lib/x64/libStanServices.a” -L"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/StanHeaders/libs/x64” -lStanHeaders -L"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppParallel/lib/x64” -ltbb -LC:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"C:/PROGRA~1/R/R-40~1.0/bin/x64" -lR ;
else
echo EXPORTS > tmp.def;
“C:/rtools40/mingw64/bin/“nm file4d084f8da1f.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 file4d084f8da1f.dll tmp.def file4d084f8da1f.o “C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/rstan/lib/x64/libStanServices.a” -L"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/StanHeaders/libs/x64” -lStanHeaders -L"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppParallel/lib/x64” -ltbb -LC:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"C:/PROGRA~1/R/R-40~1.0/bin/x64" -lR ;
“C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file4d084f8da1f.dll tmp.def file4d084f8da1f.o “C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/rstan/lib/x64/libStanServices.a” -L"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/StanHeaders/libs/x64” -lStanHeaders -L"C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppParallel/lib/x64” -ltbb -LC:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"C:/PROGRA~1/R/R-40~1.0/bin/x64" -lR ;
rm -f tmp.def;
fi
fi

PART II (in red)
Error in compileCode(f, code, language = language, verbose = verbose) :
C:\Users\tmora\AppData\Local\Temp\ccdfHPnv.s:278546: Error: invalid register for .seh_savexmmC:\Users\tmora\AppData\Local\Temp\ccdfHPnv.s:278548: Error: invalid register for .seh_savexmmC:\Users\tmora\AppData\Local\Temp\ccdfHPnv.s:278550: Error: invalid register for .seh_savexmmC:\Users\tmora\AppData\Local\Temp\ccdfHPnv.s:266363: Error: value of 291 too large for field of 1 byte at 0000000000000001C:\Users\tmora\AppData\Local\Temp\ccdfHPnv.s:274658: Error: value of 285 too large for field of 1 byte at 0000000000000001make: *** [C:/PROGRA~1/R/R-40~1.0/etc/x64/Makeconf:229: file4d084f8da1f.o] Error 1
Error in sink(type = “output”) : invalid connection

It has been a nightmare trying to fix rstan, I have been for more than a week reading posts and all information available and does not seem to be working.

I would be very pleased if you could help me in this regard.

Tere