Skip to content

Running R with lldb

3 messages · Brian Ripley, Duncan Murdoch

#
I'm now successfully building R-devel in /Users/murdoch/R/R-devel.  If I 
run it from that directory using

  bin/R -d lldb

it starts, but "run" gives this error:

Process 11165 launched: '/Users/murdoch/R/R-devel/bin/exec/R' (x86_64)
dyld: Library not loaded: libRblas.dylib
   Referenced from: /Users/murdoch/R/R-devel/bin/exec/R
   Reason: image not found
Process 11165 stopped
* thread #1, stop reason = signal SIGABRT
     frame #0: 0x00000001004c7ede dyld`__abort_with_payload + 10
dyld`__abort_with_payload:
->  0x1004c7ede <+10>: jae    0x1004c7ee8               ; <+20>
     0x1004c7ee0 <+12>: movq   %rax, %rdi
     0x1004c7ee3 <+15>: jmp    0x1004c6408               ; cerror_nocancel
     0x1004c7ee8 <+20>: retq
Target 0: (R) stopped.

I can start it from the /Users/murdoch/R/R-devel/lib directory where 
libRblas.dylib lives.  Setting DYLD_LIBRARY_PATH or LD_LIBRARY_PATH to 
point there doesn't help (either on the bin/R command line or exported). 
  Is there some other way to run it from whatever directory I happen to 
be in?

Duncan Murdoch
On 02/05/2020 11:26 p.m., Simon Urbanek wrote:
#
One of the suggestions in

https://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Debugging-on-macOS

should help.  Both worked for my build of R-devel yesterday ....
On 05/08/2020 14:25, Duncan Murdoch wrote:

  
    
#
Thanks, attaching to the process seemed simplest.

For others:  the manual talks about doing it with gdb, but the same 
syntax works with lldb.  Here's an example:  Start R, then open a new 
terminal window:

murdoch at djmair3 ~
$ ps
   PID TTY           TIME CMD
11293 ttys000    0:00.08 -bash
13829 ttys000    0:00.31 /Users/murdoch/R/R-devel/bin/exec/R
13804 ttys001    0:00.03 -bash

murdoch at djmair3 ~
$ lldb -p 13829
(lldb) process attach --pid 13829
Process 13829 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
     frame #0: 0x00007fff70eb10fe libsystem_kernel.dylib`__select + 10
libsystem_kernel.dylib`__select:
->  0x7fff70eb10fe <+10>: jae    0x7fff70eb1108            ; <+20>
     0x7fff70eb1100 <+12>: movq   %rax, %rdi
     0x7fff70eb1103 <+15>: jmp    0x7fff70eaa22d            ; cerror
     0x7fff70eb1108 <+20>: retq
Target 0: (R) stopped.

Duncan Murdoch
On 05/08/2020 10:16 a.m., Prof Brian Ripley wrote: