From Simon.Urbanek at math.uni-augsburg.de  Mon May 26 14:25:13 2003
From: Simon.Urbanek at math.uni-augsburg.de (Simon Urbanek)
Date: Mon May 26 13:25:35 2003
Subject: [Rd] R's DYLD_LIBRARY_PATH override problems on Mac OS X
Message-ID: <B7DBEFC0-8F6C-11D7-88FC-000393CE9026@math.uni-augsburg.de>

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.

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.
Btw: the situation didn't crash R in OS X 10.1 (you could load libGL 
from X11 instead of the framework). To analyze the situation: by 
setting DYLD_PRINT_LIBRARIES=1 you can see exactly the sequence of 
loaded libraries and their locations.

  Cheers,
  Simon

	  _
  platform powerpc-apple-darwin6.6
  arch powerpc
  os darwin6.6
  system powerpc, darwin6.6
  status Patched
  major 1
  minor 7.0
  year 2003
  month 05
  day 15
  language R

---
Simon Urbanek
Department of computer oriented statistics and data analysis
University of Augsburg
Universit?tsstr. 14
86135 Augsburg
Germany

Tel: +49-821-598-2236
Fax: +49-821-598-2280

Simon.Urbanek@Math.Uni-Augsburg.de
http://simon.urbanek.info


[Rd] R's DYLD_LIBRARY_PATH override problems on Mac OS X
Simon Urbanek