rwindowsgnu-make

Make: forked process died unexpectedly, exit code 0xC0000142 (Error 127)


During R package installation on Windows, make fails on the step of detecting gcc:

> devtools::install('c:/Temp/REddyProc-1.3.3')
── R CMD build ─────────────────────────────────────────────
✔  checking for file 'C:\Temp\REddyProc-1.3.3/DESCRIPTION' ... 
─  preparing 'REddyProc': (2.2s)
✔  checking DESCRIPTION meta-information ... 
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts (569ms)
─  checking for empty or unneeded directories
   Removed empty directory 'REddyProc/inst/examples'
   Removed empty directory 'REddyProc/vignettes/figure'
─  building 'REddyProc_1.3.3.tar.gz'
   
Running "C:/PROGRA~1/R/R-44~1.2/bin/x64/Rcmd.exe" INSTALL \
  "C:\Users\User\AppData\Local\Temp\RtmpW4J1RN/REddyProc_1.3.3.tar.gz" \
  --install-tests 
* installing to library 'C:/Users/User/AppData/Local/R/win-library/4.4'
* installing *source* package 'REddyProc' ...
** using staged installation
** libs
      0 [main] make 205 dofork: child -1 - forked process 8576 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
make: *** [C:/PROGRA~1/R/R-44~1.2/share/make/winshlib.mk:39: compilers] Error 127
Warning in system(paste(MAKE, p1(paste("-f", shQuote(makefiles))), "compilers"),  :
  running command 'make -f "C:/PROGRA~1/R/R-44~1.2/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-44~1.2/share/make/winshlib.mk" compilers' had status 2
Error in if (nzchar(cxx)) { : argument is of length zero
* removing 'C:/Users/User/AppData/Local/R/win-library/4.4/REddyProc'
Error in `(function (command = NULL, args = character(), error_on_status = TRUE, …`:
! System command 'Rcmd.exe' failed
---
Exit status: 1

I've checked a pair of similar questions, but they don't have some important lines like died unexpectedly.


Solution

  • Add make.exe to exceptions or Disable Windows security option:
    Windows Security > App & browser control > Exploit protection > Force randomization for images (Mandatory ASLR)
    Just in case - both error and fix are reproducible under W10 VM.

    There are variations in which protection will break someting. For example,

          0 [main] bash 724 dofork: child -1 - forked process 5700 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
    C:\PROGRA~1\R\R-44~1.2/bin/config.sh: fork: retry: Resource temporarily unavailable
    1059050 [main] bash 724 dofork: child -1 - forked process 460 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
    C:\PROGRA~1\R\R-44~1.2/bin/config.sh: fork: retry: Resource temporarily unavailable
    

    is also fixed with adding bash.exe (or carefully finding correct path, which may not even match to one in system path) to ASLR exclusions.