[R-SIG-Mac] Compiling packages with specific gcc
mailinglist.honeypot at gmail.com
Tue May 5 23:05:48 CEST 2009
Sorry to spam, but I just wanted to post this follow up just in case
someone asks google about this later.
I found that I can get the R's default settings for the ones I needed
to override (CC, CPP, etc.) by typing `R CMD config SETTING` at the
command line. So, for instance, to find out what R had config'd for CPP:
$ R CMD config CPP
gcc -arch i386 -std=gnu99 -E
So I used that to redefine my Makevars, only now I have an absolute to
gcc/g++ so that I can get the ones from Apple, and not the one in my /
usr/local/bin. So, the contents of my Makevars file is now:
CC=/usr/bin/gcc -arch i386 -std=gnu99
CPP=/usr/bin/gcc -arch i386 -std=gnu99 -E
CXX=/usr/bin/g++ -arch i386
CXXCPP=/usr/bin/g++ -arch i386 -E
OBJC=/usr/bin/gcc -arch i386 -std=gnu99
On May 5, 2009, at 3:03 PM, Steve Lianoglou wrote:
> Thanks Duncan & Kasper, I've been able to squeeze out of my
> problem ...
>> You can pass configure args with the configure.args parameter to
>> install.packages. I'm not sure how many you need to set, but
>> you'll likely need to set CC, CPP, CXX, F77, FC, OBJC, and maybe
>> some of the associated flags. You can see the list using "R CMD
>> config" in the console.
> The R CMD config was the trick. I actually put set those flags in
> my ~/.R/Makevars-PLATFORM file, as it seems the build step is
> picking these up so I don't have to pass them into the
> configure.args param. For the record, since I'm on a first
> generation MBP, the name of that file is "Makevars-i386-apple-
> darwin8.11.1", and it looks like:
>> You will want to recompile R with the new compiler. Then, whenever
>> you compile a package, it will use the same compiler as R was
>> compiled with.
> Thanks for the preemptive warning. On the computer where I'm having
> this problem, R is actually installed from the official cran
> installer, so I just needed to set it to use the apple gcc by default.
> I have to assume that this R was also built w/ Apple's gcc, so
> perhaps R doesn't use the same compiler by default, as you suggest?
> I'm not sure.
>> Mixing compilers might be possible using the hints from Duncan, but
>> I am pretty sure it is discouraged.
>> In the past Simon has discouraged use of the HPC compilers. I don't
>> remember the reasons, but I respect the source of the
>> information :) He knows way more about mac compilers than I do. Of
>> course, this was a while back and things might have changed.
> Yeah, I'd trust that source of information as well :-)
> This kind of leads me into another related question, then. So, I
> actually d/l'd the HPC compiler so I can compile w/ -fopenmp (to use
> OpenMP for some easy parallelization). Does this mean that I
> shouldn't do that w/ a vanilla R install and perhaps recompile R
> from source w/ the HPC compiler? And if Simon doesn't like using the
> HPC compiler, then should we stay away from this in general?
> Steve Lianoglou
> Graduate Student: Physiology, Biophysics and Systems Biology
> Weill Medical College of Cornell University
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University
More information about the R-SIG-Mac