Compiler Error with OSX Mavericks

2,274 views
Skip to first unread message

Avi Feller

unread,
Oct 23, 2013, 12:07:26 AM10/23/13
to stan-...@googlegroups.com
Dear wonderful Stan list,

I made the very silly mistake of installing the new Mac OS on the day of release, which has naturally lead to all sorts of issues (see here, for example). Fortunately, I messed around a bit (following the helpful advice here) and regained Rcpp functionality. Unfortunately, I still get a rather unpleasant error when I try to run a basic Stan model (the 8 schools model from the website using Stan 1.3):
Error in dyn.load(libLFile) : unable to load shared object '/tmp/RtmpqXaB3d/file489610a77e7.so': dlopen(/tmp/RtmpqXaB3d/file489610a77e7.so, 6): Symbol not found: __ZN4Rcpp9Reference5fieldERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE Referenced from: /tmp/RtmpqXaB3d/file489610a77e7.so Expected in: flat namespace in /tmp/RtmpqXaB3d/file489610a77e7.so

Am I the only one foolish enough to have made the switch today? Any other advice?

Session info below. Thanks, as always for the help.

- Avi


> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rstan_1.3.0   inline_0.3.13 Rcpp_0.10.5  

loaded via a namespace (and not attached):
[1] tools_3.0.2

Bob Carpenter

