Installation problems on Win 10

Hi,
I successfully installed RStan on my iMac and Windows 10-Laptop - now after switching from iMac to Windows 10 Desktop, after a fresh installation of OS and R etc., I did not get RStan running properly.

I installed:
1.) R
2.) RTools
3.) RStudio
4.) Some packages
5.) Then I followed the Stan-Install-Instruction step-by-step…

This is what I get for the final step, the check if everything went well:

> fx <- inline::cxxfunction( signature(x = "integer", y = "numeric" ) , '
+ return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
+ ' )
C:\Rtools\mingw_64\bin\nm.exe: file1e18285e535.o: plugin needed to handle lto object
Cannot export __gnu_lto_slim: symbol not defined
Cannot export __gnu_lto_v1: symbol not defined
collect2.exe: error: ld returned 1 exit status

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 file1e18285e535( SEXP x, SEXP y) ;
 14: }
 15: 
 16: // definition
 17: 
 18: SEXP file1e18285e535( 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:\Rtools\mingw_64\bin\nm.exe: file1e18285e535.o: plugin needed to handle lto object
Cannot export __gnu_lto_slim: symbol not defined
Cannot export __gnu_lto_v1: symbol not defined
collect2.exe: error: ld returned 1 exit status
> fx( 2L, 5 ) # should be 10
Error in fx(2L, 5) : could not find function "fx"

It seems that model fitting with rstanarm works fine, at least I tried 2, 3 models. However, brms does not work, as this package has no pre-compiled models. So, the current status seems to be that I can at least partially work with RStan, but not completely…

Any idea what the above error message means and how to address this issue?

Thanks in advance!
Best
Daniel

Eliminate -flto and / or -ffat-lto-objects from CXXFLAGS in ~/.R/Makevars.

2 Likes

Thanks a lot, that solved the issue!