[R] cairo_pdf crashing R on Windows

Duncan Murdoch murdoch.duncan at gmail.com
Fri Sep 12 20:43:52 CEST 2014

On 12/09/2014 2:12 PM, Kevin Wright wrote:
> I'm having trouble with cairo_pdf crashing R on Windows.
> How can I debug this?  This is a "exited abnormally" type crash, so I can't
> drop into the browser and look at the call stack.

This is getting into R-devel territory, but if Henrik's suggestions 
aren't enough, here are some more:

1.  Make the crash reproducible, and the trigger code as simple as 
possible.  If you can succeed in this and submit a bug report on 
bugs.r-project.org and someone in R Core can use your code to trigger a 
crash, that alone will be very helpful.

2.  Run under a debugger.  gdb is available for Windows, although it's 
not the easiest debugger in the world to use.  It's a lot easier if you 
can do a build of R with debugging information (not the default in 
Windows).  You do this by setting the environment variable DEBUG to T, 
and rebuilding R.  If you're lucky, gdb will identify which source line 
triggered the crash, and that might be enough (if you examine the source 
code carefully) to find the cause.

You might want to trigger the bug on a different platform; generally the 
debugging tools that work with R work better on Unix-alikes than on Windows.

3.  At this point you're rebuilding R, so if gdb wasn't enough to tell 
you what's going on, start sticking Rprintf() calls into the R source to 
see if you can find where things start to go wrong.  It's slow work, 
because you'll do a lot of rebuilds until you track down the bug.

I hope that helps.  Remember, even completing step 1 will be very 
helpful for others.  Actually tracking down and fixing the bug would be 

Duncan Murdoch

More information about the R-help mailing list