I dropped the native Apple GL support a few years ago. Currently the only options are X11, WGL (for Windows), and null, which means you need to produce WebGL to view in a browser.

I suppose I could resurrect the native display. OpenGL has been deprecated on MacOS since Mojave, but maybe it will be supported for a few more years. Right now I don't even have svn running (the Catalina update broke it), but eventually things should get back to normal here.

Duncan Murdoch

On 03/08/2020 4:34 p.m., Simon Urbanek wrote:
Duncan,

I have seen crashes in rgl with X11 before, in fact I have an e-mail in my 
draft folder to you with that crash and backtrace (see below). However, I also 
recall that I have fixed the issue with some trivial step (which I can't 
remember - I think I may have messed with /opt and/or restart X11 or something 
like that) and I felt silly not doing it so I didn't end up sending the report. 
The crash comes likely from
https://github.com/XQuartz/AppleSGLX/blob/master/apple_visual.c#L142
which means that CGLChoosePixelFormat() fails, but no idea why since it is in 
principle independent of X11 - there should be also an error on stderr. The 
libGL code is more than 10 years old, so I wouldn't expect any changes anytime 
soon.

Cheers,
Simon


Begin forwarded message:

From: Simon Urbanek <simon.urba...@r-project.org>
Subject: rgl
Date: April 1, 2020 at 13:05:20 GMT+13
To: Duncan Murdoch <murdoch.dun...@gmail.com>

Duncan,

I'm preparing packages for R 4.0.0 release and rgl is segfaulting on load when 
DISPLAY is set (i.e. when X11 is available). Do you have any idea? (rgl 
0.100.50)

I remember something about a way to use native GL instead of X11, but I can't 
recall how to activate that. If DISPLAY is not set, it uses a NULL device which 
doesn't segfault (obviously).

Thanks,
Simon


library(rgl)
Process 54673 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
     frame #0: 0x00007fff5a145b66 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
->  0x7fff5a145b66 <+10>: jae    0x7fff5a145b70            ; <+20>
     0x7fff5a145b68 <+12>: movq   %rax, %rdi
     0x7fff5a145b6b <+15>: jmp    0x7fff5a13cae5            ; cerror_nocancel
     0x7fff5a145b70 <+20>: retq
Target 0: (R) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
   * frame #0: 0x00007fff5a145b66 libsystem_kernel.dylib`__pthread_kill + 10
     frame #1: 0x00007fff5a310080 libsystem_pthread.dylib`pthread_kill + 333
     frame #2: 0x00007fff5a0a11ae libsystem_c.dylib`abort + 127
     frame #3: 0x00000001086e6aed libGL.1.dylib`apple_visual_create_pfobj + 1010
     frame #4: 0x00000001086e457b libGL.1.dylib`apple_glx_create_context + 204
     frame #5: 0x00000001086e15b9 libGL.1.dylib`applegl_create_context + 182
     frame #6: 0x00000001086c1377 libGL.1.dylib`CreateContext + 126
     frame #7: 0x00000001086c1288 libGL.1.dylib`glXCreateContext + 199
     frame #8: 0x00000001084e5b23 
rgl.so`rgl::X11WindowImpl::X11WindowImpl(rgl::Window*, rgl::X11GUIFactory*, 
unsigned long, XVisualInfo*) [inlined] 
rgl::X11WindowImpl::initGL(this=0x000000010584fc00) at x11gui.cpp:335 [opt]
     frame #9: 0x00000001084e5b10 
rgl.so`rgl::X11WindowImpl::X11WindowImpl(rgl::Window*, rgl::X11GUIFactory*, 
unsigned long, XVisualInfo*) [inlined] 
rgl::X11WindowImpl::on_init(this=0x000000010584fc00) at x11gui.cpp:411 [opt]
     frame #10: 0x00000001084e5b10 
rgl.so`rgl::X11WindowImpl::X11WindowImpl(this=0x000000010584fc00, 
w=<unavailable>, f=0x000000010262c9b0, in_xwindow=10485763, 
invisualinfo=0x0000000100a6f560) at x11gui.cpp:78 [opt]
     frame #11: 0x00000001084e7610 rgl.so`rgl::X11GUIFactory::createWindowImpl(rgl::Window*) [inlined] 
rgl::X11WindowImpl::X11WindowImpl(this=<unavailable>, w=<unavailable>, f=<unavailable>, 
in_xwindow=<unavailable>, invisualinfo=<unavailable>) at x11gui.cpp:77 [opt]
     frame #12: 0x00000001084e75fa 
rgl.so`rgl::X11GUIFactory::createWindowImpl(this=<unavailable>, 
window=0x0000000100b33ba0) at x11gui.cpp:694 [opt]
     frame #13: 0x00000001084d9401 rgl.so`rgl::Window::Window(this=0x0000000100b33ba0, 
in_child=<unavailable>, factory=<unavailable>) at gui.cpp:147 [opt]
     frame #14: 0x00000001084c1dea rgl.so`rgl::Device::Device(this=0x0000000100b2d4c0, 
