If you are running Mac OS X 10.6 (Snow Leopard = SL henceforth) it is easy to compile R, but there are a few pitfalls especially for users that upgrade from Leopard.

(Side note: there is no need to compile your own R, all binaries including the 64-bit Leopard binaries from
http://r.research.att.com/
and corresponding binary packages from CRAN are compatible with Snow Leopard).


On a *clean* SL system (fresh install):

* install Xcode 3.2 (from SL DVD)

* install gfortran 4.2.3 from CRAN
  http://cran.r-project.org/bin/macosx/tools/gfortran-4.2.3.dmg

To compile 64-bit, use

../R-devel/configure r_arch=x86_64 CC="gcc -arch x86_64" \
 CXX="g++ -arch x86_64" F77="gfortran -arch x86_64" \
 FC="gfortran -arch x86_64" OBJC="gcc -arch x86_64" \
 --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib

make -j8 && make install

(replace R-devel above with the place you keep R sources, you should not build directly in the source directory)

For 32-bit replace all x86_64 with i386 above. (You can build both and install in the same place, they'll co-exist nicely).

NOTE: You must specify -arch for all compilers, because the defaults now differ between Apple's Xcode 3.2 compilers and our gfortran.

---

IMPORTANT: If you upgraded from Leopard and/or you installed R for Leopard (Mac OS X 10.5) you may have a old gfortran from Xcode 3.1 on your machine - it will NOT work on SL properly. You MUST remove it and use the CRAN build of gfortran (or comparable) instead. To check for it run "which gfortran" in the Terminal - it should show either

This is ok, you have CRAN gfortran:
Fino:~$ which gfortran
/usr/local/bin/gfortran
Fino:~$

This is also ok for now, you have no gfortran, but you can install the one from CRAN:
Fino:~$ which gfortran
Fino:~$

This is bad:
 Fino:~$ which gfortran
/usr/bin/gfortran
Fino:~$

If you have /usr/bin/gfortran, remove it, e.g.
sudo rm /usr/bin/gfortran

---

I hope this helps, I'll also put it in the FAQ.

Cheers,
Simon

_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to