unread,
Oct 23, 2013, 4:17:08 AM10/23/13
to stan-...@googlegroups.com
On 10/23/13 12:07 AM, Avi Feller wrote:
> Dear wonderful Stan list,
>
> I made the very silly mistake of installing the new Mac OS on the day of release, which has naturally lead to all sorts
> of issues (see here <http://blog.rstudio.org/2013/10/22/rstudio-and-os-x-10-9-mavericks/>, for example). Fortunately, I
> messed around a bit (following the helpful advice here
> <http://stackoverflow.com/questions/19503995/error-when-with-xcode-5-0-and-rcpp-command-line-tools-are-installed>) and
> regained Rcpp functionality. Unfortunately, I still get a rather unpleasant error when I try to run a basic Stan model
> (the 8 schools model from the website using Stan 1.3):
>
> Error in dyn.load(libLFile) : unable to load shared object '/tmp/RtmpqXaB3d/file489610a77e7.so':
> dlopen(/tmp/RtmpqXaB3d/file489610a77e7.so, 6): Symbol not found:
> __ZN4Rcpp9Reference5fieldERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE Referenced from:
> /tmp/RtmpqXaB3d/file489610a77e7.so Expected in: flat namespace in /tmp/RtmpqXaB3d/file489610a77e7.so
>
> Am I the only one foolish enough to have made the switch today? Any other advice?

I haven't installed the new OS yet, but I can sympathize.

We got bombed with Xcode 5 issues right before Stan 2.0.
I take it from the stackoverflow link that you're also
using Xcode 5?

> Session info below. Thanks, as always for the help.

You have the latest R, too :-)

Hopefully this is something in R that will get sorted
out. You could build other Rcpp functions and dynamically
link them?

- Bob

Avi Feller

unread,
Oct 23, 2013, 9:53:47 AM10/23/13
to stan-...@googlegroups.com
Thanks, as always, for the response. 

After a bit more poking around, a quick summary of where I think things are with Stan/RStan and Mavericks:
  • Stan 1.3 does not work in Mavericks. It looks to be a clash between the older versions of the boost library and the new version of the Command Line Tools, but that's above my pay grade. (Note that, unfortunately, older versions of the Command Line Tools seem to be incompatible with Mavericks.)
  • The command line version of Stan 2.0 does seem to work in Mavericks (though I get a whole host of warnings during the install).
  • RStan 2.0 does not work in Mavericks, though this appears to be an issue in which R can't build packages from source rather than an RStan-specific issue (see this post). Of course, given this recent post from Brian Ripley, I imagine that the inimitable R team will be working to fix it (also, see here). 
I'd love to know if other people are experiencing these problems as well. And, of course, my take-away is to hold off on upgrading to the new OS! 

- Avi

Bob Carpenter

unread,
Oct 23, 2013, 2:46:35 PM10/23/13
to stan-...@googlegroups.com
Thanks for the detailed summary.

Looks like there's not much for us to do at the moment.

We're just waiting for some big functional tests to pass
before rolling out Stan 2.0.1, at which point, we are
going to encourage everyone to switch from 1.3 to 2.0.
We just don't have enough support person-power to maintain
two separate branches.

Or to make sure things work ahead of time in all the changed
platforms coming down the pike. Luckily, Ben keeps us on our toes
with compiler versions.

- Bob



On 10/23/13 9:53 AM, Avi Feller wrote:
> Thanks, as always, for the response.
>
> After a bit more poking around, a quick summary of where I think things are with Stan/RStan and Mavericks:
>
> * Stan 1.3 does /not/ work in Mavericks. It looks to be a clash between the older versions of the boost library and
> the new version of the Command Line Tools, but that's above my pay grade. (Note that, unfortunately, older versions
> of the Command Line Tools seem to be incompatible with Mavericks.)
> * The command line version of Stan 2.0 /does/ seem to work in Mavericks (though I get a whole host of warnings during
> the install).
> * RStan 2.0 does /not/ work in Mavericks, though this appears to be an issue in which R can't build packages from
> source rather than an RStan-specific issue (see this post
> <http://stackoverflow.com/questions/19533220/cannot-install-r-package-from-source-in-mac-osx-maverick>). Of course,
> given this recent post <https://stat.ethz.ch/pipermail/r-sig-mac/2013-October/010359.html> from Brian Ripley, I
> imagine that the inimitable R team will be working to fix it (also, see here
> <http://andrewgelman.com/2013/07/10/please-send-all-comments-to-devripley/>).
> --
> 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/groups/opt_out.

Avi Feller

unread,
Oct 23, 2013, 2:51:59 PM10/23/13
to stan-...@googlegroups.com
I completely understand and am ready to switch full-time to Stan 2.0.

Another (potentially helpful) update. After a bit more digging, I came across this post and can now successfully install packages from source code in Mavericks. However, I still can't install RStan 2.0.0 on Mavericks and believe that the issue is actually specific to RStan after all. Not sure if this is an easy check for folks before the RStan 2.0.1 release or not, but wanted to flag it.

And, of course, thanks to the team for the wonderful work on Stan. As my colleagues can confirm, I'm the resident Stan evangelist.

Thanks,
Avi

Robert J Goedman

unread,
Oct 23, 2013, 3:18:19 PM10/23/13
to stan-...@googlegroups.com
Avi,

Where exactly does installing RStan 2.0.0 fail on your system?

Rob J. Goedman



Avi Feller

unread,
Oct 23, 2013, 3:37:24 PM10/23/13
to stan-...@googlegroups.com
Hi Rob,

Compiling Stan itself produces a dozen or so very, very long warning messages. However, I see the same warning messages when I successfully compile Stan 2.0.0 from the command line, and the command line version seems to run just fine.

It's not until the very end of the install process that I finally get an error, rather than a warning:

installing via 'install.libs.R' to /Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan
installing rstan libs to /Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan/libs
installing libstan.a to /Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan/libstan
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan/libs/rstan.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan/libs/rstan.so, 6): Symbol not found: __ZNK4Rcpp7RObject4attrERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
  Referenced from: /Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan/libs/rstan.so
  Expected in: flat namespace
 in /Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan/libs/rstan.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan’

Let me know if I can provide additional information. And thanks for looking into this.

- Avi

Bob Carpenter

unread,
Oct 23, 2013, 3:45:25 PM10/23/13
to stan-...@googlegroups.com
Can you send the warning novel to me off the list for
the command-line errors?

Does the new OS have a new version of Xcode? Because
we're using the latest and not seeing the error messages.

Please also send the output of "g++ --version" if
you're using g++ to compile or "clang++ --version" if you're
using clang. (You should see which you're using when you do
the make and can control it with CC=clang++ or CC=g++ or
whatever other executable compiler you want to include.)

- Bob
> * removing �/Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan�
> * restoring previous �/Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan�
>
>
> Let me know if I can provide additional information. And thanks for looking into this.
>
> - Avi
>
>
> On Wednesday, October 23, 2013 3:18:19 PM UTC-4, Rob J Goedman wrote:
>
> Avi,
>
> Where exactly does installing RStan 2.0.0 fail on your system?
>
> Rob J. Goedman
> goe...@icloud.com <javascript:>
>
>
>
>
> On Oct 23, 2013, at 11:51 AM, Avi Feller <avi.f...@gmail.com <javascript:>> wrote:
>
>> I completely understand and am ready to switch full-time to Stan 2.0.
>>
>> Another (potentially helpful) update. After a bit more digging, I came across this post
>> <http://stackoverflow.com/questions/19546672/rcpp-error-with-xcode-5-0-and-osx-10-8-5-and-r-3-0-2> and can now
>> successfully install packages from source code in Mavericks. *However, I still can't install RStan 2.0.0 on
>> Mavericks and believe that the issue is actually specific to RStan after all.* Not sure if this is an easy check
>> > For more options, visit https://groups.google.com/groups/opt_out <https://groups.google.com/groups/opt_out>.
>>
>>
>> --
>> 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
>> <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out <https://groups.google.com/groups/opt_out>.

Ben Goodrich

unread,
Oct 23, 2013, 3:50:42 PM10/23/13
to stan-...@googlegroups.com
On Wednesday, October 23, 2013 3:37:24 PM UTC-4, Avi Feller wrote:
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan/libs/rstan.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan/libs/rstan.so, 6): Symbol not found: __ZNK4Rcpp7RObject4attrERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
  Referenced from: /Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan/libs/rstan.so

