R Admin
R Admin
R Admin
R Core Team
This manual is for R, version 3.6.1 (2019-07-05).
Copyright
c 2001–2018 R Core Team
Permission is granted to make and distribute verbatim copies of this manual provided
the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under
the conditions for verbatim copying, provided that the entire resulting derived work
is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into an-
other language, under the above conditions for modified versions, except that this
permission notice may be stated in a translation approved by the R Core Team.
i
Table of Contents
1 Obtaining R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Getting and unpacking the sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Getting patched and development versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2.1 Using Subversion and rsync . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
5 Running R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6 Add-on packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.1 Default packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.2 Managing libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.3 Installing packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
ii
6.3.1 Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.3.2 macOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.3.3 Customizing package compilation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.3.4 Multiple sub-architectures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.3.5 Byte-compilation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.3.6 External software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.4 Updating packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.5 Removing packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.6 Setting up a package repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.7 Checking installed source packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Concept index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
1 Obtaining R
Sources, binaries and documentation for R can be obtained via CRAN, the “Comprehensive
R Archive Network” whose current members are listed at https://CRAN.R-project.org/
mirrors.html.
Note that ‘https:’ is required2 , and that the SSL certificate for the Subversion server of the
R project should be recognized as from a trusted source.
Note that retrieving the sources by e.g. wget -r or svn export from that URL will not work
(and will give a error early in the make process): the Subversion information is needed to build
R.
The Subversion repository does not contain the current sources for the recommended pack-
ages, which can be obtained by rsync or downloaded from CRAN. To use rsync to install the
appropriate sources for the recommended packages, run ./tools/rsync-recommended from the
top-level directory of the R sources.
If downloading manually from CRAN, do ensure that you have the correct versions of
the recommended packages: if the number in the file VERSION is ‘x.y.z’ you need to
download the contents of ‘https://CRAN.R-project.org/src/contrib/dir’, where dir is
‘x.y.z/Recommended’ for r-devel or x.y-patched/Recommended for r-patched, respectively, to
directory src/library/Recommended in the sources you have unpacked. After downloading
manually you need to execute tools/link-recommended from the top level of the sources to
make the requisite links in src/library/Recommended. A suitable incantation from the top
level of the R sources using wget might be (for the correct value of dir)
wget -r -l1 --no-parent -A\*.gz -nd -P src/library/Recommended \
https://CRAN.R-project.org/src/contrib/dir
./tools/link-recommended
2
for some Subversion clients ‘http:’ may appear to work, but requires continual redirection.
3
If the configure and make commands execute successfully, a shell-script front-end called R
will be created and copied to R_HOME/bin. You can link or 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 2.4 [Installation], page 6. Note:
you do not need to install R: you can run it from where it was built.
You do not necessarily have to build R in the top-level source directory (say, TOP_SRCDIR).
To build in BUILDDIR, run
cd BUILDDIR
TOP_SRCDIR/configure
make
and so on, as described further below. This has the advantage of always keeping your source
tree clean and is particularly recommended when you work with a version of R from Subversion.
(You may need GNU make to allow this, and you will need no spaces in the path to the build
directory. It is unlikely to work if the source directory has previously been used for a build.)
Now rehash if necessary, type R, and read the R manuals and the R FAQ (files FAQ or
doc/manual/R-FAQ.html, or https: / / CRAN . R-project . org / doc / FAQ / R-FAQ . html which
always has the version for the latest release of R).
Note: if you already have R installed, check that where you installed R replaces or comes
earlier in your path than the previous installation. Some systems are set up to have /usr/bin
(the standard place for a system installation) ahead of /usr/local/bin (the default place for
installation of R) in their default path, and some do not have /usr/local/bin on the default
path.
There are three fonts for which it will need to use bitmapped fonts, tctt0900.600pk,
tctt1000.600pk and tcrm1000.600pk. Unfortunately, if those files are not avail-
able, Acrobat Reader will substitute completely incorrect glyphs so you need to
examine the logs carefully.
The default can be overridden by setting the environment variable R_RD4PDF. (On Unix-
alikes, this will be picked up at install time and stored in etc/Renviron, but can still be
overridden when the manuals are built, using make -e.) The usual4 default value for R_RD4PDF
is ‘times,inconsolata,hyper’: omit ‘hyper’ if you do not want hyperlinks (e.g. for printing
the manual) or do not have LATEX package hyperref, and omit ‘inconsolata’ if you do not have
LATEX package inconsolata installed.
Further options, e.g for hyperref, can be included in a file Rd.cfg somewhere on your LATEX
search path. For example, if you prefer to hyperlink the text and not the page number in the
table of contents use
\ifthenelse{\boolean{Rd@use@hyper}}{\hypersetup{linktoc=section}}{}
or
\ifthenelse{\boolean{Rd@use@hyper}}{\hypersetup{linktoc=all}}{}
to hyperlink both text and page number.
Ebook versions of most of the manuals in one or both of .epub and .mobi formats can be
made by running in doc/manual one of
make ebooks
make epub
make mobi
This requires ebook-convert from Calibre (http://calibre-ebook.com/download), or from
most Linux distributions. If necessary the path to ebook-convert can be set as make macro
EBOOK to by editing doc/manual/Makefile (which contains a commented value suitable for
macOS) or using make -e.
2.4 Installation
To ensure that the installed tree is usable by the right group of users, set umask appropriately
(perhaps to ‘022’) before unpacking the sources and throughout the build process.
After
./configure
make
make check
(or, when building outside the source, TOP_SRCDIR/configure, etc) have been completed suc-
cessfully, you can install the complete R tree to your system by typing
make install
A parallel make can be used (but run make before make install). Those using GNU make 4.0
or later may want to use make -j n -O to avoid interleaving of output.
This will install to the following directories:
prefix/bin or bindir
the front-end shell script and other scripts and executables
prefix/man/man1 or mandir/man1
the man page
4
on a Unix-alike, ‘inconsolata’ is omitted if not found by configure.
Chapter 2: Installing R under Unix-alikes 7
prefix/LIBnn/R or libdir/R
all the rest (libraries, on-line help system, . . . ). Here LIBnn is usually ‘lib’, but may
be ‘lib64’ on some 64-bit Linux systems. This is known as the R home directory.
where prefix is determined during configuration (typically /usr/local) and can be set by run-
ning configure with the option --prefix, as in
./configure --prefix=/where/you/want/R/to/go
where the value should be an absolute path. This causes make install to install the R script
to /where/you/want/R/to/go/bin, and so on. The prefix of the installation directories can be
seen in the status message that is displayed at the end of configure. The installation may need
to be done by the owner of prefix, often a root account.
There is the option of using make install-strip (see Section 2.7.1 [Debugging Symbols],
page 10).
You can install into another directory tree by using
make prefix=/path/to/here install
at least with GNU make (but not some other Unix makes).
More precise control is available at configure time via options: see configure --help for
details. (However, most of the ‘Fine tuning of the installation directories’ options are not used
by R.)
Configure options --bindir and --mandir are supported and govern where a copy of the R
script and the man page are installed.
The configure option --libdir controls where the main R files are installed: the default
is ‘eprefix/LIBnn’, where eprefix is the prefix used for installing architecture-dependent files,
defaults to prefix, and can be set via the configure option --exec-prefix.
Each of bindir, mandir and libdir can also be specified on the make install command
line (at least for GNU make).
The configure or make variables rdocdir and rsharedir can be used to install the system-
independent doc and share directories to somewhere other than libdir. The C header files
can be installed to the value of rincludedir: note that as the headers are not installed into a
subdirectory you probably want something like rincludedir=/usr/local/include/R-3.6.1.
If you want the R home to be something other than libdir/R, use rhome: for example
make install rhome=/usr/local/lib64/R-3.6.1
will use a version-specific R home on a non-Debian Linux 64-bit system.
If you have made R as a shared/static library you can install it in your system’s library
directory by
make prefix=/path/to/here install-libR
where prefix is optional, and libdir will give more precise control.5 However, you should not
install to a directory mentioned in LDPATHS (e.g. /usr/local/lib64) if you intend to work with
multiple versions of R, since that directory may be given precedence over the lib directory of
other R installations.
make install-strip
will install stripped executables, and on platforms where this is supported, stripped libraries in
directories lib and modules and in the standard packages.
Note that installing R into a directory whose path contains spaces is not supported, and
some aspects (such as installing source packages) will not work.
5
This will be needed if more than one sub-architecture is to be installed.
Chapter 2: Installing R under Unix-alikes 8
To install info and PDF versions of the manuals, use one or both of
make install-info
make install-pdf
Once again, it is optional to specify prefix, libdir or rhome (the PDF manuals are installed
under the R home directory). (make install-info needs Perl installed if there is no command
install-info on the system.)
More precise control is possible. For info, the setting used is that of infodir (default
prefix/info, set by configure option --infodir). The PDF files are installed into the R
doc tree, set by the make variable rdocdir.
A staged installation is possible, that it is installing R into a temporary directory in order to
move the installed tree to its final destination. In this case prefix (and so on) should reflect the
final destination, and DESTDIR should be used: see https://www.gnu.org/prep/standards/
html_node/DESTDIR.html.
You can optionally install the run-time tests that are part of make check-all by
make install-tests
which populates a tests directory in the installation.
2.5 Uninstallation
You can uninstall R by
make uninstall
optionally specifying prefix etc in the same way as specified for installation.
This will also uninstall any installed manuals. There are specific targets to uninstall info and
PDF manuals in file doc/manual/Makefile.
Target uninstall-tests will uninstall any installed tests, as well as removing the directory
tests containing the test results.
An installed shared/static libR can be uninstalled by
make prefix=/path/to/here uninstall-libR
2.6 Sub-architectures
Some platforms can support closely related builds of R which can share all but the executables
and dynamic objects. Examples include builds under Linux and Solaris for different CPUs or
32- and 64-bit builds.
R supports the idea of architecture-specific builds, specified by adding ‘r_arch=name’ to the
configure line. Here name can be anything non-empty, and is used to name subdirectories of
lib, etc, include and the package libs subdirectories. Example names from other software
are the use of sparcv9 on Sparc Solaris and 32 by gcc on ‘x86_64’ Linux.
If you have two or more such builds you can install them over each other (and for 32/64-bit
builds on one architecture, one build can be done without ‘r_arch’). The space savings can be
considerable: on ‘x86_64’ Linux a basic install (without debugging symbols) took 74Mb, and
adding a 32-bit build added 6Mb. If you have installed multiple builds you can select which
build to run by
R --arch=name
and just running ‘R’ will run the last build that was installed.
R CMD INSTALL will detect if more than one build is installed and try to install packages with
the appropriate library objects for each. This will not be done if the package has an executable
configure script or a src/Makefile file. In such cases you can install for extra builds by
R --arch=name CMD INSTALL --libs-only pkg1 pkg2 ...
Chapter 2: Installing R under Unix-alikes 9
If you want to mix sub-architectures compiled on different platforms (for example ‘x86_64’
Linux and ‘i686’ Linux), it is wise to use explicit names for each, and you may also need to set
libdir to ensure that they install into the same place.
When sub-architectures are used the version of Rscript in e.g. /usr/bin will be the last
installed, but architecture-specific versions will be available in e.g. /usr/lib64/R/bin/exec${R_
ARCH}. Normally all installed architectures will run on the platform so the architecture of
Rscript itself does not matter. The executable Rscript will run the R script, and at that time
the setting of the R_ARCH environment variable determines the architecture which is run.
When running post-install tests with sub-architectures, use
R --arch=name CMD make check[-devel|all]
to select a sub-architecture to check.
Sub-architectures are also used on Windows, but by selecting executables within the ap-
propriate bin directory, R_HOME/bin/i386 or R_HOME/bin/x64. For backwards compatibility
there are executables R_HOME/bin/R.exe and R_HOME/bin/Rscript.exe: these will run an exe-
cutable from one of the subdirectories, which one being taken first from the R_ARCH environment
variable, then from the --arch command-line option6 and finally from the installation default
(which is 32-bit for a combined 32/64 bit R installation).
2.6.1 Multilib
For some Linux distributions7 , there is an alternative mechanism for mixing 32-bit and 64-bit
libraries known as multilib. If the Linux distribution supports multilib, then parallel builds of
R may be installed in the sub-directories lib (32-bit) and lib64 (64-bit). The build to be run
may then be selected using the setarch command. For example, a 32-bit build may be run by
setarch i686 R
The setarch command is only operational if both 32-bit and 64-bit builds are installed. If
there is only one installation of R, then this will always be run regardless of the architecture
specified by the setarch command.
There can be problems with installing packages on the non-native architecture. It is a good
idea to run e.g. setarch i686 R for sessions in which packages are to be installed, even if that
is the only version of R installed (since this tells the package installation code the architecture
needed).
There is a potential problem with packages using Java, as the post-install for a ‘i686’ RPM
on ‘x86_64’ Linux reconfigures Java and will find the ‘x86_64’ Java. If you know where a 32-bit
Java is installed you may be able to run (as root)
export JAVA_HOME=<path to jre directory of 32-bit Java>
setarch i686 R CMD javareconf
to get a suitable setting.
When this mechanism is used, the version of Rscript in e.g. /usr/bin will be the last
installed, but an architecture-specific version will be available in e.g. /usr/lib64/R/bin. Nor-
mally all installed architectures will run on the platform so the architecture of Rscript does
not matter.
One that may be useful when working on R itself is the option --disable-byte-compiled-
packages, which ensures that the base and recommended packages are not byte-compiled. (Al-
ternatively the (make or environment) variable R_NO_BASE_COMPILE can be set to a non-empty
value for the duration of the build.)
Option --with-internal-tzcode makes use of R’s own code and copy of the Olson data-
base for managing timezones. This will be preferred where there are issues with the system
implementation, usually involving times after 2037 or before 1916. An alternative time-zone
directory8 can be used, pointed to by environment variable TZDIR: this should contain files
such as Europe/London. On all tested OSes the system timezone was deduced correctly, but if
necessary it can be set as the value of environment variable TZ.
8
How to prepare such a directory is described in file src/extra/tzone/Notes in the R sources.
9
for example, -fopenmp, -xopenmp or -qopenmp. This includes for clang and the Intel and Oracle compilers.
10
This does not necessarily disable use of OpenMP – the configure code allows for platforms where OpenMP
is used without a flag. For the flang compiler in late 2017, the Fortran runtime always used OpenMP.
Chapter 2: Installing R under Unix-alikes 11
CXX98
CXX98STD
CXX98FLAGS
CXX98PICFLAGS
CXX11
CXX11STD
CXX11FLAGS
CXX11PICFLAGS
CXX14
CXX14STD
CXX14FLAGS
CXX14PICFLAGS
CXX17
CXX17STD
CXX17FLAGS
CXX17PICFLAGS
The macros CXX etc are those used by default for C++ code. configure will attempt to set
the rest suitably, choosing for CXX11STD a suitable flag such as -std=c++11 for C++11 support.
Similarly, configure will if possible choose for CXX14STD a flag11 such as -std=c++14 for C++14
support and -std=c++17 or -std=c++1z for support for the C++17 standard. The inferred values
can be overridden in file config.site or on the configure command line: user-supplied values
will be tested by compiling some C++11/14/17 code.
R versions 3.1.0 to 3.3.3 used CXX1X rather than CXX11: these forms were deprecated in 3.4.4
and removed in 3.6.0.
It may be12 that there is no suitable flag for C++11 support, in which case a different compiler
could be selected for CXX11 and its corresponding flags. Likewise, a different compiler can be
specified for C++14 support with CXX14 and for C++17 support with CXX17. Some compilers13
by default assume a later standard than C++98 whereas the latter has been assumed by some
packages. So users of GCC 6 might like to specify
CXX=’g++ -std=gnu++98’
CXX11=g++
CXX11STD=’-std=c++11’
CXX14=g++
CXX14STD=’-std=c++14’
11
Currently this is a valid option for g++ 5 and later and 2016 versions of the Intel and Solaris compilers. For
earlier versions of g++ one could try -std=c++1y.
12
This is true for earlier versions of g++ such as 4.2.1, and also for earlier versions of the Solaris compiler CC.
13
Currently only GCC and clang++ versions 6 and later.
Chapter 2: Installing R under Unix-alikes 12
The -std flag is supported by the GCC, clang++, Intel and Solaris compilers (the latter from
version 12.4). Currently accepted values are (plus some synonyms)
g++: c++98 gnu++98 c++11 gnu+11 c++14 gnu++14 c++17 gnu++17
Intel: gnu+98 c++11 c++14 (from 16.0) c++17 (from 17.0)
Solaris: c++03 c++11 c++14 (from 12.5)
(Those for clang++ are not documented, but seem to be based on g++.) Versions 4.3.x to 4.8.x of
g++ accepted flag -std=c++0x with partial support14 for C++11: this is currently still accepted
as a deprecated synonym for -std=c++11. (At least for versions 4.8.x it has sufficient support
to be picked by configure.) Option -std=c++14 was introduced in version 5.x.
‘Standards’ for g++ starting with ‘gnu’ enable ‘GNU extensions’: what those are is hard to
track down.
For the use of C++11 and later in R packages see the ‘Writing R Extensions’ manual. Prior
to R 3.6.0 the default C++ standard was that of the compiler used: currently it is C++11 if
supported by the compiler: this can be overridden by setting ‘CXXSTD’ when R is configured, for
example to ‘-std=gnu++14’.
If this has been done, two testing routes are available. The first is to move to the home
directory of the R installation (as given by R RHOME or from R as R.home()) and run
cd tests
## followed by one of
../bin/R CMD make check
../bin/R CMD make check-devel
../bin/R CMD make check-all
and other useful targets are test-BasePackages and test-Recommended to run tests of the
standard and recommended packages (if installed) respectively.
This re-runs all the tests relevant to the installed R (including for example the code in the
package vignettes), but not for example the ones checking the example code in the manuals
nor making the standalone Rmath library. This can occasionally be useful when the operating
environment has been changed, for example by OS updates or by substituting the BLAS (see
Section A.3.1.4 [Shared BLAS], page 47).
Parallel checking of packages may be possible: set the environment variable TEST_MC_CORES
to the maximum number of processes to be run in parallel. This affects both checking the
package examples (part of make check) and package sources (part of make check-devel and
make check-recommended). It does require a make command which supports the make -j n
option: most do but on Solaris you need to select GNU make or dmake.
Alternatively, the installed R can be run, preferably with --vanilla. Then
Sys.setenv(LC_COLLATE = "C", LC_TIME = "C", LANGUAGE = "en")
tools::testInstalledBasic("both")
tools::testInstalledPackages(scope = "base")
tools::testInstalledPackages(scope = "recommended")
runs the basic tests and then all the tests on the standard and recommended packages. These
tests can be run from anywhere: the basic tests write their results in the tests folder of the R
home directory and run fewer tests than the first approach: in particular they do not test things
which need Internet access—that can be tested by
tools::testInstalledBasic("internet")
These tests work best if diff (in Rtools*.exe for Windows users) is in the path.
It is possible to test the installed packages (but not their package-specific tests) by
testInstalledPackages even if make install-tests was not run.
Note that the results may depend on the language set for times and messages: for maximal
similarity to reference results you may want to try setting (before starting the R session)
LANGUAGE=en
and use a UTF-8 or Latin-1 locale.
14
to create the source tree in R HOME. Beware: do use tar to extract the sources rather
than tools such as WinZip. If you are using an account with administrative privileges you
may get a lot of messages which can be suppressed by
tar --no-same-owner -xf R-3.6.1.tar.gz
or perhaps better, set the environment variable TAR_OPTIONS to the value
‘--no-same-owner --no-same-permissions’.
It is also possible to obtain the source code using Subversion; see Chapter 1 [Obtaining R],
page 1, for details.
• If you are not using a tarball you need to obtain copies of the recommended packages
from CRAN. Put the .tar.gz files in R_HOME/src/library/Recommended and run make
link-recommended. If you have an Internet connection, you can do this automatically by
running in R_HOME/src/gnuwin32
make rsync-recommended
• The binary distributions of external software. Download
https://www.stats.ox.ac.uk/pub/Rtools/goodies/multilib/local323.zip
(or a more recent version if appropriate), create an empty directory, say c:/R/extsoft,
and unpack it in that directory by e.g.
unzip local323.zip -d c:/R/extsoft
• Make a local copy of the configuration rules by
cd R_HOME/src/gnuwin32
cp MkRules.dist MkRules.local
and edit MkRules.local, uncommenting EXT_LIBS and setting it to the appropriate path
(in our example c:/R/extsoft).
Look through the file MkRules.local and make any other changes needed: in particular,
this is where a 64-bit build is selected and the locations are set of external software for ICU
collation and the cairo-based devices.
The following additional item is normally installed by Rtools*.exe. If instead you choose
to do a completely manual build you will also need
• The Tcl/Tk support files are contained in Rtools*.exe. Please make sure you install the
right version: there is a 32-bit version and a 64-bit version. They should be installed to
R_HOME, creating directory Tcl there.
force a lot of computation even if all files are up to date.) The first four targets are the default
build if just make (or make all) is run.
Parallel make is not supported and likely to fail.
If you want to customize the installation by adding extra packages, replace make rinstaller
by something like
make rinstaller EXTRA_PKGS=’pkg1 pkg2 pkg3’
An alternative way to customize the installer starting with a binary distribution is to first
make an installation of R from the standard installer, then add packages and make other
customizations to that installation. Then (after having customized file MkRules, possibly via
MkRules.local, and having made R in the source tree) in src/gnuwin32/installer run
make myR IMAGEDIR=rootdir
where rootdir is the path to the root of the customized installation (in double quotes if it
contains spaces or backslashes).
Both methods create an executable with a standard name such as R-3.6.1-win.exe, so
please rename it to indicate that it is customized. If you intend to distribute a customized
installer please do check that license requirements are met – note that the installer will state
that the contents are distributed under GPL and this has a requirement for you to supply the
complete sources (including the R sources even if you started with a binary distribution of R, and
also the sources of any extra packages (including their external software) which are included).
The defaults for the startup parameters may also be customized. For example
make myR IMAGEDIR=rootdir MDISDI=1
will create an installer that defaults to installing R to run in SDI mode. See src/
gnuwin32/installer/Makefile for the names and values that can be set.
The standard CRAN distribution of a 32/64-bit installer is made by first building 32-bit R
(just
make 32-bit
is needed), and then (in a separate directory) building 64-bit R with the macro HOME32 set in file
MkRules.local to the top-level directory of the 32-bit build. Then the make rinstaller step
copies the files that differ between architectures from the 32-bit build as it builds the installer
image.
(the path to the ‘R’ folder on the start menu) and ‘STARTDIR’ (the starting directory for R
shortcuts, defaulting to something like c:\Users\name\Documents\R).
The MSI installer can be built both from a 32-bit build of R (R-3.6.1-win32.msi) and from
a 64-bit build of R (R-3.6.1-win64.msi, optionally including 32-bit files by setting the macro
HOME32, when the name is R-3.6.1-win.msi). Unlike the main installer, a 64-bit MSI installer
can only be run on 64-bit Windows.
Thanks to David del Campo (Dept of Statistics, University of Oxford) for suggesting WiX
and building a prototype installer.
However, R.app will always run the ‘current’ version, that is the last installed version. A small
utility, Rswitch.app (available at https: / / mac . R-project . org / # other), can be used to
change the ‘current’ version. This is of limited use as R.app is compiled against a particular
version of R and will likely crash if switched to an earlier version. This may allow you to install
a development version of R (de-selecting R.app) and then switch back to the release version.
23
5 Running R
How to start R and what command-line options are available is discussed in Section “Invoking
R” in An Introduction to R.
You should ensure that the shell has set adequate resource limits: R expects a stack size
of at least 8MB and to be able to open at least 256 file descriptors. (Any modern OS should
have default limits at least as large as these, but apparently NetBSD may not. Use the shell
command ulimit (sh/bash) or limit (csh/tcsh) to check.) For some compilers1 and packages
a larger stack size has been needed: 20-25MB has sufficed to date.
R makes use of a number of environment variables, the default values of many of which are
set in file R_HOME/etc/Renviron (there are none set by default on Windows and hence no such
file). These are set at configure time, and you would not normally want to change them – a
possible exception is R_PAPERSIZE (see Section B.3.1 [Setting paper size], page 51). The paper
size will be deduced from the ‘LC_PAPER’ locale category if it exists and R_PAPERSIZE is unset,
and this will normally produce the right choice from ‘a4’ and ‘letter’ on modern Unix-alikes
(but can always be overridden by setting R_PAPERSIZE).
Various environment variables can be set to determine where R creates its per-session tem-
porary directory. The environment variables TMPDIR, TMP and TEMP are searched in turn and the
first one which is set and points to a writable area is used. If none do, the final default is /tmp
on Unix-alikes and the value of R_USER on Windows. The path should be an absolute path not
containing spaces (and it is best to avoid non-alphanumeric characters such as +).
Some Unix-alike systems are set up to remove files and directories periodically from /tmp,
for example by a cron job running tmpwatch. Set TMPDIR to another directory before starting
long-running jobs on such a system.
Note that TMPDIR will be used to execute configure scripts when installing packages, so if
/tmp has been mounted as ‘noexec’, TMPDIR needs to be set to a directory from which execution
is allowed.
1
The Oracle compilers on Solaris (where the issue is parsing very complex R expressions) and pre-releases of
GCC 9 on Linux.
24
6 Add-on packages
It is helpful to use the correct terminology. A package is loaded from a library by the function
library(). Thus a library is a directory containing installed packages; the main library is
R_HOME/library, but others can be used, for example by setting the environment variable R_
LIBS or using the R function .libPaths(). To avoid any confusion you will often see a library
directory referred to as a ‘library tree’.
Ensure that the environment variable TMPDIR is either unset (and /tmp exists and can be writ-
ten in and executed from) or is the absolute path to a valid temporary directory, not containing
spaces.
For most users it suffices to call ‘install.packages(pkgname)’ or its GUI equivalent if
the intention is to install a CRAN package and internet access is available.3 On most systems
‘install.packages()’ will allow packages to be selected from a list box (typically with thou-
sands of items).
To install packages from source on a Unix-alike use in a terminal
R CMD INSTALL -l /path/to/library pkg1 pkg2 ...
The part ‘-l /path/to/library’ can be omitted, in which case the first library of a normal R
session is used (that shown by .libPaths()[1]).
There are a number of options available: use R CMD INSTALL --help to see the current list.
Alternatively, packages can be downloaded and installed from within R. First choose your
nearest CRAN mirror using chooseCRANmirror(). Then download and install packages pkg1
and pkg2 by
> install.packages(c("pkg1", "pkg2"))
The essential dependencies of the specified packages will also be fetched. Unless the library
is specified (argument lib) the first library in the library search path is used: if this is not
writable, R will ask the user (in an interactive session) if the default personal library should be
created, and if allowed to will install the packages there.
If you want to fetch a package and all those it depends on (in any way) that are not already
installed, use e.g.
> install.packages("Rcmdr", dependencies = TRUE)
install.packages can install a source package from a local .tar.gz file (or a URL to such
a file) by setting argument repos to NULL: this will be selected automatically if the name given
is a single .tar.gz file.
install.packages can look in several repositories, specified as a character vector by the
argument repos: these can include a CRAN mirror, Bioconductor, R-forge, rforge.net, local
archives, local files, . . . ). Function setRepositories() can select amongst those repositories
that the R installation is aware of.
Naive users sometimes forget that as well as installing a package, they have to use library
to make its functionality available.
6.3.1 Windows
What install.packages does by default is different on Unix-alikes (except macOS) and Win-
dows. On Unix-alikes it consults the list of available source packages on CRAN (or other repos-
itory/ies), downloads the latest version of the package sources, and installs them (via R CMD
INSTALL). On Windows it looks (by default) first at the list of binary versions of packages
available for your version of R and downloads the latest versions (if any). If no binary version
is available or the source version is newer, it will install the source versions of packages without
compiled C/C++/Fortran code, and offer to do so for those with, if make is available (and this
can be tuned by option "install.packages.compile.from.source").
On Windows install.packages can also install a binary package from a local zip file (or
the URL of such a file) by setting argument repos to NULL. Rgui.exe has a menu Packages
with a GUI interface to install.packages, update.packages and library.
Windows binary packages for R are distributed as a single binary containing either or both
architectures (32- and 64-bit).
3
If a proxy needs to be set, see ?download.file.
Chapter 6: Add-on packages 26
A few of the binary packages need other software to be installed on your system: see for exam-
ple https://CRAN.R-project.org/bin/windows/contrib/3.2/@ReadMe. Packages using Gtk+
(Cairo (https://CRAN.R-project.org/package=Cairo), RGtk2 (https://CRAN.R-project.
org/package=RGtk2), cairoDevice (https://CRAN.R-project.org/package=cairoDevice)
and those that depend on them) need the bin directory of a bundled distribution of Gtk2 from
http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+ or http://ftp.gnome.org/pub/
gnome/binaries/win64/gtk+ in the path: it should work to have both 32- and 64-bit Gtk+
bin directories in the path on a 64-bit version of R.
R CMD INSTALL works in Windows to install source packages. No additional tools are needed if
the package does not contain compiled code, and install.packages(type="source") will work
for such packages (and for those with compiled code if the tools (see Appendix D [The Windows
toolset], page 69) are on the path, and the variables BINPREF and BINPREF64 are set properly;
see the discussion below). We have seen occasional permission problems after unpacking source
packages on some systems: these have been circumvented by setting the environment variable
R_INSTALL_TAR to ‘tar.exe’.
If you have only a source package that is known to work with current R and just want a
binary Windows build of it, you could make use of the building service offered at https://
win-builder.r-project.org/.
For almost all packages R CMD INSTALL will attempt to install both 32- and 64-bit builds of
a package if run from a 32/64-bit install of R. It will report success if the installation of the
architecture of the running R succeeded, whether or not the other architecture was successfully
installed. The exceptions are packages with a non-empty configure.win script or which make
use of src/Makefile.win. If configure.win does something appropriate to both architectures
use4 option --force-biarch: otherwise R CMD INSTALL --merge-multiarch can be applied to
a source tarball to merge separate 32- and 64-bit installs. (This can only be applied to a tarball,
and will only succeed if both installs succeed.)
If you have a package without compiled code and no Windows-specific help, you can zip
up an installation on another OS and install from that zip file on Windows. However, such a
package can be installed from the sources on Windows without any additional tools.
Packages with compiled code may need to have paths to the compilers set explicitly, and there
is provision to make use of a system-wide library of installed external software. The compiler
paths are set using the make variables BINPREF and (usually) BINPREF64. The library location
is set using make variable LOCAL_SOFT, to give an equivalent of /usr/local on a Unix-alike. All
of these can be set in src/gnuwin32/MkRules.local when R is built from sources (see the com-
ments in src/gnuwin32/MkRules.dist), or in file5 etc/i386/Makeconf or etc/x64/Makeconf
for an installed version of R. In the latter case only BINPREF is used, with the 64 bit path used
in etc/x64/Makeconf. The version used by CRAN can be installed as described in Section 3.1
[Building from source], page 14.
6.3.2 macOS
On macOS (formerly OS X) install.packages works as it does on other Unix-alike systems, but
there are additional types starting with mac.binary (available for the CRAN distribution but not
when compiling R from source: mac.binary.el-capitan for an ‘El Capitan and later’ build with
"default" a synonym for the appropriate variant) which can be passed to install.packages in
order to download and install binary packages from a suitable repository. These binary package
files for macOS have the extension ‘.tgz’. The R.app GUI provides menus for installation of
either binary or source packages, from CRAN or local files.
4
for a small number of CRAN packages where this is known to be safe and is needed by the autobuilder this
is the default. Look at the source of tools:::.install_packages for the list. It can also be specified in the
package’s DESCRIPTION file.
5
or by adding it in a file such as etc/i386/Makevars.site, which does not exist by default.
Chapter 6: Add-on packages 27
On R builds using binary packages, the default is type both: this looks first at the list of
binary packages available for your version of R and installs the latest versions (if any). If no
binary version is available or the source version is newer, it will install the source versions of
packages without compiled C/C++/Fortran code and offer to do so for those with, if make is
available.
Note that most binary packages which include compiled code are tied to a particular series
(e.g. R 3.6.x or 3.5.x) of R.
Installing source packages which do not contain compiled code should work with no additional
tools. For others you will need the ‘Command Line Tools’ for Xcode and compilers which match
those used to build R: see Section C.3 [macOS], page 59.
Package rJava (https://CRAN.R-project.org/package=rJava) and those which depend on
it need a Java runtime installed and several packages need X11 installed, including those using
Tk. See Section C.3 [macOS], page 59, and Section C.3.2 [Java (macOS)], page 62.
Tcl/Tk extensions BWidget and Tktable are part of the Tcl/Tk contained in the R installer.
These are required by a number of CRAN and Bioconductor packages.
A few of the binary packages need other software to be installed on your system. In particular
packages using Gtk+ (RGtk2 (https://CRAN.R-project.org/package=RGtk2), cairoDevice
(https://CRAN.R-project.org/package=cairoDevice) and those that depend on them) need
the GTK framework installed from https: / / mac . R-project . org / libs / : the appropriate
version at the time of writing was https://mac.R-project.org/libs/GTK_2.24.17-X11.pkg
The default compilers specified are shown in file /Library/Frameworks/R.framework/
Resources/etc/Makeconf. At the time of writing these setting assumed that the C, Fortran
and C++ compilers were on the path, using gfortran 6.1.0 (see Section C.3 [macOS], page 59).
The settings can be changed, either by editing that file or in a file such as ~/.R/Makevars
(see the next section). Entries which may need to be changed include ‘CC’, ‘CXX’, ‘FC’, ‘FLIBS’
and the corresponding flags, and perhaps ‘CXXCPP’, ‘DYLIB_LD’, ‘MAIN_LD’, ‘SHLIB_CXXLD’ and
‘SHLIB_LD’, as well as the ‘CXX11’, ‘CXX14’ and ‘CXX17’ variants
So for example you could select a specific build of clang for both C and C++ with extensive
checking by having in ~/.R/Makevars
CC = /usr/local/clang7/bin/clang
CXX = /usr/local/clang7/bin/clang++
CFLAGS = -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion
CXXFLAGS = -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion
CXX11 = $CXX
CXX14 = $CXX
CXX17 = $CXX
and the Sierra build of gfortran by
FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin16/6.3.0
-L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
(line split for legibility here).
If using the C/C++ compilers from the Command Line Tools (which do not have OpenMP
support) one will need to include
SHLIB_OPENMP_CFLAGS =
SHLIB_OPENMP_CXXFLAGS =
to compile OpenMP-using packages.
Apple includes many Open Source libraries in macOS but increasingly without the corre-
sponding headers (not even in Xcode nor the Command Line Tools): they are often rather
Chapter 6: Add-on packages 28
old versions. If installing packages from source using them it is usually easiest to install a
statically-linked up-to-date copy of the Open Source package from its sources or from https://
mac.R-project.org/libs. But sometimes it is desirable/necessary to use Apple’s dynamically
linked library, in which case appropriate headers could be extracted from the sources6 available
via https://opensource.apple.com.
Unix-alikes
where there is an configure script, or a file src/Makefile.
Windows
where there is a non-empty configure.win script, or a file src/Makefile.win (with
some exceptions where the package is known to have an architecture-independent
configure.win, or if --force-biarch or field ‘Biarch’ in the DESCRIPTION file is
used to assert so).
In those cases only the current architecture is installed. Further sub-architectures can be in-
stalled by
R CMD INSTALL --libs-only pkg
using the path to R or R --arch to select the additional sub-architecture. There is also R CMD
INSTALL --merge-multiarch to build and merge the two architectures, starting with a source
tarball.
6.3.5 Byte-compilation
As from R 3.6.0, all packages are by default byte-compiled.
Byte-compilation can be controlled on a per-package basis by the ‘ByteCompile’ field in the
DESCRIPTION file.
the DLLs the package links to (and any those DLLs link to) on the PATH. 64-bit versions of
Windows will ignore 32-bit DLLs from 64-bit R and vice versa.
The danger with any of the methods which involve setting environment variables is of in-
advertently masking a system library. This is less for DYLD_FALLBACK_LIBRARY_PATH and for
appending to PATH on Windows (as it should already contain the system library paths).
7.1 Locales
A locale is a description of the local environment of the user, including the preferred language,
the encoding of characters, the currency used and its conventions, and so on. Aspects of the
locale are accessed by the R functions Sys.getlocale and Sys.localeconv.
The system of naming locales is OS-specific. There is quite wide agreement on schemes, but
not on the details of their implementation. A locale needs to specify
• A human language. These are generally specified by a lower-case two-character abbreviation
following ISO 639 (see e.g. https://en.wikipedia.org/wiki/ISO_639-1).
• A ‘territory’, used mainly to specify the currency. These are generally specified by an upper-
case two-character abbreviation following ISO 3166 (see e.g. https://en.wikipedia.org/
wiki/ISO_3166).
• A charset encoding, which determines both how a byte stream should be divided into charac-
ters, and which characters the subsequences of bytes represent. Sometimes the combination
of language and territory is used to specify the encoding, for example to distinguish between
traditional and simplified Chinese.
• Optionally, a modifier, for example to indicate that Austria is to be considered pre- or
post-Euro. The modifier is also used to indicate the script (@latin, @cyrillic for Serbian,
@iqtelif) or language dialect (e.g. @saaho, a dialect of Afar, and @bokmal and @nynorsk,
dialects of Norwegian regarded by some OSes as separate languages, no and nn).
R is principally concerned with the first (for translations) and third. Note that the charset
may be deducible from the language, as some OSes offer only one charset per language.
standard messages into English.4 Two other examples: there are catalogues for ‘es’, which is
Spanish as written in Spain and these will by default also be used in Spanish-speaking Latin
American countries, and also for ‘pt_BR’, which are used for Brazilian locales but not for locales
specifying Portugal.
Translations in the right language but the wrong charset are made use of by on-the-fly re-
encoding. The LANGUAGE variable (only) can be a colon-separated list, for example ‘se:de’,
giving a set of languages in decreasing order of preference. One special value is ‘en@quot’, which
can be used in a UTF-8 locale to have American error messages with pairs of single quotes
translated to Unicode directional quotes.
If no suitable translation catalogue is found or a particular message is not translated in any
suitable catalogue, ‘English’5 is used.
See https://developer.r-project.org/Translations30.html for how to prepare and
install translation catalogues.
4
the language written in England: some people living in the USA appropriate this name for their language.
5
with Americanisms.
35
1
also known as IEEE 754
2
at least when storing quantities: the on-FPU precision is allowed to vary
36
9.1 Unix-alikes
If R has not already been made in the directory tree, configure must be run as described in
the main build instructions.
Then (in src/nmath/standalone)
make
will make standalone libraries libRmath.a and libRmath.so (libRmath.dylib on macOS):
‘make static’ and ‘make shared’ will create just one of them.
To use the routines in your own C or C++ programs, include
#define MATHLIB_STANDALONE
1
e.g. Bessel, beta and gamma functions
Chapter 9: The standalone Rmath library 37
#include <Rmath.h>
and link against ‘-lRmath’ (and ‘-lm’ if needed on your OS). The example file test.c does
nothing useful, but is provided to test the process (via make test). Note that you will probably
not be able to run it unless you add the directory containing libRmath.so to the LD_LIBRARY_
PATH environment variable (libRmath.dylib, DYLD_FALLBACK_LIBRARY_PATH on macOS).
The targets
make install
make uninstall
will (un)install the header Rmath.h and shared and static libraries (if built). Both prefix= and
DESTDIR are supported, together with more precise control as described for the main build.
‘make install’ installs a file for pkg-config to use by e.g.
$(CC) ‘pkg-config --cflags libRmath‘ -c test.c
$(CC) ‘pkg-config --libs libRmath‘ test.o -o test
On some systems ‘make install-strip’ will install a stripped shared library.
9.2 Windows
You need to set up2 almost all the tools to make R and then run (in a Unix-like shell)
(cd ../../gnuwin32; make MkRules)
(cd ../../include; make -f Makefile.win config.h Rconfig.h Rmath.h)
make -f Makefile.win
Alternatively, in a cmd.exe shell use
cd ../../include
make -f Makefile.win config.h Rconfig.h Rmath.h
cd ../nmath/standalone
make -f Makefile.win
This creates a static library libRmath.a and a DLL Rmath.dll. If you want an import
library libRmath.dll.a (you don’t need one), use
make -f Makefile.win shared implib
To use the routines in your own C or C++ programs using MinGW-w64, include
#define MATHLIB_STANDALONE
#include <Rmath.h>
and link against ‘-lRmath’. This will use the first found of libRmath.dll.a, libRmath.a and
Rmath.dll in that order, so the result depends on which files are present. You should be able
to force static or dynamic linking via
-Wl,-Bstatic -lRmath -Wl,Bdynamic
-Wl,-Bdynamic -lRmath
or by linking to explicit files (as in the ‘test’ target in Makefile.win: this makes two executa-
bles, test.exe which is dynamically linked, and test-static.exe, which is statically linked).
It is possible to link to Rmath.dll using other compilers, either directly or via an import
library: if you make a MinGW-w64 import library as above, you will create a file Rmath.def
which can be used (possibly after editing) to create an import library for other systems such as
Visual C++.
If you make use of dynamic linking you should use
#define MATHLIB_STANDALONE
#define RMATH_DLL
2
including copying MkRules.dist to MkRule.local and selecting the architecture.
38
#include <Rmath.h>
to ensure that the constants like NA_REAL are linked correctly. (Auto-import will probably work
with MinGW-w64, but it is better to be sure. This is likely to also work with VC++, Borland
and similar compilers.)
39
This appendix gives details of programs you will need to build R on Unix-like platforms, or
which will be used by R if found by configure.
Remember that some package management systems (such as RPM and Debian/Ubuntu’s)
make a distinction between the user version of a package and the development version. The
latter usually has the same name but with the extension ‘-devel’ or ‘-dev’: you need both
versions installed.
1
also known as IEEE 754
2
Note that C11 compilers need not be C99-compliant: R requires support for double complex and variable-
length arrays which are optional in C11 but are mandatory in C99. C18 (also known as C17) is a ‘bugfix
release’ of C11, clarifying the standard.
3
Examples are -std=gnu99, -std=c99 and -c99.
4
-std=c99 excludes POSIX functionality, but config.h will turn on all GNU extensions to include the POSIX
functionality for R itself: this does not apply to badly-written packages. The default mode for GCC 5.1 and
later is -std=gnu11, which currently includes the optional features R needs.
5
However, it is possible to break the default behaviour of glibc by re-specifying the gconv modules to be
loaded.
6
specifically, the C99 functionality of headers wchar.h and wctype.h, types wctans_t and mbstate_t and
functions mbrtowc, mbstowcs, wcrtomb, wcscoll, wcstombs, wctrans, wctype, and iswctype.
7
including expm1, hypot, log1p, nearbyint and va_copy.
8
including opendir, readdir, closedir, popen, stat, glob, access, getcwd and chdir system calls, select on
a Unix-alike, and either putenv or setenv.
9
such as realpath, symlink.
Appendix A: Essential and useful other programs under a Unix-alike 40
Installations of zlib (version 1.2.5 or later), libbz2 (version 1.0.6 or later: called bzip2-
libs/bzip2-devel or libbz2-1.0/libbz2-dev by some Linux distributions) and liblzma10 version
5.0.3 or later are required.
PCRE11 (version 8.32 or later, although versions 8.20–8.31 will be accepted with a deprecation
warning) is required (or just its library and headers if packaged separately). Only the ‘8-bit’
interface is used (and only that is built by default when installing from sources). PCRE must be
built with UTF-8 support (not the default, and checked by configure) and support for Unicode
properties is assumed by some R packages. JIT support (optionally available) is desirable for
the best performance: support for this and Unicode properties can be checked at run-time by
calling pcre_config(). If building PCRE for use with R a suitable configure command might
be
./configure --enable-utf --enable-unicode-properties --enable-jit --disable-cpp
The --enable-jit flag is supported for most common CPUs. (See also the comments for
Solaris.)
Library libcurl (version 7.22.0 or later12 ) is required, with at least 7.28.0 being desirable.
Information on libcurl is found from the curl-config script: if that is missing or needs to be
overridden13 there are macros to do so described in file config.site.
A tar program is needed to unpack the sources and packages (including the recommended
packages). A version14 that can automagically detect compressed archives is preferred for use
with untar(): the configure script looks for gtar and gnutar before tar – use environment
variable TAR to override this. (On NetBSD/OpenBSD systems set this to bsdtar if that is
installed.)
There need to be suitable versions of the tools grep and sed: the problems are usually with
old AT&T and BSD variants. configure will try to find suitable versions (including looking in
/usr/xpg4/bin which is used on some commercial Unixes).
You will not be able to build most of the manuals unless you have texi2any version 5.1 or
later installed, and if not most of the HTML manuals will be linked to a version on CRAN. To
make PDF versions of the manuals you will also need file texinfo.tex installed (which is part
of the GNU texinfo distribution but is often made part of the TEX package in re-distributions) as
well as texi2dvi.15 Further, the versions of texi2dvi and texinfo.tex need to be compatible:
we have seen problems with older TEX distributions.
If you want to build from the R Subversion repository then texi2any is highly recommended
as it is used to create files which are in the tarball but not stored in the Subversion repository.
The PDF documentation (including doc/NEWS.pdf) and building vignettes needs pdftex and
pdflatex. We require LATEX version 2005/12/01 or later (for UTF-8 support). Building PDF
package manuals (including the R reference manual) and vignettes is sensitive to the version of
the LATEX package hyperref and we recommend that the TEX distribution used is kept up-to-
date. A number of standard LATEX packages are required (including url and some of the font
packages such as times, helvetic, ec and cm-super) and others such as hyperref and inconsolata
10
most often distributed as part of xz: possible names in Linux distributions include xz-devel/xz-libs and
liblzma-dev.
11
sometimes known as PCRE1, and not PCRE2 which started at version 10.0.
12
but not a major version greater than 7 should there ever be one: the major version has been 7 since 2000.
13
for example to specify static linking with a build which has both shared and static libraries.
14
Such as GNU tar 1.15 or later, bsdtar (from https://github.com/libarchive/libarchive/, as used as tar
by FreeBSD and macOS 10.6 and later) or tar from the Heirloom Toolchest (http://heirloom.sourceforge.
net/tools.html), although the latter does not support xz compression.
15
texi2dvi is normally a shell script. Some versions (including that from texinfo 5.2 and 6.0) need to be run
under bash rather than a Bourne shell, especially on Solaris. Some of the issues which have been observed
with broken versions of texi2dvi can be circumvented by setting the environment variable R_TEXI2DVICMD to
the value emulation.
Appendix A: Essential and useful other programs under a Unix-alike 41
are desirable (and without them you may need to change R’s defaults: see Section 2.3 [Making
the manuals], page 4). Note that package hyperref (currently) requires packages kvoptions,
ltxcmds and refcount. For distributions based on TeX Live the simplest approach may be to
install collections collection-latex, collection-fontsrecommended, collection-latexrecommended,
collection-fontsextra and collection-latexextra (assuming they are not installed by default): Fe-
dora uses names like texlive-collection-fontsextra and Debian/Ubuntu like texlive-fonts-extra.
The essential programs should be in your PATH at the time configure is run: this will capture
the full paths.
Those distributing binary versions of R may need to be aware of the licences of the external
libraries it is linked to (including ‘useful’ libraries from the next section). The liblzma library
is in the public domain and X11, libbzip2, libcurl and zlib have MIT-style licences. PCRE
has a BSD-style licence which requires distribution of the licence (included in R’s COPYRIGHTS
file) in binary distributions. GNU readline is licensed under GPL (which version(s) depending
on the readline version).
jbig and jpeg12, none of which is required for the tiff() devices but may need to be present
to link the library (usually only an issue for static linking).
Option --with-system-tre is also available: it needs a recent version of TRE. (The latest
(2016) sources are in the git repository at https://github.com/laurikari/tre/, but at the
time of writing the resulting build will not pass its checks.).
An implementation of XDR is required, and the R sources contain one which is likely to
suffice (although a system version may have higher performance). XDR is part of RPC and
historically has been part of libc on a Unix-alike. (In principle man xdr_string should tell you
which library is needed, but it often does not: on Solaris and others it is provided by libnsl.)
However some builds19 of glibc omit or hide it with the intention that the TI-RPC library be
used, in which case libtirpc (and its development version) should be installed, and its headers20
need to be on the C include path or under /usr/include/tirpc.
Use of the X11 clipboard selection requires the Xmu headers and libraries. These are normally
part of an X11 installation (e.g. the Debian meta-package ‘xorg-dev’), but some distributions
have split this into smaller parts, so for example recent versions of Fedora require the ‘libXmu’
and ‘libXmu-devel’ RPMs.
Some systems (notably macOS and at least some FreeBSD systems) have inadequate support
for collation in multibyte locales. It is possible to replace the OS’s collation support by that
from ICU (International Components for Unicode, http://site.icu-project.org/), and this
provides much more precise control over collation on all systems. ICU is available as sources
and as binary distributions for (at least) most Linux distributions, Solaris, FreeBSD and AIX,
usually as libicu or icu4c. It will be used by default where available: should a very old or
broken version of ICU be found this can be suppressed by --without-ICU.
The bitmap and dev2bitmap devices and function embedFonts() use ghostscript (http://
www.ghostscript.com/). This should either be in your path when the command is run, or its
full path specified by the environment variable R_GSCMD at that time.
At the time of writing a full installation on Fedora Linux used the following packages and
their development versions, and this may provide a useful checklist for other systems:
bzip2 cairo fontconfig freetype fribidi glib2 libX11 libXext libXt
libcurl libicu libjpeg libpng libtiff libtirpc libxcrypt ncurses pango
pcre readline tcl tk xz zlib
A.2.1 Tcl/Tk
The tcltk package needs Tcl/Tk ≥ 8.4 installed: the sources are available at https://www.tcl.
tk/. To specify the locations of the Tcl/Tk files you may need the configuration options
--with-tcltk
use Tcl/Tk, or specify its library directory
--with-tcl-config=TCL_CONFIG
specify location of tclConfig.sh
--with-tk-config=TK_CONFIG
specify location of tkConfig.sh
or use the configure variables TCLTK_LIBS and TCLTK_CPPFLAGS to specify the flags needed for
linking against the Tcl and Tk libraries and for finding the tcl.h and tk.h headers, respectively.
If you have both 32- and 64-bit versions of Tcl/Tk installed, specifying the paths to the correct
config files may be necessary to avoid confusion between them.
19
This is the default as from glibc 2.26 and has been confirmed for Fedora 28, which does not mention this on
its man pages.
20
R uses rpc/xdr.h but that includes netconfig.h from the top tirpc directory.
Appendix A: Essential and useful other programs under a Unix-alike 43
Versions of Tcl/Tk up to 8.5.19 and 8.6.9 have been tested (including most versions of 8.4.x,
but not recently).
Note that the tk.h header includes21 X11 headers, so you will need X11 and its development
files installed.
21
This is true even for the ‘Aqua’ version of Tk on macOS, but distributions of that include a copy of the X11
files needed.
Appendix A: Essential and useful other programs under a Unix-alike 44
then all BLAS-using packages must also be. So if R is re-built to use an enhanced BLAS then
packages such as quantreg (https://CRAN.R-project.org/package=quantreg) will need to
be re-installed; they may be under other circumstances.
R relies on ISO/IEC 60559 compliance of an external BLAS. This can be broken if for
example the code assumes that terms with a zero factor are always zero and do not need to be
computed—whereas x*0 can be NaN. This is checked in the test suite.
External BLAS implementations often make less use of extended-precision floating-point reg-
isters (where available) and will almost certainly re-order computations. This can result in less
accuracy than using a reference BLAS, and may result in different solutions, e.g. different signs
in SVD and eigendecompositions.
Debian/Ubuntu systems provide a system-specific way to switch the BLAS in use.
Build R with -with-blas to select the OS version of the reference BLAS, and then use
update-alternatives to switch between the available BLAS libraries. See https://wiki.
debian.org/DebianScience/LinearAlgebraLibraries.
The URIs for several of these BLAS have been subject to frequent gratuitous changes, so you
will need to search for their current locations.
BLAS (and LAPACK) routines may be used inside threaded code, for example in OpenMP
sections in packages such as mgcv. The reference implementations are thread-safe but external
ones may not be (even single-threaded ones): this can lead to hard-to-track-down incorrect
results or segfaults.
A.3.1.1 ATLAS
ATLAS (http://math-atlas.sourceforge.net/) is a “tuned” BLAS that runs on a wide
range of Unix-alike platforms. Unfortunately it is built by default as a static library that on
some platforms may not be able to be used with shared objects such as are used in R packages.
Be careful when using pre-built versions of ATLAS static libraries (they seem to work on ‘ix86’
platforms, but not always on ‘x86_64’ ones).
ATLAS contains replacements for a small number of LAPACK routines, but can be built to
merge these with LAPACK sources to include a full LAPACK library.
Recent versions of ATLAS can be built as a single shared library, either libsatlas or
libtatlas (serial or threaded respectively): these may even contain a full LAPACK. Such
builds can be used by one of
--with-blas=satlas
--with-blas=tatlas
or, as on ‘x86_64’ Fedora where a path needs to be specified,
--with-blas="-L/usr/lib64/atlas -lsatlas"
--with-blas="-L/usr/lib64/atlas -ltatlas"
Distributed ATLAS libraries cannot be tuned to your machine and so are a compromise: for
example Fedora tunes ‘x86_64’ for CPUs with SSE3 extensions, and separate ‘atlas-sse2’ and
‘atlas-sse3’ ‘i686’ RPMs are available.24
Note that building R on Linux against distributed shared libraries may need ‘-devel’ or
‘-dev’ packages installed.
Linking against multiple static libraries requires one of
--with-blas="-lf77blas -latlas"
--with-blas="-lptf77blas -lpthread -latlas"
24
There were others for earlier versions of ATLAS, and are for non-Intel architectures. The only way to see
exactly which CPUs the distributed libraries have been tuned for is to read the atlas.spec file: at the time
of writing ‘HAMMER64SSE3’ and ‘Corei264AVX’ for ‘x86_64’ Fedora.
Appendix A: Essential and useful other programs under a Unix-alike 46
A.3.1.2 OpenBLAS
Dr Kazushige Goto wrote a tuned BLAS for several processors and OSes, which was frozen in
mid-2010. OpenBLAS (http://www.openblas.net/) is a descendant project with support for
some later CPUs.
This can be used by configuring R with something like
--with-blas="-lopenblas"
See see Section A.3.1.4 [Shared BLAS], page 47, for an alternative (and in many ways preferable)
way to use them.
Some platforms provide multiple builds of OpenBLAS: for example Fedora 28 has RPMs27
openblas
openblas-threads
openblas-openmp
providing shared libraries
libopenblas.so
libopenblasp.so
libopenblaso.so
respectively, each of which can be used as a shared BLAS. For the second and third the number of
threads is controlled by OPENBLAS_NUM_THREADS and OMP_NUM_THREADS (as usual for OpenMP)
respectively. There is also a Fedora RPM ‘openblas-Rblas’ to replace libRblas.so in their
distribution of R.
Note that building R on Linux against distributed libraries may need ‘-devel’ or ‘-dev’
packages installed.
For ‘ix86’ and ‘x86_64’ most distributed libraries contain several alternatives for different
CPU microarchitectures with the choice being made at run time.
run-time library path or ld.so cache). It can also be used for a single-library ATLAS, so on
‘x86_64’ Fedora
ln -s /usr/lib64/atlas/libsatlas.so.3 R_HOME/lib/libRblas.so
ln -s /usr/lib64/atlas/libtatlas.so.3 R_HOME/lib/libRblas.so
can be used with its distributed ATLAS libraries. (If you have the ‘-devel’ RPMS installed you
can omit the .0/.3.)
Note that rebuilding or symlinking libRblas.so may not suffice if the intention is to use
a modified LAPACK contained in an external BLAS: the latter could even cause conflicts.
However, on Fedora where the OpenBLAS distribution contains a copy of LAPACK, it is the
latter which is used.
A.3.2 LAPACK
Provision is made for using an external LAPACK library, principally to cope with BLAS libraries
which contain a copy of LAPACK (such as sunperf on Solaris, Accelerate on macOS and
ATLAS and MKL on ‘ix86’/‘x86_64’ Linux). At least LAPACK version 3.2 is required. This
can only be done if --with-blas has been used.
However, the likely performance gains are thought to be small (and may be negative). The
default is not to search for a suitable LAPACK library, and this is definitely not recommended.
You can specify a specific LAPACK library or a search for a generic library by the configuration
option --with-lapack. The default for --with-lapack is to check the BLAS library and then
look for an external library ‘-llapack’. Sites searching for the fastest possible linear algebra
may want to build a LAPACK library using the ATLAS-optimized subset of LAPACK: this is
simplest with a dynamic ATLAS library which contains a full LAPACK, when --with-lapack
suffices.
A value for --with-lapack can be set via the environment variable LAPACK_LIBS, but this
will only be used if --with-lapack is specified (as the default value is no) and the BLAS library
does not contain LAPACK.
If you do use --with-lapack, be aware of potential problems with bugs in the LAPACK
sources (or in the posted corrections to those sources). In particular, bugs in DGEEV and DGESDD
have resulted in error messages such as
DGEBRD gave error code -10
. Other potential problems are incomplete versions of the libraries, seen several times in Linux
distributions over the years.
Please do bear in mind that using --with-lapack is ‘definitely not recommended’: it is pro-
vided only because it is necessary on some platforms and because some users want to experiment
with claimed performance improvements. Reporting problems where it is used unnecessarily will
simply irritate the R helpers.
Note too the comments about ISO/IEC 60559 compliance in the section of external BLAS:
these apply equally to an external LAPACK, and for example the Intel MKL documentation
has said
LAPACK routines assume that input matrices do not contain IEEE 754 special
values such as INF or NaN values. Using these special values may cause LAPACK
to return unexpected results or become unstable.
We rely on limited support in LAPACK for matrices with 231 or more elements: it is possible
that an external LAPACK will not have that support.
A.3.3 Caveats
As with all libraries, you need to ensure that they and R were compiled with compatible compilers
and flags. For example, this has meant that on Sun Sparc using the Oracle compilers the flag
-dalign is needed if sunperf is to be used.
49
On some systems it has been necessary that an external BLAS/LAPACK was built with the
same Fortran compiler used to build R.
50
If your Fortran libraries are in slightly peculiar places, you should also look at LD_LIBRARY_
PATH or your system’s equivalent to make sure that all libraries are on this path.
Note that only Fortran compilers which convert identifiers to lower case are supported.
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.
Some of the Fortran code makes use of DOUBLE COMPLEX and COMPLEX*16 variables. This is
checked for at configure time, as well as its equivalence to the Rcomplex C structure defined in
R_ext/Complex.h.
Library paths specified as -L/lib/path in LDFLAGS are collected together and prepended to
LD_LIBRARY_PATH (or your system’s equivalent), so there should be no need for -R or -rpath
flags.
Variables such as CPICFLAGS are determined where possible by configure. Some systems
allows two types of PIC flags, for example ‘-fpic’ and ‘-fPIC’, and if they differ the first allows
only a limited number of symbols in a shared object. Since R as a shared library has about 6200
symbols, if in doubt use the larger version.
Other variables often set by configure include ‘MAIN_LDFLAGS’, ‘SAFE_FFLAGS’,
‘SHLIB_LDFLAGS’ and ‘SHLIB_CXXLDFLAGS’: see file config.site in the sources for more
documentation on these and others.
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.
Beware: it may be necessary to set CFLAGS and FFLAGS in ways compatible with the libraries
to be used: one possible issue is the alignment of doubles, another is the way structures are
passed.
On some platforms configure will select additional flags for CFLAGS, CPPFLAGS and LIBS in
R_XTRA_CFLAGS (and so on). These are for options which are always required, for example to
force IEC 60559 compliance.
3
at the time of revision of this para in late 2018, autoconf-2.69 from 2012 and automake-1.16.1 from 2018.
4
The links there have proved difficult to access, in which case either point an FTP client at ftp://www.eecs.
harvard.edu/pub/nr/ or grab the copy made available at http://developer.r-project.org/noweb-2.11b.
tgz.
55
More complicated problems can occur in non-Western-European locales, so if you are using
one, the first thing to check is that things work in the C locale. The likely issues are a failure to
find any fonts or glyphs being rendered incorrectly (often as a pair of ASCII characters). X11
works by being asked for a font specification and coming up with its idea of a close match. For
text (as distinct from the symbols used by plotmath), the specification is the first element of
the option "X11fonts" which defaults to
"-adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*"
If you are using a single-byte encoding, for example ISO 8859-2 in Eastern Europe or KOI8-R
in Russian, use xlsfonts to find an appropriate family of fonts in your encoding (the last field
in the listing). If you find none, it is likely that you need to install further font packages, such
as ‘xorg-x11-fonts-ISO8859-2-75dpi’ and ‘xorg-x11-fonts-cyrillic’ shown in the listing
above.
Multi-byte encodings (most commonly UTF-8) are even more complicated. There are few
fonts in ‘iso10646-1’, the Unicode encoding, and they only contain a subset of the available
glyphs (and are often fixed-width designed for use in terminals). In such locales fontsets are
used, made up of fonts encoded in other encodings. If the locale you are using has an entry in
the ‘XLC_LOCALE’ directory (typically /usr/share/X11/locale), it is likely that all you need
to do is to pick a suitable font specification that has fonts in the encodings specified there. If
not, you may have to get hold of a suitable locale entry for X11. This may mean that, for
example, Japanese text can be displayed when running in ‘ja_JP.UTF-8’ but not when running
in ‘en_GB.UTF-8’ on the same machine (although on some systems many UTF-8 X11 locales are
aliased to ‘en_US.UTF-8’ which covers several character sets, e.g. ISO 8859-1 (Western Euro-
pean), JISX0208 (Kanji), KSC5601 (Korean), GB2312 (Chinese Han) and JISX0201 (Kana)).
On some systems scalable fonts are available covering a wide range of glyphs. One source is
TrueType/OpenType fonts, and these can provide high coverage. Another is Type 1 fonts: the
URW set of Type 1 fonts provides standard typefaces such as Helvetica with a larger coverage
of Unicode glyphs than the standard X11 bitmaps, including Cyrillic. These are generally not
part of the default install, and the X server may need to be configured to use them. They might
be under the X11 fonts directory or elsewhere, for example,
/usr/share/fonts/default/Type1
/usr/share/fonts/ja/TrueType
C.2 Linux
Linux is the main development platform for R, so compilation from the sources is normally
straightforward with the most common compilers and libraries.2
Recall that some package management systems (such as RPM and deb) make a distinction
between the user version of a package and the developer version. The latter usually has the
same name but with the extension ‘-devel’ or ‘-dev’: you need both versions installed. So
please check the configure output to see if the expected features are detected: if for example
‘readline’ is missing add the developer package. (On most systems you will also need ‘ncurses’
and its developer package, although these should be dependencies of the ‘readline’ package(s).)
You should expect to see in the configure summary
Interfaces supported: X11, tcltk
External libraries: readline, curl
Additional capabilities: PNG, JPEG, TIFF, NLS, cairo, ICU
When R has been installed from a binary distribution there are sometimes problems with
missing components such as the Fortran compiler. Searching the ‘R-help’ archives will normally
reveal what is needed.
2
For example, glibc: other C libraries such as musl have been used but are not routinely tested.
Appendix C: Platform notes 57
It seems that ‘ix86’ Linux accepts non-PIC code in shared libraries, but this is not necessarily
so on other platforms, in particular on 64-bit CPUs such as ‘x86_64’. So care can be needed
with BLAS libraries and when building R as a shared library to ensure that position-independent
code is used in any static libraries (such as the Tcl/Tk libraries, libpng, libjpeg and zlib)
which might be linked against. Fortunately these are normally built as shared libraries with the
exception of the ATLAS BLAS libraries.
The default optimization settings chosen for CFLAGS etc are conservative. It is likely that
using -mtune will result in significant performance improvements on recent CPUs: one possibility
is to add -mtune=native for the best possible performance on the machine on which R is being
installed. It is also possible to increase the optimization levels to -O3: however for many versions
of the compilers this has caused problems in at least one CRAN package.
For platforms with both 64- and 32-bit support, it is likely that
LDFLAGS="-L/usr/local/lib64 -L/usr/local/lib"
is appropriate since most (but not all) software installs its 64-bit libraries in /usr/local/lib64.
To build a 32-bit version of R on ‘x86_64’ with Fedora 28 we used
CC="gcc -m32"
CXX="g++ -m32"
FC="gfortran -m32"
OBJC=${CC}
LDFLAGS="-L/usr/local/lib"
LIBnn=lib
Note the use of ‘LIBnn’: ‘x86_64’ Fedora installs its 64-bit software in /usr/lib64 and 32-bit
software in /usr/lib. Linking will skip over inappropriate binaries, but for example the 32-bit
Tcl/Tk configure scripts are in /usr/lib. It may also be necessary to set the pkg-config path,
e.g. by
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
The 32-bit system libcurl did not work with the system CA certificates: this is worked around
in R’s test suite.
64-bit versions on Linux are built with support for files > 2Gb, and 32-bit versions will be if
possible unless --disable-largefile is specified.
Note that 32-bit glibc currently3 uses a 32-bit time_t type, so to pass all the date-time
checks needs R built with flag --with-internal-tzcode.
To build a 64-bit version of R on ‘ppc64’ (also known as ‘powerpc64’) with gcc 4.1.1, Ei-ji
Nakama used
CC="gcc -m64"
CXX="gxx -m64"
FC="gfortran -m64"
CFLAGS="-mminimal-toc -fno-optimize-sibling-calls -g -O2"
FFLAGS="-mminimal-toc -fno-optimize-sibling-calls -g -O2"
the additional flags being needed to resolve problems linking against libnmath.a and when
linking R as a shared library.
The setting of the macro ‘SAFE_FFLAGS’ may need some help. It should not need additional
flags on platforms other than ‘68000’ (not likely to be encountered) and ‘ix86’. For the latter,
if the Fortran compiler is GNU (gfortran or possibly g77) the flags
-msse2 -mfpmath=sse
are added: earlier versions of R added -ffloat-store and this might still be needed if a ‘ix86’
CPU is encountered without SSE2 support. Note that it is a replacement for ‘FFLAGS’, so should
include all the flags in that macro (except perhaps the optimization level).
3
This has been announced to change in version 2.29, having been postponed from 2.28.
Appendix C: Platform notes 58
C.2.1 Clang
R has been built with Linux ‘ix86’ and ‘x86_64’ C and C++ compilers (http://clang.llvm.
org) based on the Clang front-ends, invoked by CC=clang CXX=clang++, together with gfortran.
These take very similar options to the corresponding GCC compilers.
This has to be used in conjunction with a Fortran compiler: the configure code will remove
-lgcc from FLIBS, which is needed for some versions of gfortran.
The current out-of-the-box default for clang++ is to use the C++ runtime from the installed
g++. Using the runtime from the libc++ project (http://libcxx.llvm.org/, Fedora RPM
libcxx-devel) via -stdlib=libc++ has also been tested.
Recent versions have (optional when built) OpenMP support.4
There is a project called flang (https://github.com/flang-compiler/flang)) to develop
a Fortran compiler similar to clang but based on the Portland Group’s front end. This needs
something like
FC=/usr/local/flang/bin/flang
LDFLAGS="-L/usr/local/flang/lib -L/usr/local/lib64"
Note that flang accepts all the flags which clang does (the driver is a modified version of
clang, and flang is a symbolic link to clang), but does not implement all of them for Fortran
compilation: it also accepts most PGI-style flags such as -mp for OpenMP. It currently produces
few diagnostics even with -Wall -pedantic.
flang’s Fortran runtime is compiled against OpenMP and it seems this conflicts with using
OpenMP in R. So it may be necessary to disable the latter by configuring R using --disable-
openmp.
It is not clear what architectures flang intends to support: our experiments were done on
‘x86_64’. At the time of writing binary ‘releases’ were available for that platform (called by
them ‘x86’) and ‘ppc64le’.
4
This also needs the OpenMP runtime which has sometimes been distributed separately.
Appendix C: Platform notes 59
~
Others have reported success with versions 10.x and 11.x. BjA¸rn-Helge Mevik reported
success with version 2015.3 of the compilers, using (for a SandyBridge CPU on Centos 6.x)
fast="-fp-model precise -ip -O3 -opt-mem-layout-trans=3 -xHost -mavx"
CC=icc
CFLAGS="$fast -wd188"
FC=ifort
FFLAGS="$fast"
CXX=icpc
CXXFLAGS="$fast"
It is possible that 32-builds need to force the use of SSE2 instructions in SAFE_FFLAGS, e.g.
by
SAFE_FFLAGS=-axsse2
C.3 macOS
(‘macOS’ was known as ‘OS X’ from 2012–2016.)
The instructions here are for ‘x86_64’ builds on 10.11 (El Capitan) or later. R can in principle
be built for 10.6 and later, although this is little tested and it may be necessary to install later
versions of software such as libcurl.
To build R you need Apple’s ‘Command Line Tools’: these can be (re-)installed by
xcode-select --install. (If you have a fresh OS installation, running e.g. make in a ter-
minal will offer the installation of the command-line tools. If you have installed Xcode, this
provides the command-line tools. The tools will need to be reinstalled when macOS is up-
graded, as upgrading partially removes them.) For macOS 10.14 (‘Mojave’) and version 10.x of
the tools an additional step is needed to install the headers to /usr/include: from a Terminal
run
sudo installer -pkg \
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg \
-target /
(This will need to be re-run if the OS decides to update the Command Line Tools: betas of
version 11 are not currently supported.) Alternatively, change the include path via
CPPFLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
Which is said to be going to be needed for future versions of macOS. (The location of the SDK,
which could change, can be found by running xcrun -show-sdk-path. It is likely that the
compilers included in the Command Line Tools will find the headers under the SDK without
this additional step, but other versions of clang will not.)
You need GNU readline. That and other binary components are available from https://
mac.R-project.org/libs: you will need pcre and xz (for libzma) as recent macOS versions
provide libraries but not headers for these (and the system pcre is too old at 8.02 for versions
up to Sierra, although High Sierra had 8.40).
An X sub-system is required unless configuring using --without-x: see https://xquartz.
macosforge.org/. R’s configure script can be told to look for X11 in XQuartz’s main location
of /opt/X11, e.g. by
--x-includes=/opt/X11/include --x-libraries=/opt/X11/lib
although linked versions under /usr/X11 will be found.
To use the quartz() graphics device you need to configure with --with-aqua (which is the
default): quartz() then becomes the default device when running R at the console and X11
Appendix C: Platform notes 60
would only be used for the command-line-R data editor/viewer and one version of Tcl/Tk. (This
option needs an Objective-C compiler5 which can compile the source code of quartz().)
Use --without-aqua if you want a standard Unix-alike build: apart from disabling quartz()
and the ability to use the build with R.app, it also changes the default location of the personal
library (see ?.libPaths).
Various compilers can be used. One could use
CC=clang
CXX=clang++
FC=/usr/local/gfortran/bin/gfortran
OBJC=clang
CFLAGS=’-Wal -g -O2’
CXXFLAGS=’-Wall -g -O2’
OBJCFLAGS=’-Wall -g -O2’
FFLAGS=’-Wall -g -O2 -mtune=generic’
with clang and clang++ from the ‘Command Line Tools’ and the Fortran compiler from one of
the packages described in the next paragraph.
There are installers6 for Fortran compilers for El Capitan, Sierra and Mojave at https://
github . com / fxcoudert / gfortran-for-macOS / releases / download / 6 . 1 / gfortran-6 .
1-ElCapitan . dmg, https: / / github . com / fxcoudert / gfortran-for-macOS / releases /
download / 6 . 3 / gfortran-6 . 3-Sierra . dmg and https: / / github . com / fxcoudert /
gfortran-for-macOS/releases/download/8.2/gfortran-8.2-Mojave.dmg. (An Apple pack-
age for 6.1 is also available at https://cran.r-project.org/bin/macosx/tools/gfortran-6.
1.pkg.) One way to use these builds with a binary distribution of R is to have a ~/.R/Makevars
file similar to (El Capitan)
FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0
-L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
or (Sierra or High Sierra)
FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin16/6.3.0
-L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
or (Mojave)
FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0
-L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
(with lines broken here for legibility).
Current CRAN binary distributions use the build of clang 7.0.0 contained in https://cran.
r-project.org/bin/macosx/tools/clang-7.0.0.pkg. Other recent distributions of clang
are available from http://llvm.org/releases/ (on which the above are based). In particular,
all of these include support for OpenMP which Apple builds of clang do not. Suppose one
of these distributions is installed under /usr/local/clang7. Then R could be configured by
something like
./configure --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib \
PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig \
DYLD_FALLBACK_LIBRARY_PATH=/usr/local/clang7/lib:/usr/local/lib
5
These days that is defined by Apple’s implementation of clang, so it is strongly recommended to use that.
6
Some of these are unsigned packages: to install them you may need to right-click and select Open with ->
Installer.
Appendix C: Platform notes 61
One macOS quirk is that the default path has /usr/local/bin after /usr/bin, contrary to
common practice on Unix-alikes. This means that if you install tools from the sources they will
by default be installed under /usr/local and not supersede the system versions.
If you upgrade your OS you should re-install the ‘Command Line Tools’ and may need to
re-install XQuartz and Java (this has been needed for some upgrades but not others).
C.3.2 Java
The situation with Java support on macOS is messy,10 and distribution of Java for all platforms
changed in 2018.
macOS no longer comes with an installed Java runtime (JRE), and a macOS upgrade may
remove one if already installed: it is intended to be installed at first use. Check if a JRE is
installed by running java -version in a Terminal window: if Java is not installed11 this should
prompt you to install it. You can also install directly a recent Java from Oracle (currently from
http://www.oracle.com/technetwork/java/javase/downloads/index.html). Builds of
OpenJDK may also be available, e.g. from http://jdk.java.net/. We recommend you install
a version with long-term support, e.g. 8 or 11 (but not 9, 10 or 12 which have/had a 6-month
lifetime).
Binary distributions of R are built against a specific version (e.g. 9) of Java so sudo R CMD
javareconf will likely be needed before using Java-using packages.
To see what compatible versions of Java are currently installed, run /usr/libexec/java_
home -V -a x86_64. If needed, set the environment variable JAVA_HOME to choose between these,
both when R is built from the sources and when R CMD javareconf is run.
10
For more details see http://www.macstrategy.com/article.php?3.
11
In the unlikely event that the version reported does not start with 1.8.0, 9, 10 or 11 you need to update your
Java.
Appendix C: Platform notes 63
Configuring and building R both looks for a JRE and for support for compiling JNI pro-
grams (used by packages rJava (https://CRAN.R-project.org/package=rJava) and JavaGD
(https://CRAN.R-project.org/package=JavaGD)); the latter requires a JDK (Java SDK) and
not just a JRE12 .
The build process tries to fathom out what JRE/JDK to use, but it may need some help,
e.g. by setting JAVA_HOME. A JDK can be specified explicitly by something like
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
JAVA_CPPFLAGS="-I/${JAVA_HOME}/include -I/${JAVA_HOME}/include/darwin"
JAVA_LD_LIBRARY_PATH="${JAVA_HOME}/lib/server"
JAVA_LIBS="-L/${JAVA_HOME}/lib/server -ljvm"
or
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
JAVA_CPPFLAGS="-I/${JAVA_HOME}/include -I/${JAVA_HOME}/include/darwin"
JAVA_LD_LIBRARY_PATH="${JAVA_HOME}/jre/lib/server"
JAVA_LIBS="-L/${JAVA_HOME}/jre/lib/server -ljvm"
in config.site.
To use the builds of OpenJDK (tarballs) from http://jdk.java.net/, set JAVA_HOME:
JAVA_HOME=/path/to/JDK/jdk-11.jdk/Contents/Home
where /path/to/JDK is wherever the distribution tarball was unpacked.
Note that it is necessary to set the environment variable NOAWT to 1 to install many of the
Java-using packages.
C.3.3 Frameworks
The CRAN build of R is installed as a framework, which is selected by the option
./configure --enable-R-framework
(This is intended to be used with an Apple toolchain: others may not support frameworks
correctly but those from llvm.org do.)
It is only needed if you want to build R for use with the R.app console, and implies
--enable-R-shlib to build R as a dynamic library. This option configures R to be built and
installed as a framework called R.framework. The default installation path for R.framework
is /Library/Frameworks but this can be changed at configure time by specifying the flag
--enable-R-framework[=DIR] (or --prefix) or at install time via
make prefix=/where/you/want/R.framework/to/go install
Note that installation as a framework is non-standard (especially to a non-standard location)
and Unix utilities may not support it (e.g. the pkg-config file libR.pc will be put somewhere
unknown to pkg-config).
See also the INSTALL file in the checkout or directly at https: / / svn . r-project . org /
R-packages/trunk/Mac-GUI/INSTALL.
R.app does not need to be installed in any specific way. Building R.app results in the R.app
bundle which appears as one R icon. This application bundle can be run anywhere and it is
customary to place it in the /Applications folder.
C.4 Solaris
R has been built successfully on Solaris 10 using the (zero cost) Oracle Developer Studio13
compilers: there has also been success with gcc/gfortran. (Recent Sun machines are AMD
Opterons or Intel Xeons (‘amd64’) rather than ‘x86’, but 32-bit ‘x86’ executables are the default.)
How these compilers identify themselves is slightly confusing: commands CC -V with Developer
Studio 12.5 and 12.6 report as versions 5.14 and 5.15. We will only consider Developer Studio
versions 12.5 (May 2016) and 12.6 (July 2017): instructions for 12.3 can be found in versions of
this manual for R 3.3.x.
There have been few reports on Solaris 11, with no known extra issues.
Solaris was last tested on Sparc machines in June 2017.
The Solaris versions of several of the tools needed to build R (e.g. make, ar and ld) are in
/usr/ccs/bin, so if using those tools ensure this is in your path. A version of the preferred
GNU tar is (if installed) in /usr/sfw/bin. It may be necessary to avoid the tools in /usr/ucb:
POSIX-compliant versions of some tools can be found in /usr/xpg4/bin and /usr/xpg6/bin.
A large selection of Open Source software can be installed from https://www.opencsw.org,
by default installed under /opt/csw. Solaris 10 ships with bzlib version 1.0.6 (sufficient) but
zlib version 1.2.3 (too old): OpenCSW has 1.2.8. (Note from 2019: updating of OpenCSW has
slowed or stopped.)
At least when compiling with Oracle compilers, Solaris uses far more stack space than other
platforms. This makes it desirable to build PCRE with the option --disable-stack-for-
recursion: the OpenCSW distribution was at the time of writing.
The Oracle compilers are unusual in not including /usr/local/include in the default in-
clude search path: R’s default CPPFLAGS=-I/usr/local/include remedies this. If you rely on
OpenCSW software you may need CPPFLAGS=-I/opt/csw/include (or both).
You will need GNU libiconv and readline: the Solaris version of iconv is not sufficiently
powerful.
The native make suffices to build R but a number of packages require GNU make (some
without declaring it as ‘SystemRequirements’ in the DESCRIPTION file).
The support for the C99 long double type on Sparc hardware uses quad-precision arithmetic,
and this is usually slow because it is done by software emulation. On such systems the configure
option --disable-long-double can be used for faster but less accurate computations.
The Solaris time-zone conversion services seem to be unreliable pre-1916 in Europe (when
daylight-savings time was first introduced): most often reporting in the non-existent DST vari-
ant. Using configure option --with-internal-tzcode is recommended, and required if you
find time-zone abbreviations being given odd values (as has been seen on 64-bit builds without
it).
When using the Oracle compilers do not specify -fast, as this disables IEEE arithmetic and
make check will fail.
A little juggling of paths was needed to ensure GNU libiconv (in /usr/local) was used
rather than the Solaris iconv:
CC="cc -xc99"
13
Oracle Solaris Studio prior to 2016, and previously Sun Studio.
Appendix C: Platform notes 65
CFLAGS="-O -xlibmieee"
FC=f95
FFLAGS=-O
CXX=CC
CXXSTD="-std=c++11 -library=stdcpp,CrunG3"
CXX98STD="-compat=g -library=stdcpp,CrunG3"
CXX11STD="-std=c++11 -library=stdcpp,CrunG3"
CXX14STD="-std=c++14 -library=stdcpp,CrunG3"
CXXFLAGS=-O
R_LD_LIBRARY_PATH="/opt/developerstudio12.6/lib:/usr/local/lib:/opt/csw/lib"
The Oracle compilers do not by default conform to the C99 standard (appendix F 8.9) on
the return values of functions such as log: use -xlibmieee to ensure this.
A peculiarity of some versions of the Fortran compiler has been that when asked to link a
shared object they did not link against all the Fortran 9x runtime libraries, hence
FCLIBS_XTRA="-lfsu /opt/developerstudio12.6/lib/libfui.so.2"
has been needed.
Using -xlibmil in CFLAGS or -xlibmil in FFLAGS/FCFLAGS allows more system mathematical
functions to be inlined.
On ‘x86’ you will get marginally higher performance via
CFLAGS="-xO5 -xlibmieee -xlibmil -nofstore -xtarget=native"
FFLAGS="-xO5 -libmil -nofstore -xtarget=native"
CXXFLAGS="-xO5 -xlibmil -nofstore -xtarget=native"
SAFE_FFLAGS="-O -libmil -fstore -xtarget=native"
but the use of -nofstore can be less numerically stable, and some packages have in the past
failed to compile at optimization level 5.
The Oracle compilers provide several implementations of the C++ standards which select
both the set of headers and a C++ runtime library. One of those is selected by the -library
flag, which as it is needed for both compiling and linking is best specified as part of the compiler
or standard. Current R expects a C++11 compiler, for which the choice given above is the only
possibility. For C++98 there are several with
CXX98=CC
CXX98STD="-compat=g -library=stdcpp,CrunG3"
being the most compatible with C++11 compilation. Another possibility (commonly used for
earlier versions of R) would be
CXX98="CC -library=stlport4"
Although version 12.5 accepts the flag -std=c++14, it did not pass configure’s conformance
tests: version 12.6 did.
The performance library sunperf is available for use with the Oracle compilers. If selected
as a BLAS, it must also be selected as LAPACK via
./configure --with-blas=’-library=sunperf’ --with-lapack
This has often given test failures in the past, in several different places.14
Parsing very complex R expressions needs a lot of stack space when the Oracle compilers are
used: several packages require the stack increased to at least 20MB.
Some people have reported that the Solaris libintl needs to be avoided, for example by
using --disable-nls or --with-included-gettext or using libintl from OpenCSW. (On
14
When last checked it failed in tests/reg-BLAS.R, and on some builds, including for ‘amd64’, it failed in
example(eigen).
Appendix C: Platform notes 66
the other hand, there have been many successful installs which automatically detected libintl
from OpenCSW or selected the included gettext.)
It has been reported that some Solaris installations need
INTERNET_LIBS="-lsocket -lnsl"
on the configure command line or in file config.site; however, there have been many suc-
cessful installs without this.
C.5 FreeBSD
There have been few recent reports on FreeBSD: there is a ‘port’ at https://www.freebsd.
org/ports/math.html. Recent versions of FreeBSD use Clang and the libc++ C++ headers
and runtime, but the ‘port’ is configured to use GCC.
Use of ICU for collation and the configure option --with-internal-tzcode are desirable
workarounds.
C.6 OpenBSD
Ingo Feinerer installed R version 3.2.2 on OpenBSD 5.8 arch ‘amd64’ (their name for ‘x86_64’).
Details of the build (and patches applied) are at http: / / cvsweb . openbsd . org / cgi-bin /
cvsweb/ports/math/R/. (Downgrading the zlib requirement to 1.2.3 is against the advice of
the R developers.)
C.7 Cygwin
The 32-bit version never worked well enough to pass R’s make check, and residual support from
earlier experiments was removed in R 3.3.0.
The 64-bit version was never unsupported.
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 platform.
If you are having trouble getting R to work on your platform please feel free to use the
‘R-devel’ mailing list to ask questions. We have had a fair amount of practice at porting R to
new platforms . . .
69
D.1 LATEX
The ‘MiKTeX’ (http://www.miktex.org/) distribution of LATEX includes a suitable port of
pdftex. This can be set up to install extra packages ‘on the fly’, which is the simplest way
to use it (and the default). The ‘basic’ version of ‘MiKTeX’ almost suffices: when last checked
packages
epsf inconsolata mptopdf url
needed to be added (on the fly or via the ‘MiKTeX’ Package Manager) to install R. In any
case ensure that the inconsolata package is installed—you can check with the ‘MiKTeX’ Package
Manager.
The Rtools*.exe installer does not include any version of LATEX.
It is also possible to use the TeX Live distribution from https://www.tug.org/texlive/.
Please read Section 2.3 [Making the manuals], page 4, about how to make fullrefman.pdf
and set the environment variable R_RD4PDF suitably; ensure you have the required fonts installed
or that ‘MiKTeX’ is set up to install LATEX packages on first use.
Some external software libraries will need to be re-compiled under the new toolchain: es-
pecially those providing a C++ interface. Many of those used by CRAN packages are available
from https://www.stats.ox.ac.uk/pub/Rtools/multilib/. Users developing packages with
Rcpp (https://CRAN.R-project.org/package=Rcpp) need to ensure that they use a version
built with exactly the same toolchain as their package: the recommendation is to build Rcpp
(https://CRAN.R-project.org/package=Rcpp) from its sources yourself.
There is support for OpenMP and pthreads in this toolchain. As the performance of OpenMP
on Windows is poor for small tasks, it is not used for R itself.
C R
configure . . . . . . . . . . . . . . . . . . . . . . . . . . 3, 4, 6, 7, 51, 52 R_HOME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
remove.packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
I
install.packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 U
update.packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
M
make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
73
Concept index
B O
BLAS library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44, 61, 65 Obtaining R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
OpenBSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
F P
Fortran. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
FreeBSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Packages, default . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Packages, installing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Packages, removing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
I Packages, updating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Installing under Unix-alikes . . . . . . . . . . . . . . . . . . . . . . . . 3 R
Installing under Windows . . . . . . . . . . . . . . . . . . . . . . . . . 14 Repositories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Internationalization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
S
L Site libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
LAPACK library . . . . . . . . . . . . . . . . . . . . . . . . . . 48, 61, 65 Solaris . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Sources for R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Libraries, managing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Subversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1, 40
Libraries, site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Libraries, user . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3, 56
U
Locale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 User libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
V
Vignettes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
M
macOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3, 20, 59
Manuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 W
Manuals, installing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 winCairo.dll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
74
B P
BINPREF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 PAPERSIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
BINPREF64 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 PATH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41, 52, 69
BLAS_LIBS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
R
C R_ARCH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
CONFIG_SITE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 R_BROWSER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
CYGWIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 R_DEFAULT_PACKAGES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
R_DISABLE_HTTPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
R_GSCMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
D R_INSTALL_TAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
DESTDIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8, 37 R_JAVA_LD_LIBRARY_PATH . . . . . . . . . . . . . . . . . . . . . . . . . 43
R_LIBS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
R_LIBS_SITE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
R_LIBS_USER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
J R_PAPERSIZE. . . . . . . . . . . . . . . . . . . . . . . . . . . . 5, 23, 51, 52
JAVA_HOME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 R_PDFVIEWER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
R_RD4PDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6, 52, 70
R_SCRIPT_DEFAULT_PACKAGES . . . . . . . . . . . . . . . . . . . . . 24
L R_USER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
LANG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
LANGUAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33, 34
LAPACK_LIBS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 T
LC_ALL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 TAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
LC_COLLATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 TAR_OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1, 15
LC_MESSAGES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 TEMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
LD_LIBRARY_PATH . . . . . . . . . . . . . . . . . . . . . . 37, 53, 54, 66 TMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
LOCAL_SOFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 TMPDIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3, 15, 23, 24