[Rd] png cairo device problems on Mac 10.6.8

Steven McKinney smckinney at bccrc.ca
Thu Jan 19 00:33:50 CET 2012



> -----Original Message-----
> From: Simon Urbanek [mailto:simon.urbanek at r-project.org]
> Sent: January-18-12 3:10 PM
> To: Steven McKinney
> Cc: R-devel at r-project.org
> Subject: Re: [Rd] png cairo device problems on Mac 10.6.8
> 
> 
> On Jan 18, 2012, at 5:22 PM, Steven McKinney wrote:
> 
> >
> > Hi all,
> >
> > I have been having problems generating png files on a Mac running OS X
> 10.6.8.
> >
> > Here's a simple example
> >
> >> png("foo.png", type = "cairo"); plot(1:10); dev.off();
> > null device
> >          1
> > libpng warning: Application built with libpng-1.2.26 but running with
> 1.5.2
> >
> > The resultant file is of size 0 Kb.
> >
> > Is this the proper place to report this issue?  Or should this
> > be reported to r-sig-mac?
> >
> 
> yes
> 
> 
> > If I run
> >
> >> png("foo.png"); plot(1:10); dev.off();
> > null device
> >          1
> >
> > I get a 16 Kb file with the appropriate plot.  (Odd, since the default
> type is "cairo".)
> >
> 
> No, the default is "quartz" unless you change it in your options.

D'oh!  I should have verified by reading the source.  Apologies for
the misinformation.  The fact that "cairo" appears first in the
type argument list does not make it the default.

> 
> On a similar note type="cairo-png" works as well.

Yes, type="cairo-png" yields a successful file.

The png() function shows a call of 

   invisible(.External(devCairo, filename, 2L, g$width, ...

for type="cairo" and a call of

   invisible(.External(devCairo, filename, 5L, g$width, ...

with type="cairo-png" so the third argument (2 or 5)
appears to be the only difference.  I have not dug into
the devCairo code to see how that arg is handled.


> 
> The problem seems to be with R's configuration - for some mysterious reason
> it picks libpng12 flags even though cairo clearly includes libpng15 (and so
> does pkg-config). I'll need to dig a bit into that.

Thank you very much.

Cheers

Steve 

> 
> Cheers,
> Simon
> 
> 
> > Whenever I see the libpng warning, I end up with a 0 Kb file.
> >
> > Details of R session below.
> >
> >
> > Regards
> >
> > Steve McKinney
> >
> >
> >
> > R version 2.14.1 Patched (2012-01-11 r58090)
> > Copyright (C) 2012 The R Foundation for Statistical Computing
> > ISBN 3-900051-07-0
> > Platform: x86_64-apple-darwin9.8.0/x86_64 (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.
> >
> > [R.app GUI 1.44 (5997) x86_64-apple-darwin9.8.0]
> >
> > [History restored from /Users/stevenmckinney/.Rhistory]
> >
> >> png("foo.png"); plot(1:10); dev.off();
> > null device
> >          1
> >> png("foo.png", type = "cairo"); plot(1:10); dev.off();
> > null device
> >          1
> > libpng warning: Application built with libpng-1.2.26 but running with
> 1.5.2
> >> ?png
> > starting httpd help server ... done
> >> capabilities()
> >    jpeg      png     tiff    tcltk      X11     aqua http/ftp  sockets
> libxml     fifo
> >    TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE
> TRUE     TRUE
> >  cledit    iconv      NLS  profmem    cairo
> >    TRUE     TRUE     TRUE     TRUE     TRUE
> >> png("foo.png"); plot(1:10); dev.off();
> > null device
> >          1
> >> sessionInfo()
> > R version 2.14.1 Patched (2012-01-11 r58090)
> > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
> >
> > locale:
> > [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
> >
> > attached base packages:
> > [1] stats     graphics  grDevices utils     datasets  methods   base
> >
> > loaded via a namespace (and not attached):
> > [1] tools_2.14.1
> >>
> >
> >
> > Steven McKinney, Ph.D.
> >
> > Statistician
> > Molecular Oncology and Breast Cancer Program
> > British Columbia Cancer Research Centre
> >
> > email: smckinney +at+ bccrc +dot+ ca
> >
> > tel: 604-675-8000 x7561
> >
> > BCCRC
> > Molecular Oncology
> > 675 West 10th Ave, Floor 4
> > Vancouver B.C.
> > V5Z 1L3
> > Canada
> >
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
> >



More information about the R-devel mailing list