Error CreateProcess' failed to run 'C:\rtools40\usr\bin\make.exe

I always get these errors when trying to run code from RSTAN/STAN/brms. I have used RStan Getting Started · stan-dev/rstan Wiki · GitHub, and have followed the instructions, but the problem persists.



Compiling Stan program...
Warning in system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  'C:/rtools40/usr/mingw_/bin/g++' not found
make cmd is
  make -f "C:/PROGRA~1/R/R-41~1.1/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-41~1.1/share/make/winshlib.mk" -f "C:/Users/christiana/Documents/.R/Makevars.win" CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB="file19b056ff7da.dll" WIN=64 TCLBIN=64 OBJECTS="file19b056ff7da.o"

make would use
Warning message:
In system(paste(cmd, "-n")) :
  'CreateProcess' failed to run 'C:\rtools40\usr\bin\make.exe -f "C:/PROGRA~1/R/R-41~1.1/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-41~1.1/share/make/winshlib.mk" -f "C:/Users/christiana/Documents/.R/Makevars.win" CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB="file19b056ff7da.dll" WIN=64 TCLBIN=64 OBJECTS="file19b056ff7da.o" -n'
 Error in compileCode(f, code, language = language, verbose = verbose) : 
Warning message:In system(cmd) : 'CreateProcess' failed to run 'C:\rtools40\usr\bin\make.exe -f "C:/PROGRA~1/R/R-41~1.1/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-41~1.1/share/make/winshlib.mk" -f "C:/Users/christiana/Documents/.R/Makevars.win" CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB="file19b056ff7da.dll" WIN=64 TCLBIN=64 OBJECTS="file19b056ff7da.o"'
 Error in sink(type = "output") : invalid connection

Operating System:R4.1.1, Windows 10
Interface Version:
Compiler/Toolkit:

Just to check some system configuration, can you post the output from the following commands:

Sys.getenv("PATH")
Sys.getenv("BINPREF")
Sys.which("make")
readLines("~/.Renviron")
readLines("~/.Rprofile")
readLines("~/.R/Makevars.win")

Hei,

Thank you for following up.

Nothing jumps out there, lets try getting R to compile some arbitrary c++. Can you post the output from the following commands:

system("touch foo.cpp")
system("R CMD SHLIB foo.cpp")

Here it is.

Are you able to compile any packages from source?

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

Here is the result from that operation:

It looks like your RTools installation is broken in some way. Can you close R, uninstall rtools, and then re-download and reinstall it?

Now a new version Is installed.

image001.png

Is there any difference if you try the jsonlite source install from above again?

No, it seems to be the same error messages.

Is it different if you run it from the console rather than a markdown document?

Thank you again for your help and effort.

No, it seems not to make a difference if I run in the console.

Hmm, I’m afraid I’m stumped then. To get this sorted you’ll need to open an issue on the rtools github, as the maintainer will likely have a better idea of what’s going on: Issues · r-windows/rtools-installer · GitHub

Ok, I will try that.

Thank you, it was very kind of you to give it a try.

Best regards

Christian

1 Like