Hi guys, I want to make a last comment on compiling R on a Mac OS with the GNU 4.7.1 compiler. I solved all my problems and I would like to present my way here for other users who may find it helpful.
I am using Mountain Lion 10.8.2 and followed: http://solarianprogrammer.com/2012/02/20/living-on-the-edge-building-gcc-4-7-on-mac-osx-lion/ for the installation of gcc-4.7.1. Furthermore I downloaded the latest version of XQuartz (http://xquartz.macosforge.org/landing/). Next step: I downloaded the latest R-patched version 2.15.1 here (thanks for the tip Simon!): http://r.research.att.com. Then the following commands have been made: In the untared R-patched folder: mkdir build && cd build ../configure CC=gcc-4.7 CXX=g++-4.7 F77=gfortran-4.7 FC=gfortran-4.7 OBJC=clang CFLAGS="-DOS_OBJECT_USE_OBJC=0" CPPFLAGS="-D__ACCELERATE__" --with-lapack --with-blas='-framework Accelerate' --with-x sudo make sudo make install Now R runs much faster on my Mac then before and without any problem. The only unsolved task yet is, that the R.framework - especially the library folder below Resources/ is not accessible by default. So installing a package results in an exception. I solved this task by simply changing the permissions on the folder. The solution to my problem has been brought up by a friend of mine in the HPC team at the Computing Center RWTH Aachen University (Germany), Hriesto Iliev (http://www.rz.rwth-aachen.de/aw/cms/rz/Themen/hochleistungsrechnen/hilfen_kurse_und_veranstaltungen/~svf/und_das_sind_wir/?lang=de or on stackoverflow: http://stackoverflow.com/users/1374437/hristo-iliev). In his words: The reason why compilation of aqua.c fails is due to a change possibly introduced in the 10.8 SDK. Several system header files now use by default some Obj-C constructs with extensions (code blocks), only supported by clang and Apple's version of GCC. The workaround is given via the C flag -DOS_OBJECT_USE_OBJC=0". The veLib problem can be used in two different ways: 1. Simon Urbanek suggests to use the CPP flag -D__ACCELERATE__ 2. Hriesto solved the problem via changing #include<vecLib/vecLib.h> to #include<Accelerate/Accelerate.h> in ../src/modules/lapack/vecLib95c.c (relative to the build directory). As vecLib is deprecated it should also be used --with-blas="-framework Accelerate" instead of --with-blas="-framework vecLib" (but both options seem to work). Unfortunately there is another part that prevents one from building R with gcc-4.7: The Quartz graphics device must be compiled with the Objective-C compiler from Apple as (again) code blocks are used extensively in the OS X SDK and this time there is no workaround. Clang is a good candidate and as high performance libraries like OpenMP are not used in the graphics device, Xcode's default can be used without matters. So one simply changes the Obj-C compiler to clang: OBJC=clang. Following Hristo it is also unnecessary to specify "-arch x86_64" as the compiler is already producing 64-bit code by default. We are still not sure if we need the X11 graph device, as the Quartz one should be more capable (graphics in R work fine). Any comments are welcome. As I use R either on the command line or in RStudio I have not installed the R.app. If one wants to install it, one have to build R as a dynamic library to be later used by R.app. Doing so one needs the --enable-R-framework directive in the configure step above following the manual, but we got it by default... With the building steps above one can now use R - or rather R extensions - with OpenMP 3.0 as well as other very helpful developments in the C++11 standard. I do not know other mathematical or hpc libraries, but as the compiler is the latest version everything should run. At the end I want to thank everyone here for his helpful comments and Hristo for his time - even if he is not connected to R (yet:)) Best Simon On Sep 16, 2012, at 3:10 PM, Simon Zehnder <[email protected]> wrote: > Hi Simon, > > below you find my configure and my make output while building R from sources > with gcc-4.7.1 and including aqua (I used the R-patched). > > 1. (Configure) Output: http://pastebin.com/GJ5DZncU > > 2. (Make) Output: http://pastebin.com/SHZWgA4P > > Best regards > > Simon > > On Sep 16, 2012, at 3:16 AM, Simon Urbanek <[email protected]> > wrote: > >> Simon, >> >> On Sep 15, 2012, at 6:56 PM, Simon Zehnder wrote: >> >>> That is correct! My fault! Simon, I didn't want to blame you with this one. >>> >>> It compiles know and it works perfectly on the console. I am still >>> interested, why it does not compile with aqua. Can somebody explain me why? >>> >> >> Can you sent me the full output? I don't have the time to compile gcc from >> scratch right now and none of the usual suspects supports ObjC - that alone >> is a sign that no one really uses gcc on OS X (other than for ports) since >> Apple has abandoned it. My guess would be that the ObjC support is not as >> complete as in Apple's version - it's probably more geared toward GNUstep - >> but that's just a guess. >> >> Cheers, >> Simon >> >> >> >>> Best regards >>> >>> Simon >>> >>> On Sep 14, 2012, at 4:38 PM, Berend Hasselman <[email protected]> wrote: >>> >>>> >>>> On 14-09-2012, at 16:01, Simon Zehnder wrote: >>>> >>>>> Running through the errors of my make output on >>>>> http://pastebin.com/HXqLgH4b (without aqua) pulled my attention to the >>>>> following error: >>>>> >>>>> In file included from ../../../../src/modules/lapack/vecLibg95c.c:5:0: >>>>> /System/Library/Frameworks/vecLib.framework/Headers/vecLib.h:22:4: error: >>>>> #error "<vecLib/vecLib.h> is deprecated. Please #include >>>>> <Accelerate/Accelerate.h> and link to Accelerate.framework." >>>>> >>>>> This error is, I think from you Simon, already commented on >>>>> http://permalink.gmane.org/gmane.comp.lang.r.mac/7293. So I followed your >>>>> advice there and added the flag CPPFLAGS=-D ACCELERATE to my configure >>>>> command: >>>>> >>>>> 1. (Configure) The whole command is: >>>>> >>>>> ../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 libVec' --with-lapack >>>>> --without-aqua CPPFLAGS="-D ACCELERATE" >>>>> >>>>> All runs fine - no errors nor warnings. >>>>> >>>>> 2. (Make) I run the make via: >>>>> >>>>> make -j 8 >>>>> >>>>> and I get the following errors: http://pastebin.com/5UfaMK6r >>>>> >>>>> It seems that the flag CPPFLAGS=-D ACCELERATE does not modify the >>>>> compilers work. >>>>> >>>>> Any suggestions here? >>>> >>>> Reading the reply by Simon tells me that your CPPFLAGS doesn't agree with >>>> Simon's fix. It should be CPPFLAGS=-D__ACCELERATE__ >>>> >>>> Berend >>>> >>> >>> _______________________________________________ >>> R-SIG-Mac mailing list >>> [email protected] >>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac >>> >>> >> > > _______________________________________________ > R-SIG-Mac mailing list > [email protected] > https://stat.ethz.ch/mailman/listinfo/r-sig-mac _______________________________________________ R-SIG-Mac mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-mac
