stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.03k stars 264 forks source link

RStan installation failure, R 3.3.3 on 64-bit Windows 10 #510

Open tomas46 opened 6 years ago

tomas46 commented 6 years ago

Summary:

I have problems with installing RStan. My R version is 3.3.3, Rtools 33, Rstudio 1.1.442. I have closely followed https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Windows installation guide, but there seem to be some problems with the compiler path. However, I do not know how to fix this. I have tried to reinstall all programs several times, but I am still facing the same problem.

Here is the output I receive:

Sys.getenv("PATH") [1] "C:\Program Files\R\R-3.3.3\bin\x64;c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;C:\Program Files\Rtools\bin;C:\Program Files\Rtools\gcc-4.6.3\bin;E:\Programs\Rtools\bin;E:\Programs\Rtools\gcc-4.6.3\bin;E:\Programs\Rtools\bin;E:\Programs\Rtools\mingw_32\bin;E:\Programs\Rtools\bin;E:\Programs\Rtools\gcc-4.6.3\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Dell\Dell Data Protection\TSS\bin\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\QuickTime\QTSystem\;E:\Games\matlab\runtime\win64;E:\Games\matlab\bin;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\MATLAB\R2017a\bin;E:\Programs\Latex\miktex\bin\x64\;C:\Users\Dell\AppData\Local\Microsoft\WindowsApps;;E:\Programs\Microsoft VS Code\bin"

system('g++ -v') Using built-in specs. COLLECT_GCC=c:\Rtools\GCC-46~1.3\bin\G__~1.EXE COLLECT_LTO_WRAPPER=c:/rtools/gcc-46~1.3/bin/../libexec/gcc/i686-w64-mingw32/4.6.3/lto-wrapper.exe Target: i686-w64-mingw32 Configured with: /data/gannet/ripley/Sources/mingw-test3/src/gcc/configure --host=i686-w64-mingw32 --build=x86_64-linux-gnu --target=i686-w64-mingw32 --with-sysroot=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/mingw32 --prefix=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/mingw32 --with-gmp=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --with-mpfr=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --with-mpc=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --disable-shared --enable-static --enable-targets=all --enable-languages=c,c++,fortran --enable-libgomp --enable-sjlj-exceptions --enable-fully-dynamic-string --disable-nls --disable-werror --enable-checking=release --disable-win32-registry --disable-rpath --disable-werror CFLAGS='-O2 -mtune=core2 -fomit-frame-pointer' LDFLAGS= Thread model: win32 gcc version 4.6.3 20111208 (prerelease) (GCC)

system('where make') c:\Rtools\bin\make.exe

and here I fail:

fx <- inline::cxxfunction( signature(x = "integer", y = "numeric" ) , '

  • return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
  • ' ) C:/Programs/Rtools/mingw_64/bin/g++: not found make: *** [file2b0c690f1bf3.o] Error 127 Warning message: running command 'make -f "C:/PROGRA~1/R/R-33~1.3/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-33~1.3/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file2b0c690f1bf3.dll" WIN=64 TCLBIN=64 OBJECTS="file2b0c690f1bf3.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 5: #include <R_ext/Error.h> 6: 7: 8: // user includes 9: 10: 11: // declarations 12: extern "C" { 13: SEXP file2b0c690f1bf3( SEXP x, SEXP y) ; 14: } 15: 16: // definition 17: 18: SEXP file2b0c690f1bf3( 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! C:/Programs/Rtools/mingw_64/bin/g++: not found make: *** [file2b0c690f1bf3.o] Error 127 Warning message: running command 'make -f "C:/PROGRA~1/R/R-33~1.3/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-33~1.3/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file2b0c690f1bf3.dll" WIN=64 TCLBIN=64 OBJECTS="file2b0c690f1bf3.o"' had status 2 In addition: Warning message: running command 'C:/PROGRA~1/R/R-33~1.3/bin/x64/R CMD SHLIB file2b0c690f1bf3.cpp 2> file2b0c690f1bf3.cpp.err.txt' had status 1

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

Thank you for the help!

mariecutiongco commented 6 years ago

Exactly the same issue with me, any updates on this problem? Working fine on a mac but seems to have some issue in installing R Windows 10

bob-carpenter commented 6 years ago

If I'm reading that -v output correctly, the problem appears to be the wrong version of gcc being called:

/bin/../libexec/gcc/i686-w64-mingw32/4.6.3/lto-wrapper.exe

We require 4.9 or higher. According to the Rtools page, 3.3 should be OK:

R 3.3.0 and later use a toolchain based on gcc 4.9.3

This part of your output is suspicious. You need to be finding the right version of gcc on your PATH:

C:/Programs/Rtools/mingw_64/bin/g++: not found
make: *** [file2b0c690f1bf3.o] Error 127