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

Kurt Hornik hornik at ci.tuwien.ac.at
Wed May 28 12:18:12 MEST 2003

>>>>> Simon Urbanek writes:

> On Monday, May 26, 2003, at 04:41  PM, Jan de Leeuw wrote:
>> I don't think  there is a reason to set  DYLD_LIBRARY_PATH in bin/R. 
>> Not even fink sets this variable.
> Well, that's what I think as well .. so my question is, why is it there 
> then?

> My guess is that it's due to the fact that the script was written for 
> all unix platforms, therefore it explicitly sets it since some unixes 
> need it. It is in src/scripts/R.sh.in (this one is from today's 
> R-devel):
> ## NOTE:
> ## We must set this here rather than in the main binary.
> if test -z "${@shlibpath_var@}"; then
>    @shlibpath_var@="${R_LD_LIBRARY_PATH}"
> else
>    @shlibpath_var@="${R_LD_LIBRARY_PATH}:${@shlibpath_var@}"
> fi
> export @shlibpath_var@

> ... and in turn autoconf generates:
> darwin* | rhapsody*)
> [...]
> shlibpath_var=DYLD_LIBRARY_PATH

> So what's the most clean way to fix that? One more "if" or for Darwin 
> in R.sh.in? Remove X11 from R_LD_LIBRARY_PATH for Darwin?

The configure code currently has

for arg in ${LDFLAGS} ${FLIBS} ${BLAS_LIBS} ${LAPACK_LIBS} ${X_LIBS} \
           ${TCLTK_LIBS} ${GNOME_LIBS}; do
  case "${arg}" in
      lib=`echo ${arg} | sed "s/^-L//"`

which follows that the idea that any -L flag in the above that was
either given explicitly or determined by configure should be added to
the run time path.  It is one of the autoconf macros which knows about
typical locations of X11 and adds the -L X11 stuff by default.

My preference would be to leave this mechanism untouched but maybe add
to LDFLAGS on platforms where this is necessary.  We already have

if test -f "/sw/etc/fink.conf"; then
  : ${CPPFLAGS="-I/sw/include -I/usr/local/include"}
  : ${LDFLAGS="-L/sw/lib -L/usr/local/lib"}
  : ${CPPFLAGS="-I/usr/local/include"}
  : ${LDFLAGS="-L/usr/local/lib"}

and could add something which adds the frameworks that should come first
in the run time path.


More information about the R-devel mailing list