[R] RGL on Mac OS X

Matthew Cohen owl_of_minerva at hotmail.com
Thu Jul 1 18:40:59 CEST 2004



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




More information about the R-help mailing list