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

Duncan Murdoch murdoch at stats.uwo.ca
Tue May 5 19:56:56 CEST 2009

On 5/5/2009 1:05 PM, Steve Lianoglou wrote:
> Hi all,
> I'm wondering if/where I can go to tell R to use a specific version of  
> my gcc compiler when installing packages from source, via  
> `install.packages("...", type='source')` or when running `R CMD  
> INSTALL some_source_packge.tar.gz` from the command line.
> The reason I ask is because I've downloaded gcc-4.4 from HPC/OSX[1],  
> and it unfortunately puts the compilers in /usr/local/bin/gcc, w/o  
> version info (it would be nice if it were /usr/local/bin/gcc-4.4). R  
> tries to use this when compiling, but these compilers do not support  
> the "-arch=..." flags, so it bombs.
> I've been hunting around in the tools:::.install_packges code and also  
> the "R Installation and Adminstration"[2] document, but can't find  
> what I'm looking for. I have a feeling that perhaps I can put  
> something into my ~/.R/Makevars, or ~/.R/Makevars-i386-apple- 
> darwin8.11.1 file, but I'm just taking stabs at the dark, so not  
> having much luck.
> I can work around this by temporarily removing /usr/local/bin from my  
> path when trying to `R CMD INSTALL` packages by source, but I was  
> hoping there might be a more elegant solution. The fact that  
> installing by source gets the `make` command from the system  
> environment makes me a bit hopeful, but I'm not really sure.
> Thanks for any help,

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.

Duncan Murdoch

More information about the R-SIG-Mac mailing list