Stan/RStan Installation Error


#1

Dear all,

After I followed all instruction at https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Windows and run the following codes,

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

  • return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
  •                        ' )
    

I got the following error message. Any help is appreciated.

C:\Rtools\mingw_64\bin\nm.exe: file4ab866595231.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 file4ab866595231( SEXP x, SEXP y) ;
14: }
15:
16: // definition
17:
18: SEXP file4ab866595231( 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: file4ab866595231.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”

Jun Xu, PhD
Professor
Department of Sociology
Ball State University
Muncie, 47306 IN


#2

#3

Dear Bob,

Thanks for your instruction. But can you tell me how to remove? Thanks a lot!

Jun


#4

Open that file in a text editor, put the cursor to the right of the offending part of CXXFLAGS and press the backspace key on Windows until the offending part is gone. Then save the file.

On a Mac, put the cursor to the left of the offending part of CXXFLAGS and press the delete key until the offending part is gone. Then save the file.


#5

Bob,

Thanks a lot! Actually your first reply gave very clear instruction. Now, I’ve cleaned that markvar file, and got that expected reuturn, 10. Thanks a lot!

Jun


#6

@bgoodri is Ben Goodrich, not me.