[R] choosing g/g++ compiler executable in R CMD SHLIB

Prof Brian D Ripley ripley at stats.ox.ac.uk
Sun Nov 18 09:51:27 CET 2001


On Sat, 17 Nov 2001, Faheem Mitha wrote:

>
>
> On Sat, 17 Nov 2001, Prof Brian Ripley wrote:
>
> > On Sat, 17 Nov 2001, Faheem Mitha wrote:
> > > How can I get R CMD SHLIB to invoke  gcc-3.0 instead of gcc and
> > > g++-3.0 instead of g++?
> [snip]
>
> > It's nothing to do with "Writing R Extensions": it is an installation
> > issue.  If you build R with CC=gcc-3.0, CXX=g++-3.0 then these will be
> > recorded in RHOME/etc/Makeconf and used by R CMD SHLIB (at least, that
> > works for me).  I suspect manually editing that file will do what you
> > want.
>
> Yes, this works. Thanks.
>
> > However, a warning.  FLIBS is also set at build time (configure time),
> > and the correct specification for gcc 3.0.x is not the same as for gcc
> > 2.95.x.   I think it would be a lot safer to rebuild R under your favoured
> > compilers.
> >
> > The FLIBS problem arises if compilers are updated so g77 refers to 3.0.x,
> > BTW.  It may not be relevant is you only want to compile C and C++.
>
> If I understand you correctly, this will only be an issue if I was to use
> R to do complilation of Fortran code. I have no such plans. I have changed
> all the stuff that seems relevant, CC = gcc-3.0, CXX = g++-3.0, CXXCPP =
> g++-3.0 -E, SHLIB_CXXLD = g++-3.0. I have left the Fortran stuff alone, so
> FC = g77 still refers to 2.95.x. In any case, I don't even have g77
> installed.

It's only an issue if you plan to compile or link against compiled Frtran
code.  In either case you need g77 installed.  Quite a few packages need
Fortran, though.

> Just one more question. Is it possible to override ../etc/Makeconf
> locally, in the directory in which I am doing the complilation? I can use
> Makevars to set flags, but it doesn't seem to work with choosing the
> compiler. Ie setting CC=.. in Makevars has no effect.

I believe that is intentional.  Neither setting CC in the environment nor
in Makevars works for me.  Makevars precedes the standard makefile.
I did make setting CC in the environment work by setting MAKE to `gmake
-e', as in (under tcsh)

auk% env MAKE='gmake -e' CC=cc R CMD SHLIB test.c


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list