Can you try it with optimization set to zero so that maybe it will give us the unmangled symbol name that is causing the problem?

Ben

Scott Baldwin

unread,
Oct 23, 2013, 5:14:47 PM10/23/13
to stan-...@googlegroups.com
When I build Stan using Xcode 5 on a fresh install of Mavericks, I get
the following warnings

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O3 -o
bin/stan/agrad/rev/var_stack.o src/stan/agrad/rev/var_stack.cpp

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O3 -o
bin/stan/math/matrix.o src/stan/math/matrix.cpp

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O3 -o
bin/stan/agrad/matrix.o src/stan/agrad/matrix.cpp

ar -rs bin/libstan.a bin/stan/agrad/rev/var_stack.o
bin/stan/math/matrix.o bin/stan/agrad/matrix.o

ar: creating archive bin/libstan.a

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: bin/libstan.a(matrix.o) has no symbols

scotts-air:stan_home sab48$ sudo make bin/stanc

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O3 -o
bin/stan/command/stanc.o src/stan/command/stanc.cpp

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O0 -o
bin/stan/gm/grammars/expression_grammar_inst.o
src/stan/gm/grammars/expression_grammar_inst.cpp

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O0 -o
bin/stan/gm/grammars/program_grammar_inst.o
src/stan/gm/grammars/program_grammar_inst.cpp

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O0 -o
bin/stan/gm/grammars/statement_2_grammar_inst.o
src/stan/gm/grammars/statement_2_grammar_inst.cpp

In file included from src/stan/gm/grammars/statement_2_grammar_inst.cpp:1:

src/stan/gm/grammars/statement_2_grammar_def.hpp:120:18: warning: multiple

unsequenced modifications to '_pass' [-Wunsequenced]

[_pass = add_conditional_condition_f(_val,_1,

^

1 warning generated.

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O0 -o
bin/stan/gm/grammars/statement_grammar_inst.o
src/stan/gm/grammars/statement_grammar_inst.cpp

In file included from src/stan/gm/grammars/statement_grammar_inst.cpp:1:

src/stan/gm/grammars/statement_grammar_def.hpp:549:16: warning: multiple

unsequenced modifications to '_pass' [-Wunsequenced]

[_pass = validate_int_expr2_f(_1,boost::phoenix::ref(error_msgs_))]

^

src/stan/gm/grammars/statement_grammar_def.hpp:588:18: warning: multiple

unsequenced modifications to '_pass' [-Wunsequenced]

[_pass = validate_allow_sample_f(_r1,

^

2 warnings generated.

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O0 -o
bin/stan/gm/grammars/term_grammar_inst.o
src/stan/gm/grammars/term_grammar_inst.cpp

In file included from src/stan/gm/grammars/term_grammar_inst.cpp:1:

src/stan/gm/grammars/term_grammar_def.hpp:456:38: warning: multiple unsequenced

modifications to '_val' [-Wunsequenced]

[_val = multiplication(_val,_1,

^

src/stan/gm/grammars/term_grammar_def.hpp:476:29: warning: multiple unsequenced

modifications to '_val' [-Wunsequenced]

[_val = negate_expr_f(_1,boost::phoenix::ref(error...

^

src/stan/gm/grammars/term_grammar_def.hpp:488:22: warning: multiple unsequenced

modifications to '_val' [-Wunsequenced]

[_val = add_expression_dimss_f(_val, _1, _pass,

^

src/stan/gm/grammars/term_grammar_def.hpp:501:37: warning: multiple unsequenced

modifications to '_val' [-Wunsequenced]

| fun_r(_r1) [_val = set_fun_type_named_f(_1,_r1,_pass,...

^

4 warnings generated.

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O0 -o
bin/stan/gm/grammars/var_decls_grammar_inst.o
src/stan/gm/grammars/var_decls_grammar_inst.cpp

In file included from src/stan/gm/grammars/var_decls_grammar_inst.cpp:1:

src/stan/gm/grammars/var_decls_grammar_def.hpp:636:19: warning: multiple

unsequenced modifications to '_val' [-Wunsequenced]

[_val = add_var_f(_1,boost::phoenix::ref(var_map_),_a,_r2,

^

src/stan/gm/grammars/var_decls_grammar_def.hpp:727:18: warning: multiple

unsequenced modifications to '_pass' [-Wunsequenced]

[_pass = validate_int_expr_f(_1,boost::phoenix::ref(error_msgs_))]

^

src/stan/gm/grammars/var_decls_grammar_def.hpp:785:18: warning: multiple

unsequenced modifications to '_pass' [-Wunsequenced]

[_pass = validate_int_expr_f(_1,boost::phoenix::ref(error_msgs_))]

^

src/stan/gm/grammars/var_decls_grammar_def.hpp:841:23: warning: multiple

unsequenced modifications to '_pass' [-Wunsequenced]

[ _pass = set_int_range_lower_f(_val,_1,

^

src/stan/gm/grammars/var_decls_grammar_def.hpp:865:23: warning: multiple

unsequenced modifications to '_pass' [-Wunsequenced]

[ _pass = set_double_range_lower_f(_val,_1,

^

src/stan/gm/grammars/var_decls_grammar_def.hpp:898:16: warning: multiple

unsequenced modifications to '_pass' [-Wunsequenced]

[_pass = validate_int_expr_f(_1,boost::phoenix::ref(error_msgs_))]

^

6 warnings generated.

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O0 -o
bin/stan/gm/grammars/whitespace_grammar_inst.o
src/stan/gm/grammars/whitespace_grammar_inst.cpp

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O0 -o
bin/stan/gm/ast_def.o src/stan/gm/ast_def.cpp

ar -rs bin/libstanc.a bin/stan/gm/grammars/expression_grammar_inst.o
bin/stan/gm/grammars/program_grammar_inst.o
bin/stan/gm/grammars/statement_2_grammar_inst.o
bin/stan/gm/grammars/statement_grammar_inst.o
bin/stan/gm/grammars/term_grammar_inst.o
bin/stan/gm/grammars/var_decls_grammar_inst.o
bin/stan/gm/grammars/whitespace_grammar_inst.o bin/stan/gm/ast_def.o

ar: creating archive bin/libstanc.a

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -c -O3 -o
bin/stan/command/print.o src/stan/command/print.cpp

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -O0 -o bin/print
bin/stan/command/print.o -Lbin -lstan

g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall
-DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
-Wno-unused-function -ftemplate-depth-256 -O0 -o bin/stanc
bin/stan/command/stanc.o -Lbin -lstanc:

Jiqiang Guo

unread,
Oct 23, 2013, 5:22:32 PM10/23/13
to stan-...@googlegroups.com
Setting it to zero might not help.  But it can be figured out by

$ c++filt __ZNK4Rcpp7RObject4attrERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
Rcpp::RObject::attr(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const


In addition, I upgraded to OS X Mavericks today and I have the same problem.  For now I do not know what to do.  I would have the same reported problem for installing rstan, which seems to be related to Rcpp.  So I tried to install Rcpp from source, which gives some warning during the installation, and then I would end up with just warnings with installing rstan.  But the seemingly successfully installed rstan does not work.  Attached is the output with warnings and the error.

--
Jiqiang 


 


Ben
out.txt

Bob Carpenter

unread,
Oct 23, 2013, 5:26:34 PM10/23/13
to stan-...@googlegroups.com
This is all fine.

We have a fix from Robert Goedman queued up for those unsequenced
warnings.

Our use follows Boost's recommended usage, and the warnings only
surfaced with newer compilers. I still don't even know if they're
false positive warnings or not, but we're going to code around them
anyway.

The root cause is the interaction of Boost's functional programming
framework with its parsing framework.

- Bob

Robert J Goedman

unread,
Oct 23, 2013, 6:28:31 PM10/23/13
to stan-...@googlegroups.com
Thanks Avi,

Those warnings (e.g. 'unsequenced', etc.) as also Scott reported and Bob mentioned, will indeed not prevent Stan from working.

If the optimization level when building the stan compiler is above 1 (e.g. -O2) the 'return *m_iterator;' warning will cause problems
and will result in the compiler never properly recognizing the stan model statements. I wonder if that might somehow have been the
case for Jiqiang. It certainly is the typical parser error message for that problem.

Under R, the tools used to build R and the libraries created from packages like Rcpp and RStan (rcpp.so and rstan.so in the
R library) need to match to work together.  If they don't it will show up when R tests if the package can be loaded towards the
end of the install.

Earlier you pointed to a stackoverflow post by Romain, I'm assuming you adapted your ~/.R/Makevars as he suggested.
Is it possible that this file has been overwritten when you installed RStan. Could you check that and in addition to Ben's question
(e.g., like I did below), can you send us the content of your ~/.R/Makevars file?

On a separate note, from your earlier and other emails, I've been wondering why it seems as if llvm-gcc-4.2 sometimes
is left intact and sometimes is removed. My current hypothesis is that if llvm-gcc-4.2 resided in /usr (vs. e.g. in /usr/local or
/opt) it will be affected by upgrading to Mavericks and/or installing the command line tools.

Rob J. Goedman

Robs-15inch-2:~ rob$ clang++ -v
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
Robs-15inch-2:~ rob$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
Robs-15inch-2:~ rob$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

Avi Feller

unread,
Oct 23, 2013, 8:21:22 PM10/23/13
to stan-...@googlegroups.com
Rob,

Thanks for the thorough response. Replies inline:
 
If the optimization level when building the stan compiler is above 1 (e.g. -O2) the 'return *m_iterator;' warning will cause problems
and will result in the compiler never properly recognizing the stan model statements. I wonder if that might somehow have been the
case for Jiqiang. It certainly is the typical parser error message for that problem. 

Under R, the tools used to build R and the libraries created from packages like Rcpp and RStan (rcpp.so and rstan.so in the
R library) need to match to work together.  If they don't it will show up when R tests if the package can be loaded towards the
end of the install.
This is very helpful, and your explanation makes a lot of sense. However, it does make me nervous that we'll need to wait for the next version of R for Mac OS to resolve this issue.

 
Earlier you pointed to a stackoverflow post by Romain, I'm assuming you adapted your ~/.R/Makevars as he suggested.
Is it possible that this file has been overwritten when you installed RStan. Could you check that and in addition to Ben's question
(e.g., like I did below), can you send us the content of your ~/.R/Makevars file?
See below for the Makevars file and version numbers. (also, Ben and I wrote a bit off-list, as I didn't have much constructive to offer him)
 
On a separate note, from your earlier and other emails, I've been wondering why it seems as if llvm-gcc-4.2 sometimes
is left intact and sometimes is removed. My current hypothesis is that if llvm-gcc-4.2 resided in /usr (vs. e.g. in /usr/local or
/opt) it will be affected by upgrading to Mavericks and/or installing the command line tools.
I've been trying to learn more about this, but I find it all rather confusing. So I'm glad that you're tracking it all!

Thanks again for all the help. I feel less selfish for monopolizing the list today knowing that others are experiencing the same problem.

- Avi


Makevars (copied and pasted from here):
CC=clang
CXX=clang++
CFLAGS="-mtune=native -g -O1 -Wall -pedantic -Wconversion"
CXXFLAGS="-mtune=native -g -O1 -Wall -pedantic -Wconversion"
FLIBS=-lgfortran


Command Line Tool versions:
Avis-MacBook-Pro:~ avifeller$ clang++ -v
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
Avis-MacBook-Pro:~ avifeller$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
Avis-MacBook-Pro:~ avifeller$ gcc -v

Robert J Goedman

unread,
Oct 24, 2013, 11:17:45 AM10/24/13
to stan-...@googlegroups.com
Hi Avi,

A test on an older machine upgraded to OSX Mavericks / XCode 5 shows that vanilla (CRAN) R 3.0.2 + Rcpp binary from CRAN works with RStan 2.0.0 if the llvm-gcc-4.2 compiler is available.

I am not sure if llvm-gcc-4.2 is completely gone from your system (on my older system it is in /usr/llvm-gcc-4.2 and /usr/bin/llvm-gcc-4.2 links to it; Creating a new symbolic link might work in that case).

If it is gone, I wonder if the issue can be solved by re-installing llvm-gcc-4.2 from http://llvm.org/releases/download.html (and at least temporarily renaming the Makevars file). 

Rob J. Goedman




Jiqiang Guo

unread,
Oct 24, 2013, 11:54:10 AM10/24/13
to stan-...@googlegroups.com
I do not have llvm-gcc-4.2 left after upgrading to mavericks and xcode 5. 

One solution to the problem on os x mavericks might be add -stdlib=libstdc++ to CXX.  If I configure CXX shown below by using R CMD config, it would be fine for both 1.3.0 and 2.0.0. 

$ R CMD config CXX
g++ -arch x86_64 -ftemplate-depth-256 -stdlib=libstdc++


--
Jiqiang 

Avi Feller

unread,
Oct 24, 2013, 12:41:41 PM10/24/13
to stan-...@googlegroups.com
Hi all,

I'm very happy to report that adding "-stdlib=libstdc++" to CXX in my Makevars file has solved the problem! I have successfully (1) install RStan 2.0.0 from the source file; and (2) compiled and executed the 8 schools example. 

For completeness, I ran the following steps to get RStan to run successfully on OS X Mavericks:
  • (I upgraded to XCode 5.0.1 as part of the overall OS upgrade.)
  • I installed R 3.0.2 (apparently earlier versions fail spectacularly on Mavericks; see here)
  • I installed the latest preview release of RStudio (not essential, of course, but good to know that they have a version that plays nicely with Mavericks)
  • Following the advice from previous posts and from Jiqiang, I created a Makevars file with the following:
CC=clang
CXX=clang++ -arch x86_64 -ftemplate-depth-256 -stdlib=libstdc++
CFLAGS="-mtune=native -g -O1 -Wall -pedantic -Wconversion"
CXXFLAGS="-mtune=native  -O3 -Wall -pedantic -Wconversion"  #set_by_rstan
FLIBS=-lgfortran
R_XTRA_CPPFLAGS =  -I$(R_INCLUDE_DIR)   #set_by_rstan

Note that this is the Makevars file after running RStan and executing set_cppo("fast")
  • I then installed RStan 2.0.0 from the source file (I have yet to try installing RStan 1.3.0, but Jiqiang claims that it works!). 
I imagine that more computationally savvy folks will be able to tell me which bits of Makevars are essential, and which are not. But at least I've regained functionality!
 
Finally, Rob and Jiqiang: I agree that it doesn't look like llvm-gcc-4.2 exists in the new OS. Though it seems like that's no longer an issue.

Once again, thank you all for the impressive collective effort over the past 36 hours. As always, I'm in awe of the tremendous talent behind the Stan project.

Best,
Avi

Noah Motion

unread,
Oct 25, 2013, 3:32:14 PM10/25/13
to stan-...@googlegroups.com
In case anyone makes it this far in the discussion and is still having problems, I couldn't get XCode to work at all. I tried downloading and installing the command line tools as a separate package from the Apple developers website, but this didn't work. I also tried typing 'xcode-select --install' at a terminal prompt, and this brought up a dialog asking if you want to install the command line tools. I clicked 'yes', but this didn't work either. Finally, I removed XCode from my machine(s) and installed the OSX GCC-10.7 package linked from the "RStan Getting Started" github page (https://github.com/kennethreitz/osx-gcc-installer/), and it worked like a charm! I had to download the Stan source and install from there, though, since Mavericks doesn't install gnutar apparently, and this is required by the 'standard' install procedure. Anyway, Stan seems to be working fine now.

Noah

Bob Carpenter

unread,
Oct 25, 2013, 3:41:21 PM10/25/13
to stan-...@googlegroups.com
Thanks for the report.

The built-in tar for Apple seems to be incompatible with
gnutar --- we've had trouble with this elswhere. They
seem to be using bsdtar as the default.

Does Stan itself not unpack properly with the built-in
bsdtar? I haven't been having problems with it, so maybe
it's another mavericks issue?

- Bob

On 10/25/13 3:32 PM, Noah Motion wrote:
> In case anyone makes it this far in the discussion and is still having problems, I couldn't get XCode to work at all. I
> tried downloading and installing the command line tools as a separate package from the Apple developers website, but
> this didn't work. I also tried typing 'xcode-select --install' at a terminal prompt, and this brought up a dialog asking
> if you want to install the command line tools. I clicked 'yes', but this didn't work either. Finally, I removed XCode
> from my machine(s) and installed the OSX GCC-10.7 package linked from the "RStan Getting Started" github page
> (https://github.com/kennethreitz/osx-gcc-installer/), and it worked like a charm! I had to download the Stan source and
> install from there, though, since Mavericks doesn't install gnutar apparently, and this is required by the 'standard'
> install procedure. Anyway, Stan seems to be working fine now.
>
> Noah
>
> On Thursday, October 24, 2013 12:41:41 PM UTC-4, Avi Feller wrote:
>
> Hi all,
>
> I'm very happy to report that adding "-stdlib=libstdc++" to CXX in my Makevars file has solved the problem! I have
> successfully (1) install RStan 2.0.0 from the source file; and (2) compiled and executed the 8 schools example.
>
> For completeness, I ran the following steps to get RStan to run successfully on OS X Mavericks:
>
> * (I upgraded to XCode 5.0.1 as part of the overall OS upgrade.)
> * I installed R 3.0.2 (apparently earlier versions fail spectacularly on Mavericks; see here
> <http://stackoverflow.com/questions/19546330/os-x-mavericks-compatibility-with-r>)
> * I installed the latest preview release of RStudio (not essential, of course, but good to know that they have a
> version <http://blog.rstudio.org/2013/10/22/rstudio-and-os-x-10-9-mavericks/> that plays nicely with Mavericks)
> * Following the advice from previous posts and from Jiqiang, I created a Makevars file with the following:
>
> CC=clang
>
> CXX=clang++ -arch x86_64 -ftemplate-depth-256 -stdlib=libstdc++
>
> CFLAGS="-mtune=native -g -O1 -Wall -pedantic -Wconversion"
>
> CXXFLAGS="-mtune=native -O3 -Wall -pedantic -Wconversion" #set_by_rstan
>
> FLIBS=-lgfortran
>
> R_XTRA_CPPFLAGS = -I$(R_INCLUDE_DIR) #set_by_rstan
>
>
> Note that this is the Makevars file /after/ running RStan and executing set_cppo("fast").
>
> * I then installed RStan 2.0.0 from the source file (I have yet to try installing RStan 1.3.0, but Jiqiang claims
> that it works!).
>
> I imagine that more computationally savvy folks will be able to tell me which bits of Makevars are essential, and
> which are not. But at least I've regained functionality!
> Finally, Rob and Jiqiang: I agree that it doesn't look like llvm-gcc-4.2 exists in the new OS. Though it seems like
> that's no longer an issue.
>
> Once again, thank you all for the impressive collective effort over the past 36 hours. As always, I'm in awe of the
> tremendous talent behind the Stan project.
>
> Best,
> Avi
>
>
> On Thursday, October 24, 2013 11:54:10 AM UTC-4, Jiqiang Guo wrote:
>
> I do not have llvm-gcc-4.2 left after upgrading to mavericks and xcode 5.
>
> One solution to the problem on os x mavericks might be add -stdlib=libstdc++ to CXX. If I configure CXX shown
> below by using R CMD config, it would be fine for both 1.3.0 and 2.0.0.
>
> $ R CMD config CXX
> g++ -arch x86_64 -ftemplate-depth-256 -stdlib=libstdc++
>
>
> --
> Jiqiang
>
>
> On Thu, Oct 24, 2013 at 11:17 AM, Robert J Goedman <goe...@icloud.com> wrote:
>
> Hi Avi,
>
> A test on an older machine upgraded to OSX Mavericks / XCode 5 shows that vanilla (CRAN) R 3.0.2 + Rcpp
> binary from CRAN works with RStan 2.0.0 if the llvm-gcc-4.2 compiler is available.
>
> I am not sure if llvm-gcc-4.2 is completely gone from your system (on my older system it is in
> /usr/llvm-gcc-4.2 and /usr/bin/llvm-gcc-4.2 links to it; Creating a new symbolic link might work in that case).
>
> If it is gone, I wonder if the issue can be solved by re-installing llvm-gcc-4.2 from
> http://llvm.org/releases/download.html <http://llvm.org/releases/download.html> (and at least temporarily
>> <http://stackoverflow.com/questions/19546672/rcpp-error-with-xcode-5-0-and-osx-10-8-5-and-r-3-0-2>):
>> For more options, visit https://groups.google.com/groups/opt_out <https://groups.google.com/groups/opt_out>.
>
> --
> 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/groups/opt_out <https://groups.google.com/groups/opt_out>.

Noah Motion

unread,
Oct 25, 2013, 6:03:07 PM10/25/13
to
After installing Mavericks, when I first tried to install rstan with the install_url command, it returned an error due to there not being a /usr/bin/gnutar directory. I don't remember what all the error message said (I can try to reproduce it if that would be helpful), but I don't gather that bsdtar played any role. I didn't mention it above, but before realizing I didn't have a C++ compiler, I spent some time fiddling around with trying to install gnutar, creating a symlink from the installation to the directory stan was looking for, and so forth, but then I just decided to download the source and install from that locally, since my other attempted solutions weren't working.

EDIT: Here's the full error message:

Downloading rstan_2.0.0.tar.gz from https://github.com/stan-dev/rstan/releases/download/v2.0.0/rstan_2.0.0.tar.gz
Installing package from /tmp/RtmpD9Ld9B/rstan_2.0.0.tar.gz
sh: /usr/bin/gnutar: No such file or directory
sh: /usr/bin/gnutar: No such file or directory
Error in system(cmd, intern = TRUE) : error in running command
In addition: Warning message:
In untar(src, exdir = target, compressed = "gzip") :
  ‘/usr/bin/gnutar -xf '/tmp/RtmpD9Ld9B/rstan_2.0.0.tar.gz' -C '/tmp/RtmpD9Ld9B'’ returned error code 127

For what it's worth, and not that I expect it has anything to do with R or Rstudio, but I got this error message with RStudio 0.97.5-something and with the preview version of 0.98.447 (http://www.rstudio.com/ide/download/preview; the RStudio folks recommend this as a workaround until some incompatibiltiy between Mavericks and RStudio is worked out), and with R 3.0.1 and 3.0.2.

Noah 

Jiqiang Guo

unread,
Oct 25, 2013, 10:11:58 PM10/25/13
to stan-...@googlegroups.com
The problem lies in that install_url is using gnutar, which does not exist on OS X Mavericks. I thought it was install_url's fault, but for some reason R on Mac defines TAR environment with value 'gnutar', which gets used in install_url.  

Anyway, I have changed the installation for rstan to not using install_url (see the link from mc-stan.org) and it somehow does not use the gnutar defined in TAR environment, which I do not understannd but is good. 

--
Jiqiang 


On Fri, Oct 25, 2013 at 5:56 PM, Noah Motion <noahs...@gmail.com> wrote:
After installing Mavericks, when I first tried to install rstan with the install_url command, it returned an error due to there not being a /usr/bin/gnutar directory. I don't remember what all the error message said (I can try to reproduce it if that would be helpful), but I don't gather that bsdtar played any role. I didn't mention it above, but before realizing I didn't have a C++ compiler, I spent some time fiddling around with trying to install gnutar, creating a symlink from the installation to the directory stan was looking for, and so forth, but then I just decided to download the source and install from that locally, since my other attempted solutions weren't working.

Noah 

Kyle Foreman

unread,
Nov 20, 2013, 12:45:34 PM11/20/13
to stan-...@googlegroups.com
I can install the 2.0.1 release fine in OSX 10.9 using R's install from source after updating my Makevars file. 

But I am unable to compile the latest dev version. I clone the repo (from here) and load the submodule, ensure my Makevars file contains "CXX=g++ -arch x86_64 -ftemplate-depth-256 -stdlib=libstdc++", and then run make install

I then run into the dreaded linking error:
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object ‘/private/tmp/RtmpfuzB6D/Rinst49c6215320c/rstan/libs/rstan.so’:
  dlopen(/private/tmp/RtmpfuzB6D/Rinst49c6215320c/rstan/libs/rstan.so, 6): Symbol not found: __ZNK4Rcpp7RObject4attrERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
  Referenced from: /private/tmp/RtmpfuzB6D/Rinst49c6215320c/rstan/libs/rstan.so
  Expected in: flat namespace
 in /private/tmp/RtmpfuzB6D/Rinst49c6215320c/rstan/libs/rstan.so
Error: loading failed

(using latest versions of xcode/gcc/g++/R/etc...) 

The only reason I'm messing with the dev version is my model uses multi_normal_prec() which is broken in the 2.0.1 release but has since been fixed - any suggestions? Thanks!

Kyle Foreman

unread,
Nov 20, 2013, 1:01:12 PM11/20/13
to stan-...@googlegroups.com
For now I've just edited multi_normal_prec.hpp by hand to include the correct header - poor form on my part, but at least I can run my model!


--
You received this message because you are subscribed to a topic in the Google Groups "stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/_7Lu0ahphik/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages