[R-SIG-Mac] some suggestions for building R on leopard

Daniel Merl dan at stat.duke.edu
Wed Oct 31 04:17:17 CET 2007


upgrading to leopard seems to cause a couple of problems for R, and
while I'm sure the R for OS X developers will come up with better
solutions soon, in the meantime I thought I'd post my current
work-around, hopefully someone out there might find it useful, and/or
be able to fill in a couple gaps.

1) The latest patched framework build and GUI from
http://r.research.att.com/ seem to work ok in leopard.  One comment on
this:  apple's made some major changes to the X11 server in leopard.
a lot of people are saying the new x11 is "broken", but I've also read
that the new x11 is based on a more modern codebase.  so maybe it's
not worth deleting.  anyway, one major difference is that you no
longer need to open X11.app manually prior to opening a plotting
window if you are running R from the command line.  Also, it is no
longer necessary to manually set the environment variable DISPLAY=:0.0
in a .bashrc for example.  After removing this line from my .bashrc
(and reopening terminal),   the X11 plotting from the command line
worked.

2) Building shared objects using R CMD SHLIB doesn't work using the
pre-compiled builds mentioned above (maybe this is too technical for
this list, but it's relevant for mac users I think).  This often
happens when apple releases a new OS, due to the new operating system
moving around and renaming dynamic libraries.   However, due to the
changes to X11, compiling R from source in leopard doesn't seem to get
past the configure script unless you set with-x=no.  I haven't been
able to figure out any combination of arguments to configure that
doesn't result in:

configure: error: --with-x=yes (default) and X11 headers/libs are not available

But if you call configure as "configure --with-x=no", the makefiles
get properly generated, and I'm able to build a version of R that is
able to successfully compile shared objects.  Command line R isn't
able to open X11 plotting windows, however gui R is still able to open
aqua plotting windows, so the build is pretty functional I think.

If anybody knows how to call configure to avoid this error, I'm all
ears.  I'm pretty sure the X11 headers are now in
/usr/X11/include/X11/ and the libraries are still in /usr/X11/lib/.
Specifically, calling configure as:

configure --with-blas='-framework vecLib'
--x-libraries='-L/usr/X11/lib' --x-includes='-I/usr/X11/include/X11'

seems to get further than anything else I've tried, but once it gets
to the X11 checks it dies with:

checking for X... libraries -L/usr/X11/lib, headers -I/usr/X11/include/X11
checking for dnet_ntoa in -ldnet... no
checking for dnet_ntoa in -ldnet_stub... no
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... no
checking X11/Intrinsic.h usability... yes
checking X11/Intrinsic.h presence... yes
checking for X11/Intrinsic.h... yes
checking for XtToolkitInitialize in -lXt... no
configure: error: --with-x=yes (default) and X11 headers/libs are not available


Any suggestions would be great.  My main point is that you can compile
R in leopard without X support, and get something that seems fully
functional through the GUI and is capable of building packages again.



-- 
Dan Merl
Research Associate
Dept Statistical Science
Duke U, Box 90251
Durham NC 27708-0251



More information about the R-SIG-Mac mailing list