[R-SIG-Mac] Advise on building R on OSX without optimization for debugging

Simon Urbanek @|mon@urb@nek @end|ng |rom R-project@org
Wed Jul 8 22:38:56 CEST 2020


Dmitriy,

due to permissions and the various limitations on passing environment variables across processes it is often easier to simply run R and attach the debugger to it:

$ R
[...]
> Sys.getpid()
[1] 89955
> 

$ sudo lldb
Password:
(lldb) attach 89955
[...]
(lldb) c
Process 89955 resuming

Also note that you shouldn't change Makeconf by hand, simply supply any CFLAGS you need to configure, e.g.:

../R-devel/configure --enable-R-shlib 'CFLAGS=-Wall -g -O0' 'CXXFLAGS=-Wall -g -O0'

Cheers,
Simon


> On Jul 8, 2020, at 11:08 PM, Dmitriy Selivanov <selivanov.dmitriy using gmail.com> wrote:
> 
> Dear all,
> 
> I'm trying to debug a segfault reported here
> https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17850 (thanks Kevin for
> the nice article
> https://kevinushey.github.io/blog/2015/04/13/debugging-with-lldb/ about
> debugging with lldb)
> 
> I need to compile R without optimization (with the O0 flag) instead of
> using binaries provided by Simon.
> 
> Here I have difficulties. What I've tried:
> 
>   1. Downloaded latest R-devel from
>   https://stat.ethz.ch/R/daily/R-devel.tar.gz
>   2. Downloaded xz and pcre2 as suggested here
>   https://mac.r-project.org/tools/
>   3. run ./confilgure
>   4. replaced O2 with O0 in Makeconf
>   5. make
> 
> Now R is compiled and I can launch it with ./bin/R. However when I run it
> with lldb
> 
>   1. ./bin/R -d lldb
>   2. run
> 
> I'm, getting:
> 
> Process 74482 launched:
> '/Users/dmitry.selivanov/Downloads/R-devel/bin/exec/R' (x86_64)
> 
> dyld: Library not loaded: libRblas.dylib
> 
>  Referenced from: /Users/dmitry.selivanov/Downloads/R-devel/bin/exec/R
> 
>  Reason: image not found
> 
> Process 74482 stopped
> 
> * thread #1, stop reason = signal SIGABRT
> 
>    frame #0: 0x0000000100574ebe dyld`__abort_with_payload + 10
> 
> dyld`__abort_with_payload:
> 
> ->  0x100574ebe <+10>: jae    0x100574ec8               ; <+20>
> 
>    0x100574ec0 <+12>: movq   %rax, %rdi
> 
>    0x100574ec3 <+15>: jmp    0x1005733e8               ; cerror_nocancel
> 
>    0x100574ec8 <+20>: retq
> 
> Target 0: (R) stopped.
> 
> 
> Any suggestions? Things are much easier on linux-based docker images, but I
> can't reproduce the reported bug there...
> 
> 
> Regards
> Dmitriy Selivanov
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 



More information about the R-SIG-Mac mailing list