3

I wanted to try out R Shiny but whenever I try any of the examples my R crashes:

> require(shiny)
Loading required package: shiny
> runExample("01_hello")
libc++abi.dylib: __cxa_guard_acquire detected deadlock
Abort trap: 6

Running from the R Gui or RStudio I get more information (in the details). I noticed an RcppExports.cpp call before crash. I have had issues with the libc++ (LLVM C++ standard library with C+11) versus the libstdc++ (GNU C++ standard library) before and given that I know Rcpp requires the GNU library and the LLVM library is the default in Xcode 5 I suspect that might have something to do with it. Does anyone know how I would change the default C++ library being loaded on Mac OS X (10.9.1) ? Not for building obviously - I can override that manually in the make.

Process:         R [23120]
Path:            /Applications/R.app/Contents/MacOS/R
Identifier:      org.R-project.R
Version:         R 3.0.2 GUI 1.62 Snow Leopard build (6558)
Code Type:       X86-64 (Native)
Parent Process:  launchd [250]
Responsible:     R [23120]
User ID:         501
Date/Time:       2014-02-06 14:55:39.785 +0000
OS Version:      Mac OS X 10.9.1 (13B42)
Report Version:  11
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
abort() called
__cxa_guard_acquire detected deadlock

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff9a5e4866 __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff8e92135c pthread_kill + 92
2   libsystem_c.dylib               0x00007fff980bebba abort + 125
3   libc++abi.dylib                 0x00007fff925a1141 abort_message + 257
4   libc++abi.dylib                 0x00007fff925c428e __cxa_guard_acquire + 192
5   httpuv.so                       0x000000010860500b Rcpp::RNGScope::RNGScope() + 33 (routines.h:74)
6   httpuv.so                       0x00000001086040d6 httpuv_makeTcpServer + 54 (RcppExports.cpp:32)
7   libR.dylib                      0x00000001001831ce do_dotcall + 1230 (dotcode.c:634)
8   libR.dylib                      0x00000001001ab2ad Rf_eval + 1181 (eval.c:642)
9   libR.dylib                      0x00000001001b7a70 do_begin + 384 (eval.c:1573)
10  libR.dylib                      0x00000001001ab11f Rf_eval + 783 (eval.c:614)
11  libR.dylib                      0x00000001001b535e Rf_applyClosure + 1422 (eval.c:1019)
12  libR.dylib                      0x00000001001ab34e Rf_eval + 1342 (eval.c:661)
13  libR.dylib                      0x00000001001b7717 do_set + 343 (eval.c:1902)
14  libR.dylib                      0x00000001001ab11f Rf_eval + 783 (eval.c:614)
15  libR.dylib                      0x00000001001b7a70 do_begin + 384 (eval.c:1573)
16  libR.dylib                      0x00000001001ab11f Rf_eval + 783 (eval.c:614)
17  libR.dylib                      0x00000001001b535e Rf_applyClosure + 1422 (eval.c:1019)
18  libR.dylib                      0x00000001001ab34e Rf_eval + 1342 (eval.c:661)
19  libR.dylib                      0x00000001001b4b03 forcePromise + 147 (eval.c:464)
20  libR.dylib                      0x00000001001b5624 getvar + 452 (eval.c:3525)
21  libR.dylib                      0x00000001001ac645 bcEval + 4485 (eval.c:4378)
22  libR.dylib                      0x00000001001aaf06 Rf_eval + 246 (eval.c:545)
23  libR.dylib                      0x00000001001b4b03 forcePromise + 147 (eval.c:464)
24  libR.dylib                      0x00000001001b5624 getvar + 452 (eval.c:3525)
25  libR.dylib                      0x00000001001ac645 bcEval + 4485 (eval.c:4378)
26  libR.dylib                      0x00000001001aaf06 Rf_eval + 246 (eval.c:545)
27  libR.dylib                      0x00000001001b4b03 forcePromise + 147 (eval.c:464)
28  libR.dylib                      0x00000001001b5624 getvar + 452 (eval.c:3525)
29  libR.dylib                      0x00000001001ac645 bcEval + 4485 (eval.c:4378)
30  libR.dylib                      0x00000001001aaf06 Rf_eval + 246 (eval.c:545)
31  libR.dylib                      0x00000001001b4b03 forcePromise + 147 (eval.c:464)
32  libR.dylib                      0x00000001001b5624 getvar + 452 (eval.c:3525)
33  libR.dylib                      0x00000001001ac645 bcEval + 4485 (eval.c:4378)
34  libR.dylib                      0x00000001001aaf06 Rf_eval + 246 (eval.c:545)
35  libR.dylib                      0x00000001001b4b03 forcePromise + 147 (eval.c:464)
36  libR.dylib                      0x00000001001b5624 getvar + 452 (eval.c:3525)
37  libR.dylib                      0x00000001001ac645 bcEval + 4485 (eval.c:4378)
38  libR.dylib                      0x00000001001aaf06 Rf_eval + 246 (eval.c:545)
39  libR.dylib                      0x00000001001b535e Rf_applyClosure + 1422 (eval.c:1019)
40  libR.dylib                      0x00000001001ad77e bcEval + 8894 (eval.c:4597)
41  libR.dylib                      0x00000001001aaf06 Rf_eval + 246 (eval.c:545)
42  libR.dylib                      0x00000001001b535e Rf_applyClosure + 1422 (eval.c:1019)
43  libR.dylib                      0x00000001001ad77e bcEval + 8894 (eval.c:4597)
44  libR.dylib                      0x00000001001aaf06 Rf_eval + 246 (eval.c:545)
45  libR.dylib                      0x00000001001b535e Rf_applyClosure + 1422 (eval.c:1019)
46  libR.dylib                      0x00000001001ad77e bcEval + 8894 (eval.c:4597)
47  libR.dylib                      0x00000001001aaf06 Rf_eval + 246 (eval.c:545)
48  libR.dylib                      0x00000001001b535e Rf_applyClosure + 1422 (eval.c:1019)
49  libR.dylib                      0x00000001001ad77e bcEval + 8894 (eval.c:4597)
50  libR.dylib                      0x00000001001aaf06 Rf_eval + 246 (eval.c:545)
51  libR.dylib                      0x00000001001b535e Rf_applyClosure + 1422 (eval.c:1019)
52  libR.dylib                      0x00000001001ab34e Rf_eval + 1342 (eval.c:661)
53  libR.dylib                      0x00000001001b7717 do_set + 343 (eval.c:1902)
54  libR.dylib                      0x00000001001ab11f Rf_eval + 783 (eval.c:614)
55  libR.dylib                      0x00000001001b7a70 do_begin + 384 (eval.c:1573)
56  libR.dylib                      0x00000001001ab11f Rf_eval + 783 (eval.c:614)
57  libR.dylib                      0x00000001001baa55 do_for + 1525 (eval.c:1415)
58  libR.dylib                      0x00000001001ab11f Rf_eval + 783 (eval.c:614)
59  libR.dylib                      0x00000001001b7a70 do_begin + 384 (eval.c:1573)
60  libR.dylib                      0x00000001001ab11f Rf_eval + 783 (eval.c:614)
61  libR.dylib                      0x00000001001ab11f Rf_eval + 783 (eval.c:614)
62  libR.dylib                      0x00000001001b7a70 do_begin + 384 (eval.c:1573)
63  libR.dylib                      0x00000001001ab11f Rf_eval + 783 (eval.c:614)
64  libR.dylib                      0x00000001001b535e Rf_applyClosure + 1422 (eval.c:1019)
65  libR.dylib                      0x00000001001ab34e Rf_eval + 1342 (eval.c:661)
66  libR.dylib                      0x00000001001b7a70 do_begin + 384 (eval.c:1573)
67  libR.dylib                      0x00000001001ab11f Rf_eval + 783 (eval.c:614)
68  libR.dylib                      0x00000001001ab11f Rf_eval + 783 (eval.c:614)
69  libR.dylib                      0x00000001001b7a70 do_begin + 384 (eval.c:1573)
70  libR.dylib                      0x00000001001ab11f Rf_eval + 783 (eval.c:614)
71  libR.dylib                      0x00000001001b535e Rf_applyClosure + 1422 (eval.c:1019)
72  libR.dylib                      0x00000001001ab34e Rf_eval + 1342 (eval.c:661)
73  libR.dylib                      0x00000001001d8b9a R_ReplDLLdo1 + 458 (main.c:363)
74  org.R-project.R                 0x000000010001f38e run_REngineRmainloop + 302
75  org.R-project.R                 0x000000010001379c -[REngine runREPL] + 124
76  org.R-project.R                 0x0000000100001b7e main + 910
77  org.R-project.R                 0x00000001000017e4 start + 52

Thread 1:
...

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00007fff7d09a310  rcx: 0x00007fff5fbf84d8  rdx: 0x0000000000000000
  rdi: 0x0000000000000707  rsi: 0x0000000000000006  rbp: 0x00007fff5fbf8500  rsp: 0x00007fff5fbf84d8
   r8: 0x00007fff925c7635   r9: 0x00007fff980e6900  r10: 0x0000000008000000  r11: 0x0000000000000206
  r12: 0x00007fff5fbf8660  r13: 0x0000000107d76548  r14: 0x0000000000000006  r15: 0x00007fff5fbf8540
  rip: 0x00007fff9a5e4866  rfl: 0x0000000000000206  cr2: 0x0000000100333fd4

Logical CPU:     0
Error Code:      0x02000148
Trap Number:     133
5
  • If you compile/link for one of lib{std}c++ then you can only load that one. The symbols are different, not to mention the .dylibs have different names. Overriding at build time is the way to go.
    – trojanfoe
    Feb 6, 2014 at 15:26
  • Thanks for the quick reply. Building and compiling are not the problem; the issue is that 3rd party installed apps (like Shiny) are immediately going for the LLVM library whereas they need to go for the GNU library. Is there a setting I can change somewhere so that any already compiled executable goes for the GNU library instead of the LLVM ? I am relatively new to the apple world - so sorry if it sounds like a ridiculous question.
    – crogg01
    Feb 6, 2014 at 15:29
  • No. I don't know the architecture of R shiny, but if it's based on dlopen() of a .dylib then I'm pretty sure both sides will need to use the same C++ library, especially if they are passing standard C++ objects across that boundary.
    – trojanfoe
    Feb 6, 2014 at 15:31
  • 1
    The rcpp FAQ suggests that it should be compiled from source - have you done that - I assume if that is with clang etc some issues should go
    – mmmmmm
    Feb 6, 2014 at 16:40
  • Good idea - I will try that and make it use the libstdc++ from there. Still no guarantees though, Shiny could load libc++ explicitly.
    – crogg01
    Feb 6, 2014 at 17:15

2 Answers 2

3

My similar issue was solved by updating the packages it relies on. I did this with:

install.packages(c("Rcpp", "httpuv", "shiny"))

or in general:

update.packages()
1

I was having a similar problem. Doing the install this way and then explicitly calling library(Rcpp) in addition to library (shiny) fixed this for me.

1
  • This answer doesn't seem to stand on its own. Doing the install what way?
    – Daniel
    Mar 10, 2015 at 2:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .