Hi R-fellows,

I have some fatal errors compiling the R source files with gcc-4.7.1 on my Mountain Lion and I wonder if this is only on my Mac or if it does happen on other Macs too (I use the gcc-4.7 as I want to compile some C++ code that uses OpenMP 3.1).

Here is the way I did it: 

1. (gcc-4.7) Install gcc-4.7 on my Mac following http://solarianprogrammer.com/2012/07/21/compiling-gcc-4-7-1-mac-osx-lion/ (This runs quite well)

2. (Configure) Getting the R-2.15.1.tar.gz from http://cran.r-project.org, 

I used on the shell:  

tar -zxvf R-2.15.1.tar.gz
cd R-2.15.1*
mkdir build && cd build

Further, for the R configure to work it needs the XCode Command Line Tools 

Now as the gcc-4.7 is not the default compiler on my Mac and R needs X11 the configure line is a little nasty but works without errors (see also http://stat.ethz.ch/R-manual/R-patched/doc/manual/R-admin.html#Installing-R-under-_0028Mac_0029-OS-X):

../configure CC="gcc-4.7 -arch x86_64" CXX="g++-4.7 -arch x86_64" F77="gfortran-4.7 -arch x86_64" FC="gfortran-4.7 -arch x86_64" OBJC="gcc-4.7 -arch x86_64" -x-libraries=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/lib -x-includes=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include --with-lapack --with-blas='framework vecLib'

(The usual installation given on http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html, i.e.: 

../configure CC="gcc-4.7 -arch $arch" CXX="g++-4.7 -arch $arch" F77="gfortran-4.7 -arch $arch" FC="gfortran-4.7 -arch $arch" OBJC="gcc-4.7 -arch $arch" --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib --with-blas='framework vecLib' --with-lapack

having defined arch=x86_64 

does not work on my machine, as it seems that XCode installs the Command Line Tools with the X11SDK in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11. Compiling with this line usually gives: 

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

3. (Make) Doing now the make gives me huge amount of fatal errors with no clue where it comes from and no google documentations so far. All make output can be seen here: http://pastebin.com/3baL8php

I have really no clue where these come from, but maybe somebody of you guys has encountered either these errors as well or has found another way to compile R with gcc-4.7?


Best Regards

Simon
 
	[[alternative HTML version deleted]]

