[R-SIG-Mac] R compile from sources: error in make with gcc-4.7

Simon Urbanek simon.urbanek at r-project.org
Thu Sep 13 21:48:51 CEST 2012


It seems your compiler doesn't support ObjC. You should get a working compiler... Besides, gcc-4.7.x has been reported to break so your mileage may vary even if you get Apple driver and a more complete compiler.
More comments inline below.

Cheers,
Simon


On Sep 13, 2012, at 3:21 PM, Simon Zehnder wrote:

> 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.

Again, possibly a problem with your compiler, a supported compiler doesn't need that hack. But also 10.8 doesn't come with X11 so I assume you installed XQuartz accordingly ...


> Compiling with this line usually gives: 
> 
> configure: error: --with-x=yes (default) and X11 headers/libs are not available)
> 

Note that the instructions are for Apple compilers and those compatible (e.g. FSF builds with Apple driver driver which adds extra flags and parses others). For any other compilers, you're on your own and the flags may vary.


> 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,

They some from including AppKit, apparently your compiler doesn't even work with system frameworks. Even if you fix this instance there is Quartz as well. There are a lot of broken compiler builds around, so I'm not surprised. If you have to avoid all system services, you can try to build without aqua, but I don't think that has been tested recently on OS X ...


> 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]]
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> 



More information about the R-SIG-Mac mailing list