Failing to install rstan on Windows 7

Dear all,

I am very sorry, but browsing through the various categories in this forum for nearly 30 min now, I still could not identify relevant information concerning my practical problem of installing rstan (version: 2018-01-19) on Windows 7 – even though I would assume that my problem is not particularly unique.

I have been carefully following the instructions at I repeated executing them a total of 3 times.

Concerning my query here, I am now prompted to provide the following information to this forum:

(1) Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))

I thus obtain:
CXXFLAGS=-O3 -Wno-unused-variable -Wno-unused-function

CXXFLAGS += -flto -Wno-ignored-attributes -Wno-deprecated-declarations

CXXFLAGS=-O3 -Wno-unused-variable -Wno-unused-function

CXXFLAGS += -flto -Wno-ignored-attributes -Wno-deprecated-declarations

CXXFLAGS=-O3 -Wno-unused-variable -Wno-unused-function

CXXFLAGS += -flto -Wno-ignored-attributes -Wno-deprecated-declarations

(2) Output of devtools::session_info("rstan")

Here I receive the response:
Error in loadNamespace(name) : there is no package called ‘devtools’

I’d appreciate some helpful comments from experts.

Many thanks!

What is the error message when the installation fails?

Everything in the installation process looks fine to my layperson’s eye almost to the end, until I am running the final check, which yields

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

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

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! C:\Rtools\mingw_64\bin\nm.exe: file2284423465c8.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 )

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

1 Like

Dear Ben,

many thanks again for your immediate reply concerning my installation problem. In the end, I didn’t touch the matter until just today. I started again with a re-installation from scratch, carefully reading all of the instruction provided on GitHub. After about three quarters of an hour, it worked first time around. Unfortunately, I cannot tell you what I did differently on this occasion. I would claim that I did everything the same as before. Nevermind.

Cheers, Henk

@hve1964 I’m glad it’s working but sorry it’s a hassle!

We’re working on making installation easier for Windows users, but at the moment it can still be a pain. From what I understand, some R and RStudio updates later this year will also help to ensure that the toolchain is setup in the way rstan needs it.

1 Like