[R-SIG-Mac] Compiling packages with specific gcc

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue May 5 21:03:12 CEST 2009

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  

> 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


More information about the R-SIG-Mac mailing list