id=<unavailable>, useNULL=<unavailable>) at device.cpp:16 [opt]
     frame #15: 0x00000001084c28c5 
rgl.so`rgl::DeviceManager::createTestWindow(this=0x0000000100b34880) at 
devicemanager.cpp:167 [opt]
     frame #16: 0x00000001084d9a9a rgl.so`::rgl_init(initValue=<unavailable>, 
useNULL=<unavailable>, in_namespace=<unavailable>, debug=<unavailable>) at 
init.cpp:94 [opt]
     frame #17: 0x000000010012b4cb libR.dylib`R_doDotCall(ofun=<unavailable>, 
nargs=<unavailable>, cargs=0x00007ffeefbef4e0, call=0x0000000101cc1618) at 
dotcode.c:607 [opt]
     frame #18: 0x000000010017738a libR.dylib`bcEval(body=0x0000000101cc1650, 
rho=0x0000000101cc1228, useCache=<unavailable>) at eval.c:7646 [opt]
     frame #19: 0x000000010015d141 libR.dylib`Rf_eval(e=<unavailable>, 
rho=<unavailable>) at eval.c:723 [opt]
     frame #20: 0x000000010017d601 libR.dylib`R_execClosure(call=0x00000001019f12b0, 
newrho=<unavailable>, sysparent=<unavailable>, rho=0x00000001019df6b8, 
arglist=<unavailable>, op=<unavailable>) at eval.c:0 [opt]





On Aug 4, 2020, at 06:44, Duncan Murdoch <murdoch.dun...@gmail.com> wrote:

It didn't stay fixed.  I get crashes about half the time now.  I'll see if I 
can figure out what's going wrong.  My guess would be that rather than an rgl 
bug this is an Xquartz bug, but maybe I can find a way to prevent it.

Duncan Murdoch

On 03/08/2020 12:54 p.m., Duncan Murdoch wrote:
With great trepidation, I installed Catalina.  I saw the same crash as
reported.  Then I reinstalled Xquartz, shut down the Xquartz that was
still running (should have done that in the other order!), and tried
again:  no crash.  Hope it stays fixed!
Duncan Murdoch
On 03/08/2020 9:25 a.m., Duncan Murdoch wrote:
Thanks.  Looks like I should update.  I'm looking forward to the crashes...

Duncan Murdoch

On 03/08/2020 9:21 a.m., Marc Schwartz wrote:
Hi,

Just installed rgl and I get the same crash and error message from the original 
post below, running R from the CLI.

If I run R from within ESS (what I normally use), I get:

     Process R abort trap: 6 at Mon Aug  3 09:15:32 2020

If I run R from R.app (the default macOS GUI), the command runs fine and I get 
the graphic.

I am running R 4.0.2 (2020-06-22) on macOS 10.15.6.

R was cleanly installed, and XQuartz (2.7.11) was updated afterwards.

Regards,

Marc Schwartz


On Aug 3, 2020, at 9:05 AM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote:

I just got a message from someone else using Catalina 10.15.5 who still gets a 
crash from

library(rgl)
plot(1:10)

I don't have Catalina, and haven't seen it.  Has anyone else?

Duncan Murdoch

On 31/05/2020 4:44 p.m., Richard M. Heiberger wrote:
I upgraded last night to Catalina 10.15.5 (19F96).
The crash has gone away and that example now works normally.
On Fri, May 29, 2020 at 3:25 PM Richard M. Heiberger <r...@temple.edu> wrote:

my 12:35 email and the attached tmp.txt are from the Terminal.app,
No emacs/ESS involved.

On Fri, May 29, 2020 at 3:13 PM Duncan Murdoch <murdoch.dun...@gmail.com> wrote:

On 29/05/2020 2:21 p.m., Richard M. Heiberger wrote:
I attempted to update xquartz when I updated to Catalina, and the same
number is still the current version number.

Here is a related issue, attached tmp2.txt is the R transcript.
The interesting thing here is that rgl.quit() prevents rgl from being
reattached.

Generally speaking rgl doesn't want to be reloaded in the same R
session:  detaching it doesn't clean up everything.  That's not
something that I'd put any priority on fixing, whereas I would look at
the problems you're having on startup if I could reproduce them.

I wonder if ESS is involved somehow:  your sessionInfo listed ESSR on
the search list.  Do you have the same issues with plain R from the
console, or R.app?

Is there an rgl equivalent for dev.cur()?

