Re: [R-pkg-devel] Catching console messages from libGL
On 17/02/2020 4:10 p.m., Ivan Krylov wrote: On Mon, 17 Feb 2020 14:56:31 -0500 Duncan Murdoch wrote: So how do I capture stderr (or, off topic here, how do I get libGL to be quiet)? libGL seems to only offer bad news in this regard: it writes directly to stderr [1] and does not seem to offer a way to silence the _LOADER_FATAL messages [2], which "failed to load driver: %s" are. (You have found that out while I was preparing the message.) As far as I understand do_sink(), it does not touch the actual stdout or stderr, only R's wrappers of them. You probably know better than me how portable would it be to try to reassign stderr (which the standard says is a macro) to open_memstream() (which is POSIX.1-2008 only). Thanks for that last paragraph. I've decided to temporarily redirect stderr to /dev/null (or nul on Windows) using dup() and dup2() in the C++ code. I'll make this optional; if people want to see those messages, there'll be a way to enable them again. My tests show that this does silence libGL. Duncan Murdoch __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Catching console messages from libGL
On Mon, 17 Feb 2020 14:56:31 -0500 Duncan Murdoch wrote: > So how do I capture stderr (or, off topic here, how do I get libGL to > be quiet)? libGL seems to only offer bad news in this regard: it writes directly to stderr [1] and does not seem to offer a way to silence the _LOADER_FATAL messages [2], which "failed to load driver: %s" are. (You have found that out while I was preparing the message.) As far as I understand do_sink(), it does not touch the actual stdout or stderr, only R's wrappers of them. You probably know better than me how portable would it be to try to reassign stderr (which the standard says is a macro) to open_memstream() (which is POSIX.1-2008 only). -- Best regards, Ivan [1] https://sources.debian.org/src/mesa/19.3.3-1/src/glx/dri_common.c/#L52 [2] https://sources.debian.org/src/mesa/19.3.3-1/src/glx/dri_common.h/#L70 __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Catching console messages from libGL
On 17/02/2020 2:56 p.m., Duncan Murdoch wrote: I'm working on the initialization code for rgl, especially for the case when it is running remotely and the user is connecting using X11. On some machines, this fails: I now understand that's because the local machine needs to enable "indirect GLX" (IGLX) for it to succeed, and by default most current machines have IGLX disabled. (It can be a security risk to enable it.) Failure looks like this (with the current CRAN version of rgl 0.100.47, and the remote system running Ubuntu, my local system running MacOS): > library(rgl) > open3d() libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast X Error of failed request: GLXBadContext Major opcode of failed request: 149 (GLX) Minor opcode of failed request: 6 (X_GLXIsDirect) Serial number of failed request: 42 Current serial number in output stream: 41 I end up booted right out of R. I now know how to fix that, and will upload an update to CRAN in due course. On MacOS I can enable IGLX by running defaults write org.macosforge.xquartz.X11 enable_iglx -bool true and restarting XQuartz. When I do that, I see this (same setup as before): > library(rgl) > open3d() libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast glX 1 Now I want to suppress those two libGL messages, and I'm having trouble figuring out how to do it. If I redirect stderr when I start R, they are redirected: but if I do it after starting R, they aren't: > library(rgl) > capture.output(open3d(), type = "message") libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast glX 1 character(0) (capture.output with type = "output" gets c("glX", "1"), but leaves the libGL messages printing to the console. sink() behaves similarly.) So how do I capture stderr (or, off topic here, how do I get libGL to be quiet)? A little bit of progress. After reading the Mesa 3d source, I can see that setting environment variable LIBGL_DEBUG=quiet will suppress the first message. Unfortunately, the second message is seen as "critical", and it can't be suppressed. Duncan Murdoch __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
[R-pkg-devel] Catching console messages from libGL
I'm working on the initialization code for rgl, especially for the case when it is running remotely and the user is connecting using X11. On some machines, this fails: I now understand that's because the local machine needs to enable "indirect GLX" (IGLX) for it to succeed, and by default most current machines have IGLX disabled. (It can be a security risk to enable it.) Failure looks like this (with the current CRAN version of rgl 0.100.47, and the remote system running Ubuntu, my local system running MacOS): > library(rgl) > open3d() libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast X Error of failed request: GLXBadContext Major opcode of failed request: 149 (GLX) Minor opcode of failed request: 6 (X_GLXIsDirect) Serial number of failed request: 42 Current serial number in output stream: 41 I end up booted right out of R. I now know how to fix that, and will upload an update to CRAN in due course. On MacOS I can enable IGLX by running defaults write org.macosforge.xquartz.X11 enable_iglx -bool true and restarting XQuartz. When I do that, I see this (same setup as before): > library(rgl) > open3d() libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast glX 1 Now I want to suppress those two libGL messages, and I'm having trouble figuring out how to do it. If I redirect stderr when I start R, they are redirected: but if I do it after starting R, they aren't: > library(rgl) > capture.output(open3d(), type = "message") libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast glX 1 character(0) (capture.output with type = "output" gets c("glX", "1"), but leaves the libGL messages printing to the console. sink() behaves similarly.) So how do I capture stderr (or, off topic here, how do I get libGL to be quiet)? Duncan Murdoch __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel