Re: [stan-users] achieving Hello World

44 views
Skip to first unread message

Bob Carpenter

unread,
Jun 4, 2014, 4:49:34 AM6/4/14
to stan-...@googlegroups.com, stan...@googlegroups.com
[cc-ing stan-dev]

I believe the direct answer to Scott Akenhead's query is that
you need to install Rcpp from source (why, I have no idea --- I'm
not an R expert or Rcpp expert).

Does anyone on the dev team understand all the combinatorics
of R / Mac / Rcpp / compilers to the point where we can provide
better instructions. The instructions that are there worked for
me as written no problem, so I can't even recreate the trouble our
users seem to be getting themselves into.

Can someone (preferably Ben or Jiqiang who have some chance of
getting it right) update our install instructions for RStan on
Mavericks on the wiki? We're getting lots of e-mail like this,
and it's starting to freak me out that we're going to be losing
R users who can't get through our patchwork install instructions.

I believe the issues we're having are the new ones introduced
by the interaction of Rcpp and Mavericks and the new Xcode, all
of which changed out from under us (not that this helps our
poor users struggling with installs).

Scott --- how did you figure out how to edit the .R directory?
It's trivial if you have a text editor (like emacs), but I'm curious
as to how you were trying to do it and finally managed to do it so
we can help others who don't use text editors.
Andrew had the same problem --- said he had no idea how to edit
a file starting with ".". It never even occurred to me that
this could be a point of failure, but now we know and should help
people out.

I don't have time now, but after two weeks, I'm willing to be
a guinea pig and completely rip out my C++ compilers and R installs
and start from scratch.

- Bob

On Jun 4, 2014, at 9:43 AM, Scott Akenhead <sc...@s4s.com> wrote:

> The previous version of RStan installed on the previous version of R with zero fussing, and I did cool Bayesian models quickly. Loved it.
> But with Mac OS X 10.9.3, installing RStan has been 20 miles of bad road.
> The RStan Getting Started guide instructed me to create ~/.R/Makevars with exactly these two lines:
> CXX=g++ -arch x86_64 -ftemplate-depth-256 -stdlib=libstdc++
> CXXFLAGS="-mtune=native -O3 -Wall -pedantic -Wconversion"
> This was tricky because I had to create ~/.R and to do that I had to make Mac Finder show hidden files. That was not straightforward.
> The script proffered to do this does not work if ~/.R does not exist. Not having ~/.R was disconcerting.
> Getting Started also instructed me to install Xcode 5.1.1 in order to have a C++ compiler. Some web searching revealed the trick where you run Xcode separately to accept the Apple license. And there is something about setting “Command Line Tools” in Xcode > Downloads so that refers to Xcode 5.1.1, except that seems to be Xcode > Locations, but it looks OK.
> Next I updated Rcpp and inline. I also reinstalled R because I was starting to get nervous.
> Then I tried the Hello World script. FAIL.
> Well, it seems to run Rcpp OK, then quits at the compile stage with this message:
> Compilation argument:
> /Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file1dd173a89f7e.cpp 2> file1dd173a89f7e.cpp.err.txt
> g++ -arch x86_64 -ftemplate-depth-256 -stdlib=libstdc++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -fPIC "-mtune=native -O3 -Wall -pedantic -Wconversion" -c file1dd173a89f7e.cpp -o file1dd173a89f7e.o
> g++ -arch x86_64 -ftemplate-depth-256 -stdlib=libstdc++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o file1dd173a89f7e.so file1dd173a89f7e.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
> Looks like it found Makevars OK, given the references to g++. But Xcode supplies the clang compiler. I am guessing there was no g++ so the script just ended, silently.
> I seem to recall that R is compiled with clang, so now I am worrying about compatibility.
> Not that I wanted to go there, but file.show("/Library/Frameworks/R.framework/Resources/etc/Makeconf") shows CC = clang and CXX = clang++.
> Anyway, at this point I am forced to call for help.
> Do I install g++ or should I throw away ~/.R/Makevars, ignore the Hello World test, and hope RStan works with clang?
> To compile RStan, do I need g++ or is clang the right way?
>
> My previous and positive experience with Stan led me to tell everyone where I work (fisheries research) to quit using JAGS and BUGS, so please help me get back to evangelizing Stan.
>
>
> --
> 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.

Ben Goodrich

unread,
Jun 4, 2014, 10:08:27 AM6/4/14
to stan...@googlegroups.com
Part of the issue is that we have two sets of installation instructions for Macs

https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started#how-to-install-rstan
https://github.com/stan-dev/rstan/wiki/RStan-Mac-OS-X-Installation-Instructions

The other thing that we at least have control over is the new release. The old release still has the incompatibility with libc++ so you either have to have -stdlib=libstdc++ in CFLAGS or use (llvm-)g++ to install rstan. But (llvm-)g++ doesn't compile models any more, so you have to use clang++ with -stdlib=libstdc++ for that. When we release, it will probably only work with clang++ (or FSF g++) but shouldn't require -stdlib=libstdc++.

CRAN always recommended installing Rcpp from source, but it only seemed to become necessary recently for Stan users who have Macs.

Ben
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

Bob Carpenter

unread,
Jun 4, 2014, 1:57:40 PM6/4/14
to stan...@googlegroups.com
I think our number one priority for Stan should be
solid R install instructions. If people can't install
our software, they can't use it.

I think the instructions needs to be of the form where the
user chooses their configuration, then gets step-by-step
instructions with a checklist.

That Mac-OS-X install page was my attempt to do that for
Mac OS, but clearly I didn't succeed and just added to the muddle.
And it wasn't broken out enough by version of Mac OS, etc.

Should I just kill that page? Or can it be salvaged by fiddling
with the Rcpp instructions?

https://github.com/stan-dev/rstan/wiki/RStan-Mac-OS-X-Installation-Instructions

I'm afraid I'm almost as confused as our users about the dependencies
among Mavericks, Xcode, Rcpp, Windows, installing from source, g++ vs.
clang++, -O0 vs. -O3 and which of those is set automatically by R, and
so on. And I don't seem to have run into any of the problems Andrew or
our users ran into.

- Bob
> > 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.
>
>
> --
> You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.

Ben Goodrich

unread,
Jun 4, 2014, 3:29:55 PM6/4/14
to stan...@googlegroups.com
On Wednesday, June 4, 2014 1:57:40 PM UTC-4, Bob Carpenter wrote:
That Mac-OS-X install page was my attempt to do that for
Mac OS, but clearly I didn't succeed and just added to the muddle.
And it wasn't broken out enough by version of Mac OS, etc.

Should I just kill that page?  Or can it be salvaged by fiddling
with the Rcpp instructions?  

  https://github.com/stan-dev/rstan/wiki/RStan-Mac-OS-X-Installation-Instructions

I think the only problem with that page is that it is less easy to find and that it doesn't work if your Xcode defaults to clang++ with libc++. But the new release should work with that. We should probably change the function at the end to install Rcpp and inline from source to be on the safe side.

Ben

Ben Goodrich

unread,
Jun 5, 2014, 4:34:42 PM6/5/14
to stan...@googlegroups.com
 
One thing about

https://github.com/stan-dev/rstan/wiki/RStan-Mac-OS-X-Installation-Instructions

is that the last step with the install_rstan() function is ostensibly cross-platform. So we might have a page that is called "Prerequisites for OSX" that would have all that except the last step. And have a similar linked page for how to install Rtools on Windows. And then in the main installation page, have everyone call that install_rstan() function.

Ben

Reply all
Reply to author
Forward
0 new messages