ERROR: compilation failed for package 'rstan'

2,224 views
Skip to first unread message

Nadine Gibson

unread,
May 23, 2015, 3:40:17 AM5/23/15
to stan-...@googlegroups.com
Dear the good people of the STAN User Forum,

I am at a loss of what to do to get STAN to install. I have tried everything that I can think of. I am not well versed in C++. I have R version 3.2.0 (2015-04-16) -- "Full of Ingredients" and Rtools 3.3 installed. I have a Windows 7 operating system. All packages are also in the most updated form. 

When I run:

  options(repos = c(getOption("repos"),
                    rstan
= "http://rstan.org/repo/"))
  install
.packages("rstan", type = 'source')


OR

source('http://mc-stan.org/rstan/install.R', echo = TRUE, max.deparse.length = 2000)
install_rstan
()



I get hundreds of lines of code followed by:


Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-32~1.0/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-32~1.0/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="rstan.dll" ' had status 2
ERROR
: compilation failed for package 'rstan'
* removing 'C:/Users/Nadine/Documents/R/win-library/3.2/rstan'
Warning in install.packages :
  running command
'"C:/PROGRA~1/R/R-32~1.0/bin/x64/R" CMD INSTALL -l "C:\Users\Nadine\Documents\R\win-library\3.2" C:\Users\Nadine\AppData\Local\Temp\Rtmp8836vh/downloaded_packages/rstan_2.6.0.tar.gz' had status 1
Warning in install.packages :
  installation of
package ‘rstan’ had non-zero exit status


The downloaded source packages are in
 
‘C:\Users\Nadine\AppData\Local\Temp\Rtmp8836vh\downloaded_packages’




I am pretty sure that the Rcpp package is installed correctly because of the hellofun test:

> hellofun()
[1] "hello" "world"



Additionally, I believe that I have Rtools installed correctly.

> find_rtools(TRUE)
Scanning path...
ls
: C:\Users\Nadine\DOCUME~1\R\WIN-LI~1\3.2\Rtools\bin\ls.exe
gcc
: C:\Users\Nadine\DOCUME~1\R\WIN-LI~1\3.2\Rtools\GCC-46~1.3\bin\gcc.exe
VERSION
.txt
Rtools version 3.3.0.1958
Version: 3.3
[1] TRUE


> system('g++ -v')
Using built-in specs.
COLLECT_GCC
=C:\Users\Nadine\DOCUME~1\R\WIN-LI~1\3.2\Rtools\GCC-46~1.3\bin\G__~1.EXE
COLLECT_LTO_WRAPPER
=c:/users/nadine/docume~1/r/win-li~1/3.2/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('make -v')
GNU
Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i686-pc-cygwin
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
 
Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE
.


Report bugs to <bug-make@gnu.org>.





Here are my environmental variable paths:

> Sys.getenv('PATH')
[1] "C:\\Program Files\\R\\R-3.2.0\\bin\\x64;
C:\\Users\\Nadine\\Documents\\R\\win-library\\3.2\\Rtools\\bin;C:\\Users\\Nadine\\Documents\\R\\win-library\\3.2\\Rtools\\gcc-4.6.3\\bin;
C:\\Users\\Nadine\\Documents\\R\\win-library\\3.1\\Rtools\\bin;
C:\\Users\\Nadine\\Documents\\R\\win-library\\3.1\\Rtools\\gcc-4.6.3\\bin;C:\\Program Files\\R\\R-3.1.0\\Rtools\\bin;
C:\\Program Files\\R\\R-3.1.0\\Rtools\\gcc-4.6.3\\bin;c:\\Rtools\\bin;c:\\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:\\Windows\\System32;
C:\\Windows;C:\\Windows\\System32\\wbem;
C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;
C:\\Program Files (x86)\\Windows Live\\Shared"



Please any help would be greatly appreciated!

Thank you,
Nadine Gibson

Ben Goodrich

unread,
May 23, 2015, 12:59:02 PM5/23/15
to stan-...@googlegroups.com, nsg...@gmail.com
On Saturday, May 23, 2015 at 3:40:17 AM UTC-4, Nadine Gibson wrote:
I am at a loss of what to do to get STAN to install. I have tried everything that I can think of. I am not well versed in C++. I have R version 3.2.0 (2015-04-16) -- "Full of Ingredients" and Rtools 3.3 installed. I have a Windows 7 operating system. All packages are also in the most updated form. 

I don't think that script will install at the moment due to the new version of BH. You could do it if you have the devtools package installed with


Ben

Nadine Gibson

unread,
May 23, 2015, 1:41:46 PM5/23/15
to stan-...@googlegroups.com, nsg...@gmail.com
Success! Thank you so much. 

For anyone else who is having this problem: You need to make sure that the most current version of BH isn't installed with rstan as a dependency. 


devtools
::install_url("https://github.com/stan-dev/rstan/releases/download/v2.6.0/rstan_2.6.0.tar.gz",dependencies = FALSE)
library
(rstan)
set_cppo
("fast")

- Nadine

Insa Winzenborg

unread,
May 24, 2015, 2:58:09 AM5/24/15
to stan-...@googlegroups.com
Hi,

I ran into exactly the same problem trying to install RStan, and this advice fixed it also for me.

Maybe a (temporary) remark on the installation page might be helpful?

Many thanks,
Insa

Emmanuel Charpentier

unread,
May 24, 2015, 4:01:03 PM5/24/15
to stan-...@googlegroups.com
BH is now at 1.58.0-1. Consequence rstan no longer installs, at least in the implementation of R in Sage.

Enclosed is a trace of execution (obtained in an emacs shell buffer) following *exactly* the installation procedure spelled out in this page, which I interrupted after stan had spilled 22MB of insanities (nicely compressed to a mere half megabyte by gzip).

From what I understand, the compiler tries to cope with an infinite structure. And fails.

An emergency patch seems in order...

HTH,

--
Emmanuel Charpentier
...
TraceInstallStan.txt.gz

k...@psy.senshu-u.ac.jp

unread,
May 24, 2015, 7:42:27 PM5/24/15
to stan-...@googlegroups.com
Hi,

I had been struggling with the same problem on my Ubuntu environment, and that script worked out right for me too!
Many thanks for your help.

Cheers,
Ken

Emmanuel Charpentier

unread,
May 25, 2015, 3:33:21 AM5/25/15
to stan-...@googlegroups.com
A couple more data points :
  • downgrading to BH 1.55 allows the installation of rstan ;
  • the installed package can compile and run the "Eight schools" exemple successfully
  • [ in a new sestion ] loading rstan after upgrading BH to 1.58 works
  • the resultat system (rstan 2.6.0 + BH 1.58.0) compiles and runs the "Eight schools" example successfully.
Ergo the problem *might* be limited to the *compilation* of rstan.

This should be checked against other installations of R (reminder : I reported a problem seen with Sage's R), but I won't mess with my systemwide R installation (the regular Debian testing package) without compelling reasons...

HTH,

--
Emmanuel Charpentier

Bob Carpenter

unread,
May 25, 2015, 3:56:17 AM5/25/15
to stan-...@googlegroups.com
Yes, the problem is primarily related to the compilation of Stan.

Boost 1.58 broke backward compatibility in their lazy evaluation
library Fusion, which is used heavily in the Spirit Qi parser.

I've modified our parser code to match 1.58, with the consequence
that it no longer works with Boost versions before 1.56 (previous Stan was
at 1.55 to match BH before it changed). It's passing tests on the Mac,
but not on Windows. Here's the pull request, which references the branch:

https://github.com/stan-dev/stan/pull/1460

It's a holiday weekend here in NY, but we'll get this sorted out on the Stan
C++ side later this week. A patch or updated version of RStan should follow.

Sorry the R library compatibility has been a problem. We weren't
anticipating an update of BH, which skipped 1.56 and 1.57 updates,
but we should've been ready with compatible code for existing Boost
releases.

- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Linas Mockus

unread,
May 26, 2015, 6:07:27 PM5/26/15
to stan-...@googlegroups.com
Hi,

Can anybody suggest how to resolve this issue on a Win 7 machine?  The devtools workaround didn't work:
Downloading package from url: http://cran.r-project.org/src/contrib/Archive/BH/BH_1.55.0-3.tar.gz
Error: Does not appear to be an R package (no DESCRIPTION)

However Rtools 3.1 were installed seemingly correctly.


system('g++ -v')
Using built-in specs.
COLLECT_GCC=c:\Tools\Rtools\GCC-46~1.3\bin\G__~1.EXE
COLLECT_LTO_WRAPPER=c:/tools/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('make -v')
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i686-pc-cygwin
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
        Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

Report bugs to <bug-...@gnu.org>.

Thank you,
Linas




Ben Goodrich

unread,
May 26, 2015, 7:05:21 PM5/26/15
to stan-...@googlegroups.com, linasm...@gmail.com
On Tuesday, May 26, 2015 at 6:07:27 PM UTC-4, Linas Mockus wrote:
Can anybody suggest how to resolve this issue on a Win 7 machine?  The devtools workaround didn't work:
devtools::install_url("http://cran.r-project.org/src/contrib/Archive/BH/BH_1.55.0-3.tar.gz")
Downloading package from url: http://cran.r-project.org/src/contrib/Archive/BH/BH_1.55.0-3.tar.gz
Error: Does not appear to be an R package (no DESCRIPTION)

My guess is that something is interfering with your ability to download from that URL. If you can download and install BH manually, you can then install rstan.

Ben

Jonathan Gilligan

unread,
May 26, 2015, 11:29:41 PM5/26/15
to stan-...@googlegroups.com, linasm...@gmail.com
I just successfully installed rstan on both a debian and WIndows 7 machines following the instructions that you gave Nadine, except that I downloaded BH from a nearby CRAN mirror instead of the main cran.r-project.org site.

Everything worked and the 8 Schools example runs correctly.

So I would suggest that Linas try installing BH from a CRAN mirror instead of cran.r-project.org.

I really appreciate you being so on the ball and providing the workaround so promptly. That saved me lots of time.

Linas Mockus

unread,
May 27, 2015, 11:22:58 AM5/27/15
to stan-...@googlegroups.com, linasm...@gmail.com
First of all, thanks for good suggestions.

It looks like that even in some academic environments install_url is not working properly.  Thus the following sequence brought me back to the working state:
download BH from http://cran.r-project.org/src/contrib/Archive/BH/BH_1.55.0-3.tar.gz

download rstan
from https://github.com/stan-dev/rstan/releases/download/v2.6.0/rstan_2.6.0.tar.gz

install.packages ("devtools")
library (devtools)
devtools::install_local ("c:/Tools/BH.zip")
install.packages (inline)
library (inline)
install.packages ("RcppEigen")
library (RcppEigen)
devtools::install_local ("c:/Tools/rstan.zip", dependencies = FALSE)

Thanks,
Linas

Bob Carpenter

unread,
May 27, 2015, 1:01:19 PM5/27/15
to stan-...@googlegroups.com
Thanks --- we're testing the patch for Boost 1.58 right now
and should be rolling out a fix any day now that'll fix the
generic build.

- Bob

Jake Johnson

unread,
Jun 11, 2015, 2:32:58 AM6/11/15
to stan-...@googlegroups.com
I encountered problems installing rstan on my Windows 7 PC earlier today.  Nadine's code worked for me (i.e. using BH 1.55 vs 1.58).
Reply all
Reply to author
Forward
0 new messages