[R-SIG-Mac] Building 64-bit R on Leopard (Mac Pro): what worked for me...

Matthew Keller mckellercran at gmail.com
Sat Nov 17 02:14:37 CET 2007


Todd,

Thank you very much for this work! I found it extremely helpful...

Matt

On Nov 13, 2007 5:27 AM, Todd A. Johnson <tjohnson at src.riken.jp> wrote:
> I have spent the last few days trying to get R 2.7.0 compiled (with the
> R.app functioning) as x86_64 under Leopard on a Mac Pro, so after having
> success, I thought that I would share what worked for me. YMMV
>
> Please let me know about inaccuracies or compilation flags that might be
> better for performance.
>
> It was previously mentioned on the list that we need to pass the
> architecture flags (x86_64, ppc, i386, or ppc64) to each of the compilers.
> Unfortunately, the FAQ, web-sites, and e-mails that give compiler flags only
> explicitly set CC, CXX, F77, and FC, but leave out the Objective-C compiler
> (OBJC), which appears to now be needed for R.app support, so
>
> THE SHORT VERSION OF THIS EMAIL:
> (as a supplement to R for Max OS X FAQ 2.5)
>
> 1)  You need Xcode 3.0 and quad-architecture gfortran-4.2.1
> 2)  Download the latest R-devel source(2.7.0) from
> ftp://ftp.stat.math.ethz.ch/Software/R/
> 3) configure and build for ppc, i386, and x86_64 archs as in FAQ 2.5 but add
> OBJC to the flags (example: OBJC="gcc -arch x86_64")
> 4)  Do FAQ 2.4 to build R.app
>
>
> THE LONG VERSION:
>
> First steps:
>
> 1) Install Xcode 3.0 (http://developer.apple.com or an optional install on
> your Leopard DVD) and the quad architecture gfortran-4.2.1.dmg
> (http://r.research.att.com/tools)
>
> 2) Download the most recent R-devel source snapshot (2007-11-11 worked for
> me) from:  ftp://ftp.stat.math.ethz.ch/Software/R/
>
> Comments on building R:
> 1)  If you just want command line R, you don't need a universal framework,
> so can install using just the configure flags for x86_64  below, but remove
> the r_arch=x86_64 or it won't run.
>
> 2)  As mentioned on CRAN's R Mac OS X FAQ, to build R.app in Xcode requires
> a universal build of R.  However, R for ppc64 won't build on a Mac Pro, so
> we need to build ppc, i386, and x86_64 architectures to be able to build
> R.app.
>
> Here are Terminal commands starting from your home directory.  You can
> configure and make each architecture in three different Terminal windows if
> you want to get done faster, but to have x86_64 be your active architecture,
> it seems that you should "sudo make install" x86_64 last (R-Mac FAQ 2.5).
> This last point might not be necessary now, but probably won't hurt.
>
> Assuming you have now downloaded R-devel_2007-11-11.tar.gz and placed it in
> a folder /Users/YourUserName/sources
> ______________________________________________
> cd
> cd sources
> tar xfz R-devel_2007-11-11.tar.gz
> mv R-devel R-devel_ppc
> tar -xfz R-devel_2007-11-11.tar.gz
> mv R-devel R-devel_i386
> tar -xfz R-devel_2007-11-11.tar.gz
> mv R-devel R-devel_x86_64
>
> cd R-devel_ppc
> ./configure \
> CC='gcc -arch ppc' \
> CXX='g++ -arch ppc' \
> OBJC='gcc -arch ppc' \
> F77='gfortran -arch ppc' \
> FC='gfortran -arch ppc' \
> --with-blas='-framework vecLib' --with-lapac \
> r_arch=ppc
> make
> sudo make install
>
> cd ../R-devel_i386
> ./configure \
> CC='gcc -arch i386' \
> CXX='g++ -arch i386' \
> OBJC='gcc -arch i386' \
> F77='gfortran -arch i386' \
> FC='gfortran -arch i386' \
> --with-blas='-framework vecLib' --with-lapac \
> r_arch=i386
> make
> sudo make install
>
> cd ../R-devel_x86_64
> ./configure \
> CC='gcc -arch x86_64' \
> CXX='g++ -arch x86_64' \
> OBJC='gcc -arch x86_64' \
> F77='gfortran -arch x86_64' \
> FC='gfortran -arch x86_64' \
> --with-blas='-framework vecLib' --with-lapac \
> r_arch=x86_64
> make
> sudo make install
> _______________________________________
>
>
> Building R.app
>
> 1)  Make sure R works from the Terminal.
>
> 2)  After getting universal R installed as above, then we have to download
> the Mac-GUI and build it.
> __________
> cd
> cd sources
> svn co https://svn.r-project.org/R-packages/trunk/Mac-GUI
> _________
>
> 1)  Start Xcode.
> 2)  Go to File:Open and open the R.xcodeproj in the Mac-GUI folder that you
> just downloaded from SVN (i.e. /Users/YourUserName/sources/Mac-GUI).
> 3)  Make sure the pulldown menus at the top have Active Target=R, Active
> Build Configuration=Deployment.
> 4) Click the "Build" button at the top.  After it's done, your should see
> "Build succeeded" in the bottom left corner.
> 5)  R.app is built in: Mac-GUI/build/Deployment/R.app
> Move it wherever you want i.e /Applications
>
>
> I hope that this is useful to somebody.
>
>
> Best wishes,
>
>
> Todd
>
>
> --
> Todd A. Johnson
> Research Associate, Laboratory for Medical Informatics
> SNP Research Center,RIKEN
> 1-7-22Suehiro,Tsurumi-ku,Yokohama
> Kanagawa 230-0045,Japan
> Work phone:  (045)-622-0862
> Cellphone: 090-5309-5867
>
> E-mail: tjohnson at src.riken.jp
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>



-- 
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder
www.matthewckeller.com



More information about the R-SIG-Mac mailing list