Message-ID: <252d72a0-d56f-4e4b-bf45-9847cb4cf7bf@stats.ox.ac.uk>
Date: 2020-07-13T10:29:52Z
From: Brian Ripley
Subject: Advise on building R on OSX without optimization for debugging
In-Reply-To: <CA6BA59B-FB12-4C5D-BB42-60CC22229C99@R-project.org>
On 13/07/2020 11:14, Simon Urbanek wrote:
>
>
>> On Jul 13, 2020, at 7:59 PM, Prof Brian Ripley <ripley at 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 at stats.ox.ac.uk
>> Emeritus Professor of Applied Statistics, University of Oxford
>>
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford