Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: tags/R-1-2
Fetching contributors…

Cannot retrieve contributors at this time

file 329 lines (236 sloc) 12.449 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329



This document concerns building and installing R from sources. Pre-made
binaries are made available for some systems with varying regularity and
can be obtained from CRAN (see the RESOURCES file).

R will configure and build under a number of common Unix-like platforms
(including i386-freebsd, i386-linux, i386-sun-solaris, ppc-linux,
mips-sgi-irix, alpha-linux, alpha-dec-osf4, rs6000-ibm-aix,
hppa-hp-hpux, sparc-linux, and sparc-sun-solaris) and on Windows
9x/NT/2000 (see `src/gnuwin32/INSTALL'). In general it is relatively
easy to adapt R to new platforms. See the section on new platforms for


The simplest way is to download the most recent `R-x.y.z.tgz' package,
and unpack them with

tar xvfz R-x.y.z.tgz

on systems that have GNU tar installed. On other systems you need at
least to have the `gzip' program installed. Then you can use

gzip -dc R-x.y.z.tgz | tar xvf -

If you need to transport the sources on floppy disks, you can download
the `R-x.y.z.tgz-split.*' files and paste them together at the
destination with

cat R-x.y.z.tgz-split.* > R-x.y.z.tgz

and proceed as above.

Finally, for minor-minor releases (x.y.z with z != 0), a patch against
the 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 file
that the `.tgz' files. Such a file can be applied to the sources of the
previous version by changing to the top directory of it and

gzip -dc /path/to/it/R-x.y.{z-1}-x.y.z.diff.gz | patch -E -p1

Beware that this does not necessarily work if the older sources have
been modified (e.g., by building in their directories).


Choose a place to install the R tree (R is not just a binary, but has
additional data sets, help files, font metrics etc). Let's call this
place R_HOME. Untar the source code. This should create directories
src, doc, and several more. Issue the following commands:


(See USING MAKE below if your make is not called `make'.)

If these commands execute successfully, the R binary will be copied to
the `${R_HOME}/bin' directory. In addition, a shell script front-end
called "R" will be created and copied to the same directory. You can
copy 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 place
where your man reader finds it, such as `/usr/local/man/man1'. If you
want to install the complete R tree to, e.g., `/usr/local/lib/R', see
section 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 run


and so on, as described further below. This has the advantage of always
keeping your source tree ``clean''. (You may need GNU make to allow

If you need or want to set certain configure variables to something
other than their default, you can do that by either editing the file
`' (which documents all the variables you might want to set)
or on the command line as

VAR="..." ./configure # Bourne shell compatibles
(setenv VAR "..."; ./configure) # C shell

One common variable to change is R_PAPERSIZE, which defaults to a4, not

If you have libraries and header files, e.g., for GNU readline, in
non-system directories, use the variables LIBS (for libraries) and
CPPFLAGS (for header files), respectively, to specify these locations.
These default to `/usr/local/lib' and `/usr/local/include' to catch the
most common cases. If libraries are still not found, then maybe your
compiler/linker does not support re-ordering of `-L' and `-l' flags
(this has been reported to be a problem on HP-UX with native cc). In
this case, use a different compiler (or a front end shell script which
does the re-ordering).

If you find you need to alter configure variables, it is worth noting
that some settings are cached in the file `config.cache', and it is a
good idea to remove that file before re-configuring.

Make will also build plain text help pages as well as HTML and LaTeX
versions of the R object documentation (the three kinds can also be
generated separately using `make help', `make html' and `make latex').
Note that you need Perl version 5, available via, to build this documentation. If this is not
available on your system, you can obtain PDF versions of the
documentation files via the Comprehensive R Archive Network (CRAN), see
the file `RESOURCES' for information 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 at

The GNOME interface for R will only be built if you specify it: see the
GNOME section below.


There 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 use

make dvi to create DVI versions
make pdf to create PDF versions
make info to create info files (not refman)

You will not be able to build the info files unless you have makeinfo
version 4 or later installed (and some Linux distributions have 3.12).

The DVI versions can be previewed and printed using standard programs
such as `xdvi' and `dvips'. The PDF versions can be viewed using
Acrobat Reader or (recent versions of) ghostscript: they have
hyperlinks that can be followed in Acrobat Reader. The info files are
suitable for reading online with Emacs or the standalone GNU Info.




have been completed successfully, you can install the complete R tree
to your system by typing

make install

This 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 help
system, ...)

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/go