There's rgl.cur().  rgl only supports two kinds of devices:  on a Mac or
Linux they'd be displayed as glX or null.  Windows also supports the
null device (which doesn't display anything), and a different one to
display within R:  I forget how the name is displayed.

It might be that you'll need to set options(rgl.useNULL) before starting
rgl, and only use the null device.  It won't display anything in R, but
allows you to call rglwidget() for a display in a browser.

Duncan Murdoch

On Fri, May 29, 2020 at 1:51 PM Duncan Murdoch <murdoch.dun...@gmail.com> wrote:

On 29/05/2020 12:35 p.m., Richard M. Heiberger wrote:
I have the same Xquartz as you.

I'd guess it should be updated.  Generally XQuartz needs updates with
every MacOS release, and your 10.15.4 is two releases further along than
my 10.13.6.

I have rgl-0.100.50 from CRAN

You could update that, but I doubt if it would make any difference.

Apple is macOS Catalina, Version 10.15.4
Do you need hardware information?
MacBpok Air (13 -inch, Mid 2012)
Processor 2GHz Dual-Core Intel Core i7
Memory 8 GB 1600 MHz DDR3
Graphics Intel HD Graphics 4000 1536 MB

I think the XQuartz issue is most likely to help, but if it doesn't, I'm
not sure what I could suggest:  I don't have Catalina.

Duncan Murdoch


from the Terminal App:
The Apple Crash Report is in the attached tmp.txt
I didn't send it to Apple.

R version 4.0.0 (2020-04-24) -- "Arbor Day"

Copyright (C) 2020 The R Foundation for Statistical Computing

Platform: x86_64-apple-darwin17.0 (64-bit)


R is free software and comes with ABSOLUTELY NO WARRANTY.

You are welcome to redistribute it under certain conditions.

Type 'license()' or 'licence()' for distribution details.


       Natural language support but running in an English locale


R is a collaborative project with many contributors.

Type 'contributors()' for more information and

'citation()' on how to cite R or R packages in publications.


Type 'demo()' for some demos, 'help()' for on-line help, or

'help.start()' for an HTML browser interface to help.

Type 'q()' to quit R.


library(rgl)

plot(1:10)

2020-05-29 12:30:00.536 R[24961:3275889] *** Assertion failure in BOOL 
NSScreenConfigurationInvalidateIfNeededForReason(_NSScreenConfigurationUpdateReason)(),
 
/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1894.40.150/AppKit.subproj/NSScreenConfiguration.m:473

2020-05-29 12:30:00.543 R[24961:3275889] *** Terminating app due to
uncaught exception 'NSInternalInconsistencyException', reason:
'NSScreen reconfig must only happen on the main thread.'

*** First throw call stack:

(

0   CoreFoundation                      0x00007fff371698d7
__exceptionPreprocess + 250

1   libobjc.A.dylib                     0x00007fff6ff47a9e
objc_exception_throw + 48

2   CoreFoundation                      0x00007fff37192bb0
+[NSException raise:format:arguments:] + 88

3   Foundation                          0x00007fff398de456
-[NSAssertionHandler
handleFailureInFunction:file:lineNumber:description:] + 166

4   AppKit                              0x00007fff34503083
+[_NSScreenConfiguration invalidateConfigurationIfNeededForReason:] +
361

5   AppKit                              0x00007fff34e4bda8
_NSApplicationInvalidateScreenConfigurationMaybeIfNeeded + 243

6   AppKit                              0x00007fff34502c85
-[NSApplication(ScreenHandling) _reactToDockChanged] + 144

7   AppKit                              0x00007fff345024dc
_NSCGSDockMessageReceive + 268

8   HIToolbox                           0x00007fff35d34a3c
_ZL12DockCallbackjjPvS_ + 1987

9   HIServices                          0x00007fff3539c8ec
dockClientNotificationProc + 217

10  SkyLight                            0x00007fff6626f174
_ZN12_GLOBAL__N_123notify_datagram_handlerEj15CGSDatagramTypePvmS1_ +
1002

11  SkyLight                            0x00007fff6626de71
CGSSnarfAndDispatchDatagrams + 1671

12  SkyLight                            0x00007fff6649d5a5
SLSGetNextEventRecordInternal + 83

13  SkyLight                            0x00007fff6633bfbe
SLEventCreateNextEvent + 136

14  libXplugin.1.dylib                  0x000000010686df0c
___xp_init_service_cg_event_port_block_invoke + 104

15  libdispatch.dylib                   0x00007fff7108d658
_dispatch_client_callout + 8

16  libdispatch.dylib                   0x00007fff7108f818
_dispatch_continuation_pop + 414

17  libdispatch.dylib                   0x00007fff7109f4be
_dispatch_source_invoke + 2084

18  libdispatch.dylib                   0x00007fff71092af6
_dispatch_lane_serial_drain + 263

19  libdispatch.dylib                   0x00007fff710935d6
_dispatch_lane_invoke + 363

20  libdispatch.dylib                   0x00007fff7109cc09
_dispatch_workloop_worker_thread + 596

21  libsystem_pthread.dylib             0x00007fff712eba3d
_pthread_wqthread + 290

22  libsystem_pthread.dylib             0x00007fff712eab77 start_wqthread + 15

)

libc++abi.dylib: terminating with uncaught exception of type NSException

zsh: abort      R

rmh@rmhs-Air ~ %


On Fri, May 29, 2020 at 12:16 PM Duncan Murdoch
<murdoch.dun...@gmail.com> wrote:

I'm not seeing that with R-patched r78557, run from the console.  I'm
not sure I have the same MacOS version as you (R prints the same thing,
Apple says High Sierra 10.13.6).  I tried with the CRAN binary of rgl
0.100.54.  I'd guess the version of XQuartz may be important:  I'm not
seeing rgl in the call stack, but libXplugin is there.  Mine is "XQuartz
2.7.11 (xorg-server 1.18.4)".

Duncan Murdoch



On 29/05/2020 11:44 a.m., Richard M. Heiberger wrote:
R version 4.0.0 (2020-04-24) -- "Arbor Day"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

        Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))) 
