0

I am using R v.3.5.1, R studio v 1.3.1093 with Rtools 3.5 on windows 10.

I know that R tools have been successfully installed and the toolchain has been found, having followed https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows and successfully installing:

install.packages("jsonlite",type="source").

However, when I try and install rstan from source using

pkgbuild::with_build_tools(install.packages("rstan", type = "source"))

I get the following error message:

sh: C:/Rtools/mingw_32/bin/: Is a directory
make: *** [C:/PROGRA~1/R/R-35~1.1/etc/i386/Makeconf:215: sparse_extractors.o] Error 126
ERROR: compilation failed for package 'rstan'
* removing 'C:/R/library/rstan'
In R CMD INSTALL
Warning in install.packages :
  installation of package ‘rstan’ had non-zero exit status

Currently, my makevars.win file contains the following:

CXX14 = C:/Rtools/mingw_$(WIN)/bin/ g++ -std=c++1y
CXX14FLAGS = -O3 -Wno-unused-variable -Wno-unused-function

Although I have tried various different lines in the makevars file and all still bring up the error 126 message as above.

I can successfully install the binary versions of rstan/rstanarm/brms etc. But when I try and compile a model it fails. When I tried this and realised the binary versions were not working, I uninstalled rstan/rstanarm and brms before trying to install the source versions.

Any help fixing this error and successfully installing rstan would be greatly appreciated!

rlg94
  • 1
  • 2

1 Answers1

0

There is a space before g++ which causes the Makefile to execute the directory (which fails as it is not an executable).

Remove the space.

arved
  • 4,401
  • 4
  • 30
  • 53
  • Thank you for your response. I removed the space, but now have: make: *** [C:/PROGRA~1/R/R-35~1.1/etc/i386/Makeconf:215: Module.o] Error 1 ERROR: compilation failed for package 'rstan' – rlg94 Jul 28 '21 at 10:13
  • That is not the right error message. That is just make telling you that something went wrong when it tried to run the command in the file *Makeconf* at line 215. You have to look at the messages _before_ that one to see what went wrong and solve that. – MadScientist Jul 28 '21 at 13:05