On Feb 3, 2015, at 9:42 AM, Duncan Murdoch wrote:

> On 03/02/2015 12:18 PM, David Winsemius wrote:
>> On Feb 3, 2015, at 7:14 AM, Duncan Murdoch wrote:
>> 
>> > On 03/02/2015 9:43 AM, [email protected] wrote:
>> >> Dear all,
>> >>
>> >> I am using writeWebGL to create an HTML page containing an interactive 3D 
>> >> plot. It works fine with the default prefix="" but fails when I specify a 
>> >> prefix "for different scenes displayed on the same web page" (quoting 
>> >> ?writeWebGL).  I'm sure I'm misreading the help, and would appreciate 
>> >> guidance.
>> >>
>> >> Briefly, it works fine with the default writeWebGL( ,prefix="", ) and the 
>> >> template containing %WebGL%
>> >> I have not been able to make it work with any other value of prefix; e.g. 
>> >> writeWebGL( ,prefix="A",) and the template containing %AWebGL%
>> >>
>> >> Here is code illustrating the problem.
>> >>
>> >> First create three templates:
>> >> a) Vanilla: copied system.file(file.path("WebGL", "template.html"), 
>> >> package="rgl") to file.path(getwd(), "template.html")
>> >>
>> >> b) First attempt: ?writeWebGL says # "[the template] should contain a 
>> >> single line containing paste("%", prefix, "WebGL%"), e.g. %WebGL% with 
>> >> the default empty prefix"
>> >> paste("%", "A", "WebGL%")
>> >> # [1] "% A WebGL%"
>> >> so file.path(getwd(), "templateA.html") is a copy of (a) replacing 
>> >> %WebGL% with % A WebGL%
>> >>
>> >> c) Second attempt: file.path(getwd(), "templateB.html") is  a copy of (a) 
>> >> replacing %WebGL% with %AWebGL%
>> >>
>> >> then, in R
>> >> #-----------
>> >> library(rgl)
>> >> plot3d(1:5, 1:5, 1:5) # generate rgl scene
>> >> #-----------
>> >> # a) vanilla
>> >> writeWebGL(dir=getwd(), template = file.path(getwd(), "template.html"), 
>> >> prefix="")
>> >> # works OK; result opens and works in IE
>> >> #----------------
>> >> # b) First attempt, my reading of ?writeWebGL
>> >> writeWebGL(dir=getwd(), template = file.path(getwd(), "templateA.html"), 
>> >> prefix="A")
>> >> # Error in writeWebGL(dir = getwd(), template = file.path(getwd(), 
>> >> "templateA.html"),  :
>> >> #                       template ‘m://templateA.html’ does not contain 
>> >> %AWebGL%
>> >> # so it looks as if the help is trivially wrong, it should be paste0
>> >> paste0("%", "A", "WebGL%")
>> >
>> > Yes, that's right.  I'll fix it.
>> >
>> >> # [1] "%AWebGL%"
>> >> #----------------
>> >> # c) second attempt using %AWebGL%
>> >> writeWebGL(dir=getwd(), template = file.path(getwd(), "templateB.html"), 
>> >> prefix="A")
>> >> # runs without error in R but IE displays "You must enable Javascript to 
>> >> view this page properly."
>> >> #--------------
>> >>
>> >> I don't understand why (c) is different from (a).
>> >
>> > There may be an error in the generated Javascript.  In Firefox, you could 
>> > ask to see the browser console log, and it would report if there was an 
>> > error on the page; sometimes those make the Javascript fail, and it falls 
>> > back to the error message you saw.  I don't know how/if you can do that in 
>> > IE.
>> >
>> >
>> >>
>> >> Here are the system details:
>> >>
>> >> R version 3.1.0 (2014-04-10)
>> >> Platform: i386-w64-mingw32/i386 (32-bit)
>> >>
>> >> locale:
>> >> [1] LC_COLLATE=English_United Kingdom.1252
>> >> [2] LC_CTYPE=English_United Kingdom.1252
>> >> [3] LC_MONETARY=English_United Kingdom.1252
>> >> [4] LC_NUMERIC=C
>> >> [5] LC_TIME=English_United Kingdom.1252
>> >>
>> >> attached base packages:
>> >> [1] grDevices datasets  splines   graphics  stats     tcltk     utils
>> >>  [8] tools     methods   base
>> >>
>> >> other attached packages:
>> >> [1] knitr_1.8       animation_2.3   rgl_0.95.1158   CBRIutils_1.0
>> >
>> > That's an old version of rgl; current on CRAN is 0.95.1201. 
>> > <http://cran.r-project.org/src/contrib/rgl_0.95.1201.tar.gz> (CRAN OSX 
>> > currently has an old binary; I don't recommend that you use it.  I don't 
>> > know why they haven't updated to the current one.)
>> 
>> I'm not sure why either, but that newer package does fail compilation on 
>> both trunks of the Mac platform. I have version 1098 on my OSX 10.7.5 box 
>> (and I'm pretty sure that's the one on my Yosemite-equiped laptop. I just 
>> tried compiling from source on the Lion platform with the source at CRAN and 
>> it fails there, too. (Sometimes I am able to get packages to compile that 
>> report errors on CRAN.)
>> 
>> The first error reported from efforts at installing both 1201 and 1208 
>> versions is:
>> 
>> checking for X... libraries , headers
>> checking for glEnd in -lGL... no
>> configure: error: missing required library GL
>> 
> That looks as though it's not finding the OpenGL libraries.  I think the 
> usual way to get them on a Mac is to install XQuartz.  rgl doesn't have to 
> use X11, but it will (e.g. if you run it from RStudio), and it requires the 
> X11 files for compiling.  I haven't experimented a lot with systems that 
> don't have XQuartz installed, but I just saw one yesterday where even the 
> native OpenGL code (what you get when you run rgl within R.app) wouldn't 
> start; after installing XQuartz, it was fixed.

It's probably more appropriate that this go to the R-sig-Ma mailing list. I 
have had XQuartz installed for several years and iterations of R and I just 
re-installed version 2.7.7 from http://xquartz.macosforge.org/trac/wiki/X112.7.7

As far as I can tell from the xquartz plist, it is in the right place and would 
be called if X11 were desired. I do still see an X11.app entry in my 
applications/Utilities directory from a couple of years ago, though.

Compiling from source with:

R CMD INSTALL /Users/davidwinsemius/Downloads/rgl_0.95.1201.tar.gz 

... fails with the same error message

I think the Mac builders may have a better understanding why the CRAN package 
checks are failing than I do.

Copying first the Terminal session output and then my sessionInfo() after 
opening R:

Loading required package: lattice
Loading required package: sos
Loading required package: brew
Loading required package: rms
Loading required package: Hmisc
Loading required package: grid
Loading required package: survival
Loading required package: stats
Loading required package: utils

Attaching package: ‘utils’

The following object is masked from ‘package:sos’:

    ?

Loading required package: graphics
Loading required package: splines
Loading required package: Formula

Attaching package: ‘Hmisc’

The following objects are masked from ‘package:base’:

    format.pval, round.POSIXt, trunc.POSIXt, units

Loading required package: SparseM

Attaching package: ‘SparseM’

The following object is masked from ‘package:base’:

    backsolve

##------ 2015-02-03 ------##
* installing to library 
‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library’
* installing *source* package ‘rgl’ ...
** package ‘rgl’ successfully unpacked and MD5 sums checked
checking for gcc... llvm-gcc-4.2 -arch x86_64 -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether llvm-gcc-4.2 -arch x86_64 -std=gnu99 accepts -g... yes
checking for llvm-gcc-4.2 -arch x86_64 -std=gnu99 option to accept ISO C89... 
none needed
checking how to run the C preprocessor... llvm-gcc-4.2 -arch x86_64 -std=gnu99 
-E
checking for gcc... (cached) llvm-gcc-4.2 -arch x86_64 -std=gnu99
checking whether we are using the GNU C compiler... (cached) yes
checking whether llvm-gcc-4.2 -arch x86_64 -std=gnu99 accepts -g... (cached) yes
checking for llvm-gcc-4.2 -arch x86_64 -std=gnu99 option to accept ISO C89... 
(cached) none needed
checking whether __attribute__((visibility())) is supported... no
checking whether llvm-gcc-4.2 -arch x86_64 -std=gnu99 accepts -fvisibility... 
yes
checking whether  accepts -fvisibility... no
checking for libpng-config... yes
configure: using libpng-config
configure: using libpng dynamic linkage
checking for X... libraries , headers 
checking for glEnd in -lGL... no
configure: error: missing required library GL
ERROR: configuration failed for package ‘rgl’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rgl’
* restoring previous 
‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rgl’

==============================================

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_US.utf-8/en_US.utf-8/en_US.utf-8/C/en_US.utf-8/en_US.utf-8

attached base packages:
[1] grDevices datasets  splines   graphics  utils     stats     grid     
[8] methods   base     

other attached packages:
[1] rms_4.2-1       SparseM_1.6     Hmisc_3.14-6    Formula_1.2-0  
[5] survival_2.37-7 sos_1.3-8       brew_1.0-6      lattice_0.20-29

loaded via a namespace (and not attached):
 [1] acepack_1.3-3.3     cluster_1.15.3      foreign_0.8-62     
 [4] latticeExtra_0.6-26 multcomp_1.3-8      mvtnorm_1.0-2      
 [7] nlme_3.1-119        nnet_7.3-8          polspline_1.1.9    
[10] quantreg_5.11       RColorBrewer_1.1-2  rpart_4.1-8        
[13] sandwich_2.3-2      TH.data_1.0-6       zoo_1.7-11         

-- 
> 
> Duncan Murdoch

David Winsemius
Alameda, CA, USA

_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to