This installs the R executable to `/where/you/want/R/to/go/bin', and so
on. The prefix of the installation directories can also be seen in the
status message that is displayed at the end of configure. You can
install into another directory by using

make prefix=/path/to/here install

To install DVI, info and PDF versions of the manuals, use `make
install-dvi', `make install-info' and `make install-pdf', respectively.


To 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 make different
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 VPATH
variable, for example GNU make, or Sun make on Solaris 2.7 (but not

If you want to use a make by another name, for example if your GNU make
is called `gmake', you need to set MAKE at configure time, for example

MAKE=gmake ./configure (sh, bash)
env MAKE=gmake ./configure (csh)


To compile R, you need a FORTRAN compiler or f2c, the FORTRAN-to-C
converter. The default is to search for g77, fort77, f77, f90, xlf,
cf77, and fc (in that order), and then for f2c, and use whichever is
found first; if none is found, R cannot be compiled. The search
mechanism can be changed using the `--with-g77', `--with-f77', and
`--with-f2c' command line options to configure. If your FORTRAN
compiler is in a non-standard location, you should set the enviroment
variable PATH accordingly before running configure.

If your FORTRAN libraries are in slightly peculiar places, you should
also look at LD_LIBRARY_PATH to make sure that all libraries are on this

You must set whatever compilation flags (if any) are needed to ensure
that FORTRAN `integer' is equivalent to a C int pointer and FORTRAN
`double precision' is equivalent to a C double pointer. This is checked
during the configuration process.


This interface is experimental, incomplete and not currently being
developed. It provides a console and a graphics device (gtk(); the x11()
device can also be used). Many of the `features' of the console are
currently stubs.

The GNOME interface for R will only be built if you specify it by
running configure with the `--with-gnome' option. For example, you
might run

./configure --with-gnome

but please check you have all the requirements first. It is advisable
to have reasonably-up-to-date versions of the gnome and gtk+ libraries
(later than those in RedHat 6.0, for example). You can find the
versions you have by

gnome-config --version
gtk-config --version

We know 1.0.10 and 1.2.3 suffice. You need the following RPMs and
their dependencies installed:


You will need also libglade 0.5 or later for correct behaviour. For
more information on libglade and to download the source, see The sources are also available
from the GNOME ftp site ( and mirrors). RPMs are in RedHat
6.1 and later.

libglade needs libxml 1.4 or later, the source for which is available
from the GNOME ftp site ( and mirrors). RPMs of libxml-1.4
and libxml-devel-1.4 are available from and mirrors,


A wide range of flags can be set in the file or via
environment variables. We have already mentioned

CPPFLAGS extra include flags
LIBS libraries and `-L/lib/path' flags

and others include

CFLAGS debugging and optimization flags, C
MAIN_CFLAGS ditto, for compiling the main program
SHLIB_CFLAGS or shared libraries
FFLAGS debugging and optimization flags, Fortran
MAIN_FFLAGS ditto, for compiling the main program
SHLIB_FFLAGS or shared libraries
MAIN_LDFLAGS additional flags for the main link
SHLIB_LDFLAGS additional flags for the linking shared libraries

Library paths specified as -L/lib/path in LIBS are collected together
and 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 use
MAIN_CFLAGS=-pg, MAIN_FFLAGS=-pg, MAIN_LDFLAGS=-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 new
hardware/os platform.

 1. Floating Point Arithmetic: R supports the POSIX, SVID and IEEE
    models for floating point arithmetic. The POSIX and SVID models
    provide no problems. The IEEE model however can be a pain. The
    problem is that there is no agreement on how to set the signalling
    behavior; sgi/irix and i386 linux require no special action, freebsd
    requires a call to (the macro) fpsetmask(0) and osf1 requires
    that computation be done with a `-ieee_with_inexact' flag etc ...
    On a new platform you must find out the magic recipe and add some
    code to make it work. This can often be done via the file
    `' which resides in the top level directory.

 2. Shared Libraries: There seems to be very little agreement across
    platforms on what needs to be done to build shared libraries.
    there are many different combinations of flags for the compilers
    and loaders. The technique we use is to interrogate the X window
    system about what it does (using xmkmf). This often works, but
    you 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
    (following the instructions therein) so that the build will use
    these options.

If you do manage to get R running on a new platform please let us know
about it so we can modify the configuration procedures to include that

If you are having trouble getting R to work on your platform please
feel free to get in touch to ask questions. We've had a fair amount
of practice at porting R to new platforms ...

R Core Members
Something went wrong with that request. Please try again.