options(pager='cat') # rather take the ESS one
options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', 
show.error.locations=TRUE)
version
                     _
platform       x86_64-apple-darwin17.0
arch           x86_64
os             darwin17.0
system         x86_64, darwin17.0
status
major          4
minor          0.0
year           2020
month          04
day            24
svn rev        78286
language       R
version.string R version 4.0.0 (2020-04-24)
nickname       Arbor Day

library(rgl)
plot(1:10)


Process R abort trap: 6 at Fri May 29 11:32:59 2020
2020-05-29 11:32:59.542 R[24448:3255600] *** Assertion failure in BOOL
NSScreenConfigurationInvalidateIfNeededForReason(_NSScreenConfigurationUpdateReason)(),
/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1894.40.150/AppKit.subproj/NSScreenConfiguration.m:473
2020-05-29 11:32:59.560 R[24448:3255600] *** Terminating app due to
uncaught exception 'NSInternalInconsistencyException', reason:
'NSScreen reconfig must only happen on the main thread.'
*** First throw call stack:
(
0   CoreFoundation                      0x00007fff371698d7
__exceptionPreprocess + 250
1   libobjc.A.dylib                     0x00007fff6ff47a9e
objc_exception_throw + 48
2   CoreFoundation                      0x00007fff37192bb0
+[NSException raise:format:arguments:] + 88
3   Foundation                          0x00007fff398de456
-[NSAssertionHandler
handleFailureInFunction:file:lineNumber:description:] + 166
4   AppKit                              0x00007fff34503083
+[_NSScreenConfiguration invalidateConfigurationIfNeededForReason:] +
361
5   AppKit                              0x00007fff34e4bda8
_NSApplicationInvalidateScreenConfigurationMaybeIfNeeded + 243
6   AppKit                              0x00007fff34502c85
-[NSApplication(ScreenHandling) _reactToDockChanged] + 144
7   AppKit                              0x00007fff345024dc
_NSCGSDockMessageReceive + 268
8   HIToolbox                           0x00007fff35d34a3c
_ZL12DockCallbackjjPvS_ + 1987
9   HIServices                          0x00007fff3539c8ec
dockClientNotificationProc + 217
10  SkyLight                            0x00007fff6626f174
_ZN12_GLOBAL__N_123notify_datagram_handlerEj15CGSDatagramTypePvmS1_ +
1002
11  SkyLight                            0x00007fff6626de71
CGSSnarfAndDispatchDatagrams + 1671
12  SkyLight                            0x00007fff6649d5a5
SLSGetNextEventRecordInternal + 83
13  SkyLight                            0x00007fff6633bfbe
SLEventCreateNextEvent + 136
14  libXplugin.1.dylib                  0x000000010ffa5f0c
___xp_init_service_cg_event_port_block_invoke + 104
15  libdispatch.dylib                   0x00007fff7108d658
_dispatch_client_callout + 8
16  libdispatch.dylib                   0x00007fff7108f818
_dispatch_continuation_pop + 414
17  libdispatch.dylib                   0x00007fff7109f4be
_dispatch_source_invoke + 2084
18  libdispatch.dylib                   0x00007fff71092af6
_dispatch_lane_serial_drain + 263
19  libdispatch.dylib                   0x00007fff710935d6
_dispatch_lane_invoke + 363
20  libdispatch.dylib                   0x00007fff7109cc09
_dispatch_workloop_worker_thread + 596
21  libsystem_pthread.dylib             0x00007fff712eba3d
_pthread_wqthread + 290
22  libsystem_pthread.dylib             0x00007fff712eab77 start_wqthread + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException

_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac





_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac




_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to