[R-SIG-Mac] Advise on building R on OSX without optimization for debugging
Prof Brian Ripley
r|p|ey @end|ng |rom @t@t@@ox@@c@uk
Mon Jul 13 12:29:52 CEST 2020
On 13/07/2020 11:14, Simon Urbanek wrote:
>
>
>> On Jul 13, 2020, at 7:59 PM, Prof Brian Ripley <ripley using stats.ox.ac.uk> wrote:
>>
>> On 08/07/2020 21:38, Simon Urbanek wrote:
>>> 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
>>
>> On Catalina I can do that for a version of R I compiled, but not for a notarized binary distribution (which also refuses to be run under a debugger). The lldb error message is maximally uninformative:
>>
>> (lldb) attach 16682
>> error: attach failed: Error 1
>>
>> or
>>
>> (lldb) run
>> error: process exited with status -1 (Error 1)
>>
>> I presume that is intentional on Apple's part and there is no way round it other than weakening security (e.g. disable SIP)?
>>
>
>
> Correct. It is annoying enough that it made to to the FAQ:
>
> https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#I-cannot-attach-debugger-to-R
>
> So the recommended way is to use the non-notarised builds (you can also disable SIP but that is not recommended). And, yes, it would be nice if lldb provided a more useful error...
>
> I suspect that it would be actually sufficient to provide just a exec/R binary that doesn't use hardened run-time, but it couldn't be distributed in the Apple Installer ... unless we create it with the post install script ... something to test I suppose...
Thanks. My issues have been when my own build works but yours does not
but while I am still checking on High Sierra I have workarounds. AFAIR
the issues have all been array overruns which only sometimes cause
segfaults.
> Best,
> Simon
>
>
>
>
>> My memory was that it did work on High Sierra (I sometimes use it to investigate packages which segfault under your distribution but not with my builds) and I have just re-checked there with the CRAN distribution of 4.0.2.
>>
>> Brian Ripley
>>
>> --
>> Brian D. Ripley, ripley using stats.ox.ac.uk
>> Emeritus Professor of Applied Statistics, University of Oxford
>>
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac using r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
--
Brian D. Ripley, ripley using stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
More information about the R-SIG-Mac
mailing list