[R] RGL on Mac OS X

Ulises Mora Alvarez umalvarez at fata.unam.mx
Thu Jul 1 19:45:06 CEST 2004


Hi!

I can't tell you much about the problem that you are describing below. 
However, I can tell you the following:

- I downloaded the R sources for 1.9.1

- I compiled R following the instructions of the RMacOS-FAQ

- Then, after launching R from a terminal with 'sudo R', I downloaded and 
install a bunch of libraries (rgl, among them) using 
'install.packages(c("library1","library2",etc))'. Everything went OK.

-Now, I usually launch my Xserver (from Apple) and then Emacs. Then, using 
ESS 5.2.0, I launch R from within Emacs. If I type on the R console 
'library(rgl); demo(rgl)', the demo runs smoothly. On the other hand, if I 
launch the carbon GUI of R (from the /Applications folder) the result is 
the same, everything is OK. 

I'm using Mac OS 10.3.4, with the Developer tools and Xserver installed, 
and fink 0.7.0.cvs on an iBook G3.


Good look.



PS. I should tell you that I can't tell the same of the rgl library on a 
PC running Fedora 2. Maybe one of this days I'll make rgl run.



On Thu, 1 Jul 2004, Matthew Cohen wrote:

> 
> 
> I should have included in my last message a reference to the discussion of 
> this issue on the R developers' list:
> 
> http://maths.newcastle.edu.au/~rking/R/devel/03a/0982.html
> 
> Here, Simon Urbanek says:
> 
> >In Mac OS X native version: The R shell wrapper (bin/R) overrides default 
> >library search path with DYLD_LIBRARY_PATH and adds (among others) 
> >/usr/X11R6/lib. This causes problems when modules need (directly or 
> >indirectly) libraries from Apple's frameworks which are masked by X11. 
> >Examples for such packages are SJava and RGL. SJava needs JavaVM which in 
> >turn loads OpenGL framework. RGL needs the OpenGL framework directly. The 
> >problem is that specifying /usr/X11R6/lib in DYLD_LIBRARY_PATH forces the 
> >libGL to be loaded from the X11 directory instead of the OpenGL framework 
> >library. This crashes R due to missing symbols, since the modules must link 
> >to the OpenGL framework. In fact the OpenGL framework libraries load the 
> >X11 libraries internally (but not vice versa) - that's why the default load 
> >path is frameworks first then X11.
> 
> He suggests a temporary workaround:
> 
> >Currently a workaround is to remove /usr/X11R6/lib in R from the 
> >environment variable prior to loading those packages, but more general 
> >solution would be better imho. Is the /usr/X11R6/lib really necessary in 
> >the DYLD_LIBRARY_PATH for some older OS X versions? At least for OS X 10.2 
> >with Apple's X11 it is not necessary since X11 is already in the default 
> >load path.
> 
> Clearly the "more general solution" was never arrived at, given that the 
> problem still exists.  So how, exactly, do I go about implementing this 
> workaround?  In other words, where is the "usr/X11R6/lib" path included in 
> R, and how do I remove it?  (and, if necessary, how do I put it back 
> afterwards?)
> 
> Also, in case it is needed, here is what typing "library(rgl)" returns in R:
> 
> >Error in dyn.load(x, as.logical(local), as.logical(now)) :
> >         unable to load shared library  
> >"/usr/local/lib/R/library/rgl/libs/rgl.so":
> >   dlcompat: dyld: /usr/local/lib/R/bin/R.bin Undefined symbols:
> >_glArrayElement
> >_glBegin
> >_glBindTexture
> >_glBitmap
> >_glBlendFunc
> >_glCallList
> >_glCallLists
> >_glClear
> >_glClearColor
> >_glClearDepth
> >_glColor3f
> >_glColor4fv
> >_glColor4ubv
> >_glColorMaterial
> >_glColorPointe
> >Error in library(rgl) : .First.lib failed
> 
> Any help would be very much appreciated.  Also, apologies for sending out 
> two messages asking the same question in such a short span of time, but I 
> realized after sending that I did not include all of the relevant 
> information in the first.
> 
> Matt
> 
> 
> Guide! http://dollar.msn.com
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
Ulises M. Alvarez
LAB. DE ONDAS DE CHOQUE
FISICA APLICADA Y TECNOLOGIA AVANZADA
UNAM
umalvarez at fata.unam.mx




More information about the R-help mailing list