Problem Rtools/Rstan


#1

I can’t install Rstan, or rather, I can’t run any code. I used Rstan before, but my laptop broke down and the motherboard was replaced. It is a worklaptop. I get the c/pasted error message. I get that it is a resources issue, but the solutions I find are based in linux, and I am running this from RStudio, windows 10. (my laptop should be strong enough to do this without any hiccups). Any help is appreciated.

fx <- inline::cxxfunction( signature(x = “integer”, y = “numeric” ) , ’

  • return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
  •                        ' )
    9 [main] make 4588 C:\Rtools\bin\make.exe: *** fatal error in forked process - fork: can't reserve memory for parent stack 0x2430000 - 0x2630000, (child has 0x2800000 - 0x2A00000), Win32 error 487
    
    3702 [main] make 4588 cygwin_exception::open_stackdumpfile: Dumping stack trace to make.exe.stackdump
    9 [main] make 252 fork: child -1 - forked process 4588 died unexpectedly, retry 0, exit code 0x100, errno 11
    make: vfork: Resource temporarily unavailable
    Warning message:
    running command ‘make -f “C:/PROGRA~1/R/R-34~1.3/etc/x64/Makeconf” -f “C:/PROGRA~1/R/R-34~1.3/share/make/winshlib.mk” -f “C:/Users/kronet/Documents/.R/Makevars” SHLIB_LDFLAGS=’$(SHLIB_CXXLDFLAGS)’ SHLIB_LD=’$(SHLIB_CXXLD)’ SHLIB=“file273061781fc7.dll” WIN=64 TCLBIN=64 OBJECTS=“file273061781fc7.o”’ had status 2

ERROR(s) during compilation: source code errors or compiler configuration errors!

Program source:
1:
2: // includes from the plugin
3: #include <R.h>
4: #include <Rdefines.h>
5: #include <R_ext/Error.h>
6:
7:
8: // user includes
9:
10:
11: // declarations
12: extern “C” {
13: SEXP file273061781fc7( SEXP x, SEXP y) ;
14: }
15:
16: // definition
17:
18: SEXP file273061781fc7( SEXP x, SEXP y ){
19:
20: return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
21:
22: Rf_warning(“your C++ program does not return anything”);
23: return R_NilValue ;
24: }
25:
26:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! 9 [main] make 4588 C:\Rtools\bin\make.exe: *** fatal error in forked process - fork: can’t reserve memory for parent stack 0x2430000 - 0x2630000, (child has 0x2800000 - 0x2A00000), Win32 error 487
3702 [main] make 4588 cygwin_exception::open_stackdumpfile: Dumping stack trace to make.exe.stackdump
9 [main] make 252 fork: child -1 - forked process 4588 died unexpectedly, retry 0, exit code 0x100, errno 11
make: vfork: Resource temporarily unavailable
Warning message:
running command ‘make -f “C:/PROGRA~1/R/R-34~1.3/etc/x64/Makeconf” -f “C:/PROGRA~1/R/R-34~1.3/share/make/winshlib.mk” -f “C:/Users/kronet/Documents/.R/Makevars” SHLIB_LDFLAGS=’$(SHLIB_CXXLDFLAGS)’ SHLIB_LD=’$(SHLIB_CXXLD)’ SHLIB=“file273061781fc7.dll” WIN=64 TCLBIN=64 OBJECTS=“file273061781fc7.o”’ had status 2
In addition: Warning message:
running command ‘C:/PROGRA~1/R/R-34~1.3/bin/x64/R CMD SHLIB file273061781fc7.cpp 2> file273061781fc7.cpp.err.txt’ had status 1

fx( 2L, 5 ) # should be 10
Error in fx(2L, 5) : could not find function “fx”


#2

If you Google for

fork: can’t reserve memory for parent stack

it seems to be related to bitness. So be sure to use 64bit R and compiler presuming you have a 64bit processor.


#3

That’s where I started my search, but I use 64 bit R (Rcpp btw does also not work, asks whether I want to install a C/C++ compiler (Rtools), to which I said yes but that didn’t work either).

SessionInfo:

R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252
[4] LC_NUMERIC=C LC_TIME=Dutch_Netherlands.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_3.4.3 tools_3.4.3 Rcpp_0.12.15