Rev 9527 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
INSTALLING R UNDER UNIXGENERALITIESThis document concerns building and installing R from sources. Pre-madebinaries are made available for some systems with varying regularity andcan be obtained from CRAN (see the RESOURCES file).R will configure and build under a number of common Unix-likeplatforms (including i386-freebsd, i386-linux, ppc-linux,mips-sgi-irix, alpha-linux, alpha-dec-osf4, rs6000-ibm-aix,hppa-hp-hpux, sparc-linux, and sparc-sun-solaris) and on Windows9x/NT/2000 (see `src/gnuwin32/INSTALL'). In general it is relativelyeasy to adapt R to new platforms. See the section on new platformsfor details.GETTING AND UNPACKING THE SOURCESThe simplest way is to download the most recent R-x.y.z.tgz package, andunpack them withtar xvfz R-x.y.z.tgzon systems that have GNU tar installed. On other systems you need atleast to have the "gzip" program installed. Then you can usegzip -dc R-x.y.z.tgz | tar xvf -If you need to transport the sources on floppy disks, you can downloadthe R-x.y.z.tgz-split.* files and paste them together at the destinationwithcat R-x.y.z.tgz-split.* > R-x.y.z.tgzand proceed as above.Finally, for minor-minor releases (x.y.z with z != 0), a patch againstthe preceding release is made available in R-x.y.{z-1}-x.y.z.diff.gz(e.g., R-0.63.2-0.63.3.diff.gz), which is generally a much shorter filethat the .tgz files. Such a file can be applied to the sources of theprevious version by changing to the top directory of it andgzip -dc /path/to/it/R-x.y.{z-1}-x.y.z.diff.gz | patch -E -p1Beware that this does not necessarily work if the older sources havebeen modified (e.g., by building in their directories).SIMPLE COMPILATIONChoose a place to install the R tree (R is not just a binary, but hasadditional data sets, help files, font metrics etc). Let's call thisplace R_HOME. Untar the source code. This should create directoriessrc, doc, and several more. Issue the following commands:./configuremake(See USING MAKE below if your make is not called `make'.)If these commands execute successfully, the R binary will be copied tothe `${R_HOME}/bin' directory. In addition, a shell script front-endcalled "R" will be created and copied to the same directory. You cancopy this script to a place where users can invoke it, for example to`/usr/local/bin/R'. You could also copy the man page `R.1' to a placewhere your man reader finds it, such as `/usr/local/man/man1'. If youwant to install the complete R tree to, e.g., `/usr/local/lib/R', seesection INSTALLATION below.You do not necessarily have to build R in the top-level source directory(say, TOP_SRCDIR). To build in BUILDDIR, cd there and runTOP_SRCDIR/configuremakeand so on, as described further below. This has the advantage of alwayskeeping your source tree `clean'. (You may need GNU make to allowthis.)If you need or want to set certain configure variables to somethingother than their default, you can do that by either editing the file`config.site' or on the command line asVAR="..." ./configure # Bourne shell compatibles(setenv VAR "..."; ./configure) # C shellOne common variable to change is R_PAPERSIZE, which defaults to a4, notletter.If you have libraries and header files, e.g., for GNU readline, innon-system directories, use the variables LIBS (for libraries) andCPPFLAGS (for header files), respectively, to specify these locations.These default to /usr/local/lib and /usr/local/include to catch themost common cases.If you find you need to alter configure variables, it is worth notingthat some settings are cached in the file `config.cache', and it is agood idea to remove that file before re-configuring.Make will also build plain text help pages as well as HTML and LaTeXversions of the R object documentation (the three kinds can also begenerated separately using make help, make html and make latex). Notethat you need Perl version 5, available via http://www.perl.com/CPAN/,to build this documentation. If this is not available on your system,you can obtain PDF versions of the documentation files via theComprehensive R Archive Network (CRAN), see the file `RESOURCES' forinformation on CRAN.Now rehash if necessary, type `R', and read the R manuals and the R FAQ(files FAQ or doc/html/faq.html or the latest version athttp://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html).The GNOME interface for R will only be built if you specify it: see theGNOME section below.MAKING THE MANUALSThere is a set of manuals that can be built from the sources,refman Printed versions of all the help pages.R-intro `An Introduction to R'.R-exts `Writing R Extensions'.R-FAQ R FAQ (which is already built for you).To make these, cd to the `doc/manual' directory and usemake dvi to create DVI versionsmake pdf to create PDF versionsmake info to create info files (not refman)You will not be able to build the info files unless you have makeinfoversion 4 or later installed (and most Linux distributions have 3.12).The DVI versions can be previewed and printed using standard programssuch as `xdvi' and `dvips'. The PDF versions can be viewed usingAcrobat Reader or (recent versions of) ghostscript: they havehyperlinks that can be followed in Acrobat Reader. The info files aresuitable for reading online with Emacs or the standalone GNU Info.INSTALLATIONAfter./configuremakehave been completed successfully, you can install the complete R treeto your system by typingmake installThis will install to the following directories:${prefix}/bin the front-end shell script${prefix}/man/man1 the man page${prefix}/lib/R all the rest (libraries, on-line helpsystem, ...)where prefix is determined during configuration (typically `/usr/local')and can be set by running configure with the option./configure --prefix=/where/you/want/R/to/goThis installs the R executable to `/where/you/want/R/to/go/bin', and soon. The prefix of the installation directories can also be seen in thestatus message that is displayed at the end of configure. You caninstall into another directory by usingmake prefix=/path/to/here installTo install DVI, info and PDF versions of the manuals, use `makeinstall-dvi', `make install-info' and `make install-pdf', respectively.USING MAKETo compile R, you will most likely find it easiest to use GNU make.On Solaris 2.6/7 in particular, you need a version of GNU makedifferent from 3.77; 3.79 works fine, as does the Sun make.To build in a separate directory you need a make that uses the VPATHvariable, for example GNU make, or Sun make on Solaris 2.7 (but not earlier).If you want to use a make by another name, for example if your GNU makeis called `gmake', you need to set MAKE at configure time, for exampleMAKE=gmake ./configure (sh, bash)env MAKE=gmake ./configure (csh)USING FORTRANTo compile R, you need a FORTRAN compiler or f2c, the FORTRAN-to-Cconverter. The default is to search for g77, fort77, f77, f90, xlf,cf77, and fc (in that order), and then for f2c, and use whichever isfound first; if none is found, R cannot be compiled. The searchmechanism can be changed using the `--with-g77', `--with-f77', and`--with-f2c' command line options to configure. If your FORTRANcompiler is in a non-standard location, you should set the enviromentvariable PATH accordingly before running configure.If your FORTRAN libraries are in slightly peculiar places, you shouldalso look at LD_LIBRARY_PATH to make sure that all libraries are on thispath.You must set whatever compilation flags (if any) are needed to ensurethat FORTRAN `integer' is equivalent to a C int pointer and FORTRAN`double precision' is equivalent to a C double pointer. This is checkedduring the configuration process.BUILDING THE GNOME INTERFACEThis interface is experimental, incomplete and not currently beingdeveloped. It provides a console and a graphics device (gtk(); the x11()device can also be used). Many of the `features' of the console arecurrently stubs.The GNOME interface for R will only be built if you specify it byrunning configure with the --with-gnome option. For example, you mightrun./configure --with-gnomebut please check you have all the requirements first. It is advisableto have reasonably-up-to-date versions of the gnome and gtk+ libraries(later than those in RedHat 6.0, for example). You can find theversions you have bygnome-config --versiongtk-config --versionWe know 1.0.10 and 1.2.3 suffice. You need the following RPMs andtheir dependencies installed:gnome-libsgnome-libs-develgtk+gtk+-develglibglib-develYou will need also libglade 0.5 or later for correct behaviour. Formore information on libglade and to download the source, seehttp://www.daa.com.au/~james/gnome/. The sources are also availablefrom the GNOME ftp site (ftp.gnome.org and mirrors). RPMs are in RedHat6.1 and later.libglade needs libxml 1.4 or later, the source for which is availablefrom the GNOME ftp site (ftp.gnome.org and mirrors). RPMs of libxml-1.4and libxml-devel-1.4 are available from updates.redhat.com and mirrors,or ftp.gurulabs.com/pub/gnome/updates.COMPILE AND LOAD FLAGSA wide range of flags can be set in the file config.site or viaenvironment variables. We have already mentionedCPPFLAGS extra include flagsLIBS libraries and -L/lib/path flagsand others includeCFLAGS debugging and optimization flags, CMAIN_CFLAGS ditto, for compiling the main programSHLIB_CFLAGS or shared librariesFFLAGS debugging and optimization flags, FortranMAIN_FFLAGS ditto, for compiling the main programSHLIB_FFLAGS or shared librariesMAINLDFLAGS additional flags for the main linkSHLIBLDFLAGS additional flags for the linking shared librariesLibrary paths specified as -L/lib/path in LIBS are collected togetherand prepended to LD_LIBRARY_PATH, so there should be no need for-R or -rpath flags.To compile a profiling version of R, one might for example want to useMAIN_CFLAGS=-pg, MAIN_FFLAGS=-pg, MAINLDFLAGS=-pg on platforms where-pg cannot be used with position-independent code.NEW PLATFORMS (Standards Hah!)There are a number of sources of problems when installing R on a newhardware/os platform.1. Floating Point Arithmetic: R supports the POSIX, SVID and IEEEmodels for floating point arithmetic. The POSIX and SVID modelsprovide no problems. The IEEE model however can be a pain. Theproblem is that there is no agreement on how to set the signallingbehavior; sgi/irix and i386 linux require no special action, freebsdrequires a call to (the macro) fpsetmask(0) and osf1 requiresthat computation be done with a -ieee_with_inexact flag etc...On a new platform you must find out the magic recipe and add somecode to make it work. This can often be done via the fileconfig.site which resides in the top level directory.2. Shared Libraries: There seems to be very little agreement acrossplatforms on what needs to be done to build shared libraries.there are many different combinations of flags for the compilersand loaders. The technique we use is to interrogate the X windowsystem about what it does (using xmkmf). This often works, butyou may have to manually override the results. Scanning the cc(1)and ld(1) manual entries usually reveals the correct incantation.Once you know the recipe you can modify the file config.site(following the instructions therein) so that the build will usethese options.If you do manage to get R running on a new platform please let us knowabout it so we can modify the configuration procedures to include thatplatform.If you are having trouble getting R to work on your platform pleasefeel free to get in touch to ask questions. We've had a fair amountof practice at porting R to new platforms...R Core Members