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

Steve Lianoglou mailinglist.honeypot at gmail.com
Wed May 6 16:09:44 CEST 2009

Hi Simon,

> R uses the Apple compiler, but I'm not hard-coding the full path. In  
> your case apparently your PATH has /usr/local/bin before the system  
> paths, so it overrides the default. Another (simpler?) way to solve  
> this is to simply move /usr/local/bin at the end of your PATH  
> (recommended) and all should be well without changing any config  
> files.

I actually wanted to avoid doing this because I tend to install newer  
versions of standard things into /usr/local/* that I'd like to use  
instead of the default ones in /usr/bin/* so I was looking for a back  
door ...

As for the rest of your comments (which I'll keep below for  
posterity), they're spot on. Thanks for the thorough and informative  
feedback. I've nuked all traces of the HPC compilers and will now just  
explicitly compile w/ /usr/bin/g++-4.2 when necessary ... that's a  
simple-enough sol'n for me until Apple decides to set some gcc >= 4.2  
as the default compiler.

Thanks again,

>> 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).
> You can use -fopenmp with Apple's compilers as well, just make sure  
> you make the gcc-4.2 compilers the default (sudo gcc_select 4.2 if  
> you have gcc_spect on your system, otherwise change the symlinks  
> like ln -sf gcc-4.2 /usr/bin/gcc etc. - or specify them directly as  
> you did). Apple's gcc-4.2 compilers are supported by the CRAN binary.
>> 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?
> In general, yes. As you have seen yourself the HPC compilers are not  
> complete, so they cannot build universal binaries. Also they don't  
> use Apple's driver, so all Apple-specific flags will fail. I didn't  
> check the last HPC release, but before they were partially broken  
> causing miscompilations, included wrong binaries (i.e. even the  
> compiler for Tiger would include symbols for Leopard so the binary  
> would not work), etc. I was trying to contact the maintainer a few  
> times, but without avail, so I don't think it's well supported,  
> either.
> Cheers,
> Simon

Steve Lianoglou
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University


More information about the R-SIG-Mac mailing list