[R] Using non-gcc compilers with install.packages()

Trond Hasle Amundsen t.h.amundsen at usit.uio.no
Thu Sep 1 16:15:01 CEST 2005

Roger Bivand <Roger.Bivand at nhh.no> writes:

> On Thu, 1 Sep 2005, Trond Hasle Amundsen wrote:
>> Roger Bivand <Roger.Bivand at nhh.no> writes:
>> > On Thu, 1 Sep 2005, Trond Hasle Amundsen wrote:
>> >
>> >> 
>> >> Hi,
>> >> 
>> >> I have built R 2.1.1 on Solaris and OSF1, and used the operating
>> >> system's native compiler set. This worked fine. However, when I try
>> >> using install.packages() it insists on using g77 etc., which doesn't
>> >> exist on those systems.
>> >> 
>> >> How can I specify which compilers to use? What about other
>> >> compile-time options like LDFLAGS etc.?
>> >> 
>> >> NB! Please include me in the CC list, since I'm not a mailinglist
>> >> member.
>> >> 
>> >> PS. I really like perl's approach to module building. When building
>> >> perl modules, it defaults to the same compilers as perl was initially
>> >> built with. This seems like a sane approach also for R IMHO.
>> >
>> > Indeed, R is pretty sane. Fine tuning is conveniently carried out by
>> > editing the config.site file in the root source directory; LDFLAGS are on
>> > line 138 of the released 2.1.1 source. Which particular packages have you
>> > found showing this behaviour?
>> Hmm..
>>  - The following use correct c/c++ compilers, but fail to recognize
>>    this as as Solaris system and uses -fPIC instead of -KPIC for
>>    shared objects. They also use other gcc-specific options like
>>    '-O2':
>>       RandomFields
>>       geoR
>>       geoRglm
>>       rgl
>>  - The following packages try g77 without first checking if it
>>    exists. I did not specify the F77 variable when compiling R, since
>>    it found f77 by itself. If all I need is to re-compile with the F77
>>    variable set to 'f77', I won't mind.
>>       akima
>>       sm
>>       spatstat
>>       splancs
>> There are problably more.. these two problem seem to be consistent
>> across modules, but I can't be sure.
> OK. When installing packages, the settings in the R_HOME/etc/Makeconf file 
> are used, unless over-ridden by a src/Makevars file in the source package. 
> Since I maintain splancs, I know that it does not have a src/Makevars 
> file. That means that you are getting the R_HOME/etc/Makeconf settings 
> generated at compile time. Can you confirm that your R_HOME/etc/Makeconf 
> file has the compile time settings?

Aha. This explains everything. At our site, we use a software
distribution and build system that classifies files a certain way. For
text files, the Linux version is used, for no other reason than that
the Linux compile server is the master of the cluster. This system
does not recognize files that look different on different
architectures. If it's a text file, it's considered architecture
independent and only one version (in our case, the one built on Linux)
is kept.

I'll rebuild R on all architectures, and flag the contents of
R_HOME/etc as architecture dependent so that the correct version is
kept. That way, module building shouldn't give me more problems.

Thanks for your quick and valuable input. You deserve a cold beer :)


Trond Hasle Amundsen <t.h.amundsen at usit.uio.no>
Gruppe for basis systemdrift (BSD), SAPP, USIT

More information about the R-help mailing list