<li><aname="toc-Getting-and-unpacking-the-sources-1"href="#Getting-and-unpacking-the-sources">1.1 Getting and unpacking the sources</a></li>
<li><aname="toc-Getting-patched-and-development-versions-1"href="#Getting-patched-and-development-versions">1.2 Getting patched and development versions</a>
<ulclass="no-bullet">
<li><aname="toc-Using-Subversion-and-rsync-1"href="#Using-Subversion-and-rsync">1.2.1 Using Subversion and rsync</a></li>
</ul></li>
</ul></li>
<li><aname="toc-Installing-R-under-Unix_002dalikes-1"href="#Installing-R-under-Unix_002dalikes">2 Installing R under Unix-alikes</a>
<li><aname="toc-Locales-under-Unix_002dalikes-1"href="#Locales-under-Unix_002dalikes">7.1.1 Locales under Unix-alikes</a></li>
<li><aname="toc-Locales-under-Windows-1"href="#Locales-under-Windows">7.1.2 Locales under Windows</a></li>
<li><aname="toc-Locales-under-OS-X-1"href="#Locales-under-OS-X">7.1.3 Locales under OS X</a></li>
</ul></li>
<li><aname="toc-Localization-of-messages-1"href="#Localization-of-messages">7.2 Localization of messages</a></li>
</ul></li>
<li><aname="toc-Choosing-between-32_002d-and-64_002dbit-builds-1"href="#Choosing-between-32_002d-and-64_002dbit-builds">8 Choosing between 32- and 64-bit builds</a></li>
<li><aname="toc-The-standalone-Rmath-library-1"href="#The-standalone-Rmath-library">9 The standalone Rmath library</a>
<li><aname="toc-Essential-and-useful-other-programs-under-a-Unix_002dalike-1"href="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Appendix A Essential and useful other programs under a Unix-alike</a>
<ulclass="no-bullet">
<li><aname="toc-Essential-programs-and-libraries-1"href="#Essential-programs-and-libraries">A.1 Essential programs and libraries</a></li>
<li><aname="toc-Useful-libraries-and-programs-1"href="#Useful-libraries-and-programs">A.2 Useful libraries and programs</a>
<tr><tdalign="left"valign="top">•<ahref="#Installing-R-under-Unix_002dalikes"accesskey="2">Installing R under Unix-alikes</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Installing-R-under-Windows"accesskey="3">Installing R under Windows</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Installing-R-under-OS-X"accesskey="4">Installing R under OS X</a>:</td><td> </td><tdalign="left"valign="top">
<tr><tdalign="left"valign="top">•<ahref="#Choosing-between-32_002d-and-64_002dbit-builds"accesskey="8">Choosing between 32- and 64-bit builds</a>:</td><td> </td><tdalign="left"valign="top">
<tr><tdalign="left"valign="top">•<ahref="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Essential and useful other programs under a Unix-alike</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a>:</td><td> </td><tdalign="left"valign="top">
<tr><tdalign="left"valign="top">•<ahref="#The-Windows-toolset">The Windows toolset</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Function-and-variable-index">Function and variable index</a>:</td><td> </td><tdalign="left"valign="top">
Next: <ahref="#Installing-R-under-Unix_002dalikes"accesskey="n"rel="next">Installing R under Unix-alikes</a>, Previous: <ahref="#Top"accesskey="p"rel="prev">Top</a>, Up: <ahref="#Top"accesskey="u"rel="up">Top</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Obtaining-R-1"></a>
<h2class="chapter">1 Obtaining R</h2>
<aname="index-Obtaining-R"></a>
<p>Sources, binaries and documentation for R can be obtained via
<acronym>CRAN</acronym>, the “Comprehensive R Archive Network” whose current
members are listed at <ahref="https://CRAN.R-project.org/mirrors.html">https://CRAN.R-project.org/mirrors.html</a>.
<tr><tdalign="left"valign="top">•<ahref="#Getting-and-unpacking-the-sources"accesskey="1">Getting and unpacking the sources</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Getting-patched-and-development-versions"accesskey="2">Getting patched and development versions</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
</table>
<hr>
<aname="Getting-and-unpacking-the-sources"></a>
<divclass="header">
<p>
Next: <ahref="#Getting-patched-and-development-versions"accesskey="n"rel="next">Getting patched and development versions</a>, Previous: <ahref="#Obtaining-R"accesskey="p"rel="prev">Obtaining R</a>, Up: <ahref="#Obtaining-R"accesskey="u"rel="up">Obtaining R</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Getting-and-unpacking-the-sources-1"></a>
<h3class="section">1.1 Getting and unpacking the sources</h3>
<aname="index-Sources-for-R"></a>
<p>The simplest way is to download the most recent
<samp>R-<var>x</var>.<var>y</var>.<var>z</var>.tar.gz</samp> file, and unpack it with
Previous: <ahref="#Getting-and-unpacking-the-sources"accesskey="p"rel="prev">Getting and unpacking the sources</a>, Up: <ahref="#Obtaining-R"accesskey="u"rel="up">Obtaining R</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
<tr><tdalign="left"valign="top">•<ahref="#Using-Subversion-and-rsync"accesskey="1">Using Subversion and rsync</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
</table>
<hr>
<aname="Using-Subversion-and-rsync"></a>
<divclass="header">
<p>
Previous: <ahref="#Getting-patched-and-development-versions"accesskey="p"rel="prev">Getting patched and development versions</a>, Up: <ahref="#Getting-patched-and-development-versions"accesskey="u"rel="up">Getting patched and development versions</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Using-Subversion-and-rsync-1"></a>
<h4class="subsection">1.2.1 Using Subversion and rsync</h4>
<aname="index-Subversion"></a>
<p>Sources are also available via <ahref="https://svn.R-project.org/R/">https://svn.R-project.org/R/</a>, the
R Subversion repository. If you have a Subversion client (see
<ahref="https://subversion.apache.org/">https://subversion.apache.org/</a>), you can check out and update the
current ‘<samp>r-devel</samp>’ from
<ahref="https://svn.r-project.org/R/trunk/">https://svn.r-project.org/R/trunk/</a> and the current
Next: <ahref="#Installing-R-under-Windows"accesskey="n"rel="next">Installing R under Windows</a>, Previous: <ahref="#Obtaining-R"accesskey="p"rel="prev">Obtaining R</a>, Up: <ahref="#Top"accesskey="u"rel="up">Top</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
<tr><tdalign="left"valign="top">•<ahref="#Making-the-manuals"accesskey="3">Making the manuals</a>:</td><td> </td><tdalign="left"valign="top">
<tr><tdalign="left"valign="top">•<ahref="#Testing-a-Unix_002dalike-Installation"accesskey="8">Testing a Unix-alike Installation</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
</table>
<hr>
<aname="Simple-compilation"></a>
<divclass="header">
<p>
Next: <ahref="#Help-options"accesskey="n"rel="next">Help options</a>, Previous: <ahref="#Installing-R-under-Unix_002dalikes"accesskey="p"rel="prev">Installing R under Unix-alikes</a>, Up: <ahref="#Installing-R-under-Unix_002dalikes"accesskey="u"rel="up">Installing R under Unix-alikes</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Simple-compilation-1"></a>
<h3class="section">2.1 Simple compilation</h3>
<p>First review the essential and useful tools and libraries in
<ahref="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Essential and useful other programs under a Unix-alike</a>, and install
those you
<aname="index-TMPDIR"></a>
want or need. Ensure that the environment variable <code>TMPDIR</code> is
either unset (and <samp>/tmp</samp> exists and can be written in and scripts
can be executed from) or points to the absolute path to a valid
temporary directory (one from which execution of scripts is allowed)
which does not contain spaces.<aname="DOCF3"href="#FOOT3"><sup>3</sup></a>
</p>
<aname="index-R_005fHOME"></a>
<p>Choose a directory to install the R tree (R is not just a binary, but
has additional data sets, help files, font metrics etc). Let us call
this place <var>R_HOME</var>. Untar the source code. This should create
directories <samp>src</samp>, <samp>doc</samp>, and several more under a top-level
directory: change to that top-level directory (At this point North
American readers should consult <ahref="#Setting-paper-size">Setting paper size</a>.) Issue the
following commands:
</p>
<aname="index-configure"></a>
<divclass="example">
<preclass="example">./configure
make
</pre></div>
<p>(See <ahref="#Using-make">Using make</a> if your make is not called ‘<samp>make</samp>’.) Users of
Debian-based 64-bit systems<aname="DOCF4"href="#FOOT4"><sup>4</sup></a> may need
</p>
<divclass="example">
<preclass="example">./configure LIBnn=lib
make
</pre></div>
<p>Then check the built system works correctly by
</p>
<divclass="example">
<preclass="example">make check
</pre></div>
<p>Failures are not necessarily problems as they might be caused by missing
functionality, but you should look carefully at any reported
discrepancies. (Some non-fatal errors are expected in locales that do
not support Latin-1, in particular in true <code>C</code> locales and
non-UTF-8 non-Western-European locales.) A failure in
<samp>tests/ok-errors.R</samp> may indicate inadequate resource limits
(see <ahref="#Running-R">Running R</a>).
</p>
<p>More comprehensive testing can be done by
</p>
<divclass="example">
<preclass="example">make check-devel
</pre></div>
<p>or
</p>
<divclass="example">
<preclass="example">make check-all
</pre></div>
<p>see file <samp>tests/README</samp> and <ahref="#Testing-a-Unix_002dalike-Installation">Testing a Unix-alike Installation</a>
for the possibilities of doing this in parallel. Note that these checks
are only run completely if the recommended packages are installed.
</p>
<p>If the command <code>configure</code> and <code>make</code> commands execute
successfully, a shell-script front-end called <samp>R</samp> will be created
and copied to <samp><var>R_HOME</var>/bin</samp>. You can link or copy this script
to a place where users can invoke it, for example to
<samp>/usr/local/bin/R</samp>. You could also copy the man page <samp>R.1</samp> to
a place where your <code>man</code> reader finds it, such as
<samp>/usr/local/man/man1</samp>. If you want to install the complete R
tree to, e.g., <samp>/usr/local/lib/R</samp>, see <ahref="#Installation">Installation</a>. Note:
you do not <em>need</em> to install R: you can run it from where it was
built.
</p>
<p>You do not necessarily have to build R in the top-level source
directory (say, <samp><var>TOP_SRCDIR</var></samp>). To build in
<samp><var>BUILDDIR</var></samp>, run
</p>
<aname="index-configure-1"></a>
<divclass="example">
<preclass="example">cd <var>BUILDDIR</var>
<var>TOP_SRCDIR</var>/configure
make
</pre></div>
<p>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
<acronym>GNU</acronym><code>make</code> 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.)
</p>
<p>Now <code>rehash</code> if necessary, type <kbd>R</kbd>, and read the R manuals
and the R <acronym>FAQ</acronym> (files <samp>FAQ</samp> or
<samp>doc/manual/R-FAQ.html</samp>, or
<ahref="https://CRAN.R-project.org/doc/FAQ/R-FAQ.html">https://CRAN.R-project.org/doc/FAQ/R-FAQ.html</a> which always
has the version for the latest release of R).
</p>
<p>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 <samp>/usr/bin</samp> (the
standard place for a system installation) ahead of <samp>/usr/local/bin</samp>
(the default place for installation of R) in their default path, and
some do not have <samp>/usr/local/bin</samp> on the default path.
</p>
<hr>
<aname="Help-options"></a>
<divclass="header">
<p>
Next: <ahref="#Making-the-manuals"accesskey="n"rel="next">Making the manuals</a>, Previous: <ahref="#Simple-compilation"accesskey="p"rel="prev">Simple compilation</a>, Up: <ahref="#Installing-R-under-Unix_002dalikes"accesskey="u"rel="up">Installing R under Unix-alikes</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Help-options-1"></a>
<h3class="section">2.2 Help options</h3>
<p>By default <acronym>HTML</acronym> help pages are created when needed rather than being
built at install time.
</p>
<p>If you need to disable the server and want <acronym>HTML</acronym> help, there is the
option to build <acronym>HTML</acronym> pages when packages are installed
(including those installed with R). This is enabled by the
<acronym>HTML</acronym> pages is determined by looking at the R installation and is
reported by <code>R CMD INSTALL --help</code>: it can be overridden by
specifying one of the <code>INSTALL</code> options <samp>--html</samp> or
<samp>--no-html</samp>.
</p>
<p>The server is disabled by setting the environment variable
<aname="index-R_005fDISABLE_005fHTTPD"></a>
<code>R_DISABLE_HTTPD</code> to a non-empty value, either before R is
started or within the R session before <acronym>HTML</acronym> help (including
<code>help.start</code>) is used. It is also possible that system security
measures will prevent the server from being started, for example if the
loopback interface has been disabled. See
<code>?tools::startDynamicHelp</code> for more details.
</p>
<hr>
<aname="Making-the-manuals"></a>
<divclass="header">
<p>
Next: <ahref="#Installation"accesskey="n"rel="next">Installation</a>, Previous: <ahref="#Help-options"accesskey="p"rel="prev">Help options</a>, Up: <ahref="#Installing-R-under-Unix_002dalikes"accesskey="u"rel="up">Installing R under Unix-alikes</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Making-the-manuals-1"></a>
<h3class="section">2.3 Making the manuals</h3>
<aname="index-Manuals"></a>
<p>There is a set of manuals that can be built from the sources,
</p>
<dlcompact="compact">
<dt>‘<samp>fullrefman</samp>’</dt>
<dd><p>Printed versions of all the help pages for base and recommended packages
(around 3500 pages).
</p></dd>
<dt>‘<samp>refman</samp>’</dt>
<dd><p>Printed versions of the help pages for selected base packages (around
2000 pages)
</p></dd>
<dt>‘<samp>R-FAQ</samp>’</dt>
<dd><p>R <acronym>FAQ</acronym>
</p></dd>
<dt>‘<samp>R-intro</samp>’</dt>
<dd><p>“An Introduction to R”.
</p></dd>
<dt>‘<samp>R-data</samp>’</dt>
<dd><p>“R Data Import/Export”.
</p></dd>
<dt>‘<samp>R-admin</samp>’</dt>
<dd><p>“R Installation and Administration”, this manual.
</p></dd>
<dt>‘<samp>R-exts</samp>’</dt>
<dd><p>“Writing R Extensions”.
</p></dd>
<dt>‘<samp>R-lang</samp>’</dt>
<dd><p>“The R Language Definition”.
</p></dd>
</dl>
<p>To make these (with ‘<samp>fullrefman</samp>’ rather than ‘<samp>refman</samp>’), use
</p>
<divclass="example">
<preclass="example">make pdf <spanclass="roman">to create PDF versions</span>
make info <spanclass="roman">to create info files (not ‘<samp>refman</samp>’ nor ‘<samp>fullrefman</samp>’).</span>
</pre></div>
<p>You will not be able to build any of these unless you have
<code>texi2any</code> version 5.1 or later installed, and for PDF you must
have <code>texi2dvi</code> and <samp>texinfo.tex</samp> installed (which are part
of the <acronym>GNU</acronym><strong>texinfo</strong> distribution but are, especially
<samp>texinfo.tex</samp>, often made part of the TeX package in
re-distributions). For historical reasons, the path to
<code>texi2any</code> can be set by macro ‘<samp>MAKEINFO</samp>’ in
<samp>config.site</samp> (<code>makeinfo</code> is nowadays a link to
<code>texi2any</code>).
</p>
<p>The PDF versions can be viewed using any recent PDF viewer: they have
hyperlinks that can be followed. The info files are suitable for
reading online with Emacs or the standalone <acronym>GNU</acronym><code>info</code>
program. The PDF versions will be created using the paper size selected
at configuration (default ISO a4): this can be overridden by setting
<code>R_PAPERSIZE</code>
<aname="index-R_005fPAPERSIZE"></a>
on the <code>make</code> command line, or setting <code>R_PAPERSIZE</code> in the
environment and using <code>make -e</code>. (If re-making the manuals for
a different paper size, you should first delete the file
<samp>doc/manual/version.texi</samp>. The usual value for North America would
be ‘<samp>letter</samp>’.)
</p>
<p>There are some issues with making the PDF reference manual,
<samp>fullrefman.pdf</samp> or <samp>refman.pdf</samp>. The help files contain both
ISO Latin1 characters (e.g. in <samp>text.Rd</samp>) and upright quotes,
neither of which are contained in the standard LaTeX Computer Modern
fonts. We have provided four alternatives:
</p>
<dlcompact="compact">
<dt><code>times</code></dt>
<dd><p>(The default.) Using standard PostScript fonts, Times Roman, Helvetica
and Courier. This works well both for on-screen viewing and for
printing. One disadvantage is that the Usage and Examples sections may
come out rather wide: this can be overcome by using <em>in addition</em>
either of the options <code>inconsolata</code> (on a Unix-alike only if found
by <code>configure</code>) or <code>beramono</code>, which replace the Courier
monospaced font by Inconsolata or Bera Sans mono respectively. (You
will need a recent version of the appropriate LaTeX package
<strong>inconsolata</strong><aname="DOCF5"href="#FOOT5"><sup>5</sup></a> or
<strong>bera</strong> installed.)
</p>
<p>Note that in most LaTeX installations this will not actually use the
standard fonts for PDF, but rather embed the URW clones NimbusRom,
NimbusSans and (for Courier, if used) NimbusMon.
</p>
<p>This needs LaTeX packages <strong>times</strong>, <strong>helvetic</strong> and (if used)
<strong>courier</strong> installed.
</p>
</dd>
<dt><code>lm</code></dt>
<dd><p>Using the <em>Latin Modern</em> fonts. These are not often installed as
part of a TeX distribution, but can obtained from
<ahref="https://www.ctan.org/tex-archive/fonts/ps-type1/lm/">https://www.ctan.org/tex-archive/fonts/ps-type1/lm/</a> and
mirrors. This uses fonts rather similar to Computer Modern, but is not
so good on-screen as <code>times</code>.
</p>
</dd>
<dt><code>cm-super</code></dt>
<dd><p>Using type-1 versions of the Computer Modern fonts by Vladimir Volovich.
<p>Ebook versions of most of the manuals in one or both of <samp>.epub</samp> and
<samp>.mobi</samp> formats can be made by running in <samp>doc/manual</samp> one of
</p><divclass="example">
<preclass="example">make ebooks
make epub
make mobi
</pre></div>
<p>This requires <code>ebook-convert</code> from <code>Calibre</code>
(<ahref="http://calibre-ebook.com/download">http://calibre-ebook.com/download</a>), or from most Linux
distributions). If necessary the path to <code>ebook-convert</code> can be
set as make macro <code>EBOOK</code> to by editing <samp>doc/manual/Makefile</samp>
(which contains a commented value suitable for OS X).
</p>
<hr>
<aname="Installation"></a>
<divclass="header">
<p>
Next: <ahref="#Uninstallation"accesskey="n"rel="next">Uninstallation</a>, Previous: <ahref="#Making-the-manuals"accesskey="p"rel="prev">Making the manuals</a>, Up: <ahref="#Installing-R-under-Unix_002dalikes"accesskey="u"rel="up">Installing R under Unix-alikes</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Installation-1"></a>
<h3class="section">2.4 Installation</h3>
<aname="index-Installation"></a>
<p>To ensure that the installed tree is usable by the right group of users,
set <code>umask</code> appropriately (perhaps to ‘<samp>022</samp>’) before unpacking
the sources and throughout the build process.
</p>
<p>After
</p>
<aname="index-configure-2"></a>
<divclass="example">
<preclass="example">./configure
make
make check
</pre></div>
<p>(or, when building outside the source,
<code><var>TOP_SRCDIR</var>/configure</code>, etc) have been completed
successfully, you can install the complete R tree to your system by
typing
</p>
<divclass="example">
<preclass="example">make install
</pre></div>
<p>A parallel make can be used (but run <code>make</code> before <code>make
install</code>). Those using GNU <code>make</code> 4.0 or later may want to use
<code>make -j <var>n</var> -O</code> to avoid interleaving of output.
</p>
<p>This will install to the following directories:
</p>
<dlcompact="compact">
<dt><samp><var>prefix</var>/bin</samp> or <samp><var>bindir</var></samp></dt>
<dd><p>the front-end shell script and other scripts and executables
</p></dd>
<dt><samp><var>prefix</var>/man/man1</samp> or <samp><var>mandir</var>/man1</samp></dt>
<dd><p>the man page
</p></dd>
<dt><samp><var>prefix</var>/<var>LIBnn</var>/R</samp> or <samp><var>libdir</var>/R</samp></dt>
<dd><p>all the rest (libraries, on-line help system, …). Here
<var>LIBnn</var> is usually ‘<samp>lib</samp>’, but may be ‘<samp>lib64</samp>’ on some
64-bit Linux systems. This is known as the R home directory.
</p></dd>
</dl>
<p>where <var>prefix</var> is determined during configuration (typically
<samp>/usr/local</samp>) and can be set by running <code>configure</code> with
<p>You can optionally install the run-time tests that are part of
<code>make check-all</code> by
</p>
<divclass="example">
<preclass="example">make install-tests
</pre></div>
<p>which populates a <samp>tests</samp> directory in the installation.
</p>
<hr>
<aname="Uninstallation"></a>
<divclass="header">
<p>
Next: <ahref="#Sub_002darchitectures"accesskey="n"rel="next">Sub-architectures</a>, Previous: <ahref="#Installation"accesskey="p"rel="prev">Installation</a>, Up: <ahref="#Installing-R-under-Unix_002dalikes"accesskey="u"rel="up">Installing R under Unix-alikes</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Uninstallation-1"></a>
<h3class="section">2.5 Uninstallation</h3>
<p>You can uninstall R by
</p>
<divclass="example">
<preclass="example">make uninstall
</pre></div>
<p>optionally specifying <code>prefix</code> etc in the same way as specified for
installation.
</p>
<p>This will also uninstall any installed manuals. There are specific
targets to uninstall info and PDF manuals in file
<samp>doc/manual/Makefile</samp>.
</p>
<p>Target <code>uninstall-tests</code> will uninstall any installed tests, as
well as removing the directory <samp>tests</samp> containing the test results.
</p>
<p>An installed shared/static <code>libR</code> can be uninstalled by
Next: <ahref="#Other-Options"accesskey="n"rel="next">Other Options</a>, Previous: <ahref="#Uninstallation"accesskey="p"rel="prev">Uninstallation</a>, Up: <ahref="#Installing-R-under-Unix_002dalikes"accesskey="u"rel="up">Installing R under Unix-alikes</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Sub_002darchitectures-1"></a>
<h3class="section">2.6 Sub-architectures</h3>
<p>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 <acronym>CPU</acronym>s or 32- and
64-bit builds.
</p>
<p>R supports the idea of architecture-specific builds, specified by
adding ‘<samp>r_arch=<var>name</var></samp>’ to the <code>configure</code> line. Here
<var>name</var> can be anything non-empty, and is used to name subdirectories
of <samp>lib</samp>, <samp>etc</samp>, <samp>include</samp> and the package <samp>libs</samp>
subdirectories. Example names from other software are the use of
<samp>sparcv9</samp> on Sparc Solaris and <samp>32</samp> by <code>gcc</code> on
‘<samp>x86_64</samp>’ Linux.
</p>
<p>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 ‘<samp>r_arch</samp>’). The space savings can be considerable: on
‘<samp>x86_64</samp>’ 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
</p>
<divclass="example">
<preclass="example">R --arch=<var>name</var>
</pre></div>
<p>and just running ‘<samp>R</samp>’ will run the last build that was installed.
</p>
<p><code>R CMD INSTALL</code> 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 <code>configure</code>
script or a <samp>src/Makefile</samp> file. In such cases you can install for
reconfigures Java and will find the ‘<samp>x86_64</samp>’ Java. If you know
where a 32-bit Java is installed you may be able to run (as root)
</p>
<divclass="example">
<preclass="example">export JAVA_HOME=<path to jre directory of 32-bit Java>
setarch i686 R CMD javareconf
</pre></div>
<p>to get a suitable setting.
</p>
<p>When this mechanism is used, the version of <code>Rscript</code> in
e.g. <samp>/usr/bin</samp> will be the last installed, but an
architecture-specific version will be available in
e.g. <samp>/usr/lib64/R/bin</samp>. Normally all installed architectures
will run on the platform so the architecture of <code>Rscript</code> does
not matter.
</p>
<hr>
<aname="Other-Options"></a>
<divclass="header">
<p>
Next: <ahref="#Testing-a-Unix_002dalike-Installation"accesskey="n"rel="next">Testing a Unix-alike Installation</a>, Previous: <ahref="#Sub_002darchitectures"accesskey="p"rel="prev">Sub-architectures</a>, Up: <ahref="#Installing-R-under-Unix_002dalikes"accesskey="u"rel="up">Installing R under Unix-alikes</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Other-Options-1"></a>
<h3class="section">2.7 Other Options</h3>
<p>There are many other installation options, most of which are listed by
<code>configure --help</code>. Almost all of those not listed elsewhere in
this manual are either standard <code>autoconf</code> options not relevant
to R or intended for specialist uses by the R developers.
</p>
<p>One that may be useful when working on R itself is the option
<samp>--disable-byte-compiled-packages</samp>, which ensures that the base
Previous: <ahref="#Other-Options"accesskey="p"rel="prev">Other Options</a>, Up: <ahref="#Installing-R-under-Unix_002dalikes"accesskey="u"rel="up">Installing R under Unix-alikes</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Testing-an-Installation"></a>
<h3class="section">2.8 Testing an Installation</h3>
<p>These tests work best if <code>diff</code> (in <samp>Rtools*.exe</samp> for
Windows users) is in the path.
</p>
<p>It is possible to test the installed packages (but not their
package-specific tests) by <code>testInstalledPackages</code> even if
<code>make install-tests</code> was not run.
</p>
<p>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)
</p>
<divclass="example">
<preclass="example">LANGUAGE=en
</pre></div>
<p>and use a UTF-8 or Latin-1 locale.
</p>
<hr>
<aname="Installing-R-under-Windows"></a>
<divclass="header">
<p>
Next: <ahref="#Installing-R-under-OS-X"accesskey="n"rel="next">Installing R under OS X</a>, Previous: <ahref="#Installing-R-under-Unix_002dalikes"accesskey="p"rel="prev">Installing R under Unix-alikes</a>, Up: <ahref="#Top"accesskey="u"rel="up">Top</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Installing-R-under-Windows-1"></a>
<h2class="chapter">3 Installing R under Windows</h2>
<aname="index-Installing-under-Windows"></a>
<p>The <samp>bin/windows</samp> directory of a <acronym>CRAN</acronym> site contains
binaries for a base distribution and a large number of add-on packages
from <acronym>CRAN</acronym> to run on 32- or 64-bit Windows (XP or later) on
‘<samp>ix86</samp>’ and ‘<samp>x86_64</samp>’<acronym>CPU</acronym>s.
</p>
<p>Your file system must allow long file names (as is likely except
<tr><tdalign="left"valign="top">•<ahref="#Building-from-source"accesskey="1">Building from source</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Testing-a-Windows-Installation"accesskey="2">Testing a Windows Installation</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
</table>
<hr>
<aname="Building-from-source"></a>
<divclass="header">
<p>
Next: <ahref="#Testing-a-Windows-Installation"accesskey="n"rel="next">Testing a Windows Installation</a>, Previous: <ahref="#Installing-R-under-Windows"accesskey="p"rel="prev">Installing R under Windows</a>, Up: <ahref="#Installing-R-under-Windows"accesskey="u"rel="up">Installing R under Windows</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Building-from-source-1"></a>
<h3class="section">3.1 Building from source</h3>
<p>R can be built as either a 32-bit or 64-bit application on Windows:
to build the 64-bit application you need a 64-bit edition of Windows:
such an OS can also be used to build 32-bit R.
</p>
<p>The standard installer combines 32-bit and 64-bit builds into a single
executable which can then be installed into the same location and share
all the files except the <samp>.exe</samp> and <samp>.dll</samp> files and some
configuration files in the <samp>etc</samp> directory.
</p>
<p>Building is only tested in a 8-bit locale: using a multi-byte locale (as
used for CJK languages) is unsupported and may not work (the scripts do
try to select a ‘<samp>C</samp>’ locale; Windows may not honour this).
</p>
<p><strong>NB:</strong> The build process is currently being changed to require
external binary distributions of third-party software. Their location
is set using macro <code>EXT_LIBS</code> with default setting
<samp>$(LOCAL_SOFT)</samp>; the $(LOCAL_SOFT) macro defaults to
<samp>$(R_HOME)/extsoft</samp>. This directory can be populated using
<code>make rsync-extsoft</code>. The location can be overridden by
setting <code>EXT_LIBS</code> to a different path in
<samp>src/gnuwin32/MkRules.local</samp>. A suitable collection of files can
also be obtained from
<ahref="https://CRAN.R-project.org/bin/windows/extsoft">https://CRAN.R-project.org/bin/windows/extsoft</a> or
<tr><tdalign="left"valign="top">•<ahref="#Getting-the-tools"accesskey="1">Getting the tools</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Getting-the-source-files"accesskey="2">Getting the source files</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Building-the-core-files"accesskey="3">Building the core files</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Building-the-cairo-devices-files"accesskey="4">Building the cairo devices files</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Using-ICU-for-collation"accesskey="5">Using ICU for collation</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Support-for-libcurl"accesskey="6">Support for libcurl</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Checking-the-build"accesskey="7">Checking the build</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Building-the-manuals"accesskey="8">Building the manuals</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Building-the-Inno-Setup-installer"accesskey="9">Building the Inno Setup installer</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Building-the-MSI-installer">Building the MSI installer</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#g_t64_002dbit-Windows-builds">64-bit Windows builds</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
</table>
<hr>
<aname="Getting-the-tools"></a>
<divclass="header">
<p>
Next: <ahref="#Getting-the-source-files"accesskey="n"rel="next">Getting the source files</a>, Previous: <ahref="#Building-from-source"accesskey="p"rel="prev">Building from source</a>, Up: <ahref="#Building-from-source"accesskey="u"rel="up">Building from source</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Getting-the-tools-1"></a>
<h4class="subsection">3.1.1 Getting the tools</h4>
<p>If you want to build R from the sources, you will first need to
collect, install and test an extensive set of tools. See <ahref="#The-Windows-toolset">The Windows toolset</a> (and perhaps updates in
<ahref="https://CRAN.R-project.org/bin/windows/Rtools/">https://CRAN.R-project.org/bin/windows/Rtools/</a>) for details.
</p>
<p>The <samp>Rtools*.exe</samp> executable installer described in <ahref="#The-Windows-toolset">The Windows toolset</a> also includes some source files in addition to the R
source as noted below. You should run it first, to obtain a working
<code>tar</code> and other necessities. Choose a “Full installation”, and
install the extra files into your intended R source directory, e.g.
<samp>C:/R</samp>. The directory name <em>should not contain spaces</em>. We
will call this directory <samp><var>R_HOME</var></samp> below.
</p>
<hr>
<aname="Getting-the-source-files"></a>
<divclass="header">
<p>
Next: <ahref="#Building-the-core-files"accesskey="n"rel="next">Building the core files</a>, Previous: <ahref="#Getting-the-tools"accesskey="p"rel="prev">Getting the tools</a>, Up: <ahref="#Building-from-source"accesskey="u"rel="up">Building from source</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Getting-the-source-files-1"></a>
<h4class="subsection">3.1.2 Getting the source files</h4>
<p>You need to collect the following sets of files:
<ahref="https://www.stats.ox.ac.uk/pub/Rtools">https://www.stats.ox.ac.uk/pub/Rtools</a>. Please make sure you
install the right version: there is a 32-bit version and a 64-bit
version. They should be installed to <samp><var>R_HOME</var></samp>, creating
directory <samp>Tcl</samp> there.
</li></ul>
<hr>
<aname="Building-the-core-files"></a>
<divclass="header">
<p>
Next: <ahref="#Building-the-cairo-devices-files"accesskey="n"rel="next">Building the cairo devices files</a>, Previous: <ahref="#Getting-the-source-files"accesskey="p"rel="prev">Getting the source files</a>, Up: <ahref="#Building-from-source"accesskey="u"rel="up">Building from source</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Building-the-core-files-1"></a>
<h4class="subsection">3.1.3 Building the core files</h4>
<aname="index-TMPDIR-1"></a>
<p>Set the environment variable <code>TMPDIR</code> to the absolute path to a
writable directory, with a path specified with forward slashes and no
spaces. (The default is <samp>/tmp</samp>, which may not be useful on
Windows.)
</p>
<p>You may need to compile under a case-honouring file system: we found
that a <code>samba</code>-mounted file system (which maps all file names to
lower case) did not work.
</p>
<p>Open a command window at <samp><var>R_HOME</var>/src/gnuwin32</samp>, then run
</p>
<divclass="example">
<preclass="example">make all recommended vignettes
</pre></div>
<p>and sit back and wait while the basic compile takes place.
</p>
<p>Notes:
</p><ul>
<li> We have had reports that earlier versions of anti-virus software locking
up the machine, but not for several years. However, aggressive
anti-virus checking such as the on-access scanning of Sophos can slow
the build down several-fold.
</li><li> You can run a parallel make by e.g.
<divclass="example">
<preclass="example">make -j4 all
make -j4 recommended
make vignettes
</pre></div>
<p>but this is only likely to be worthwhile on a multi-core machine with
ample memory, and is not 100% reliable.
</p>
</li><li> It is possible (mainly for those working on R itself) to set the
(make or environment) variable <code>R_NO_BASE_COMPILE</code> to a non-empty
value, which inhibits the byte-compilation of the base and recommended
packages.
</li></ul>
<hr>
<aname="Building-the-cairo-devices-files"></a>
<divclass="header">
<p>
Next: <ahref="#Using-ICU-for-collation"accesskey="n"rel="next">Using ICU for collation</a>, Previous: <ahref="#Building-the-core-files"accesskey="p"rel="prev">Building the core files</a>, Up: <ahref="#Building-from-source"accesskey="u"rel="up">Building from source</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Building-the-cairo-devices"></a>
<h4class="subsection">3.1.4 Building the cairo devices</h4>
<aname="index-winCairo_002edll"></a>
<p>The devices based on cairographics (<code>svg</code>, <code>cairo_pdf</code>,
<code>cairo_ps</code> and the <code>type = "cairo"</code> versions of <code>png</code>,
<code>jpeg</code>, <code>tiff</code> and <code>bmp</code>) are implemented in a separate
DLL <samp>winCairo.dll</samp> which is loaded when one of these devices is
first used. It is not built by default, and needs to be built (after
<code>make all</code>) by <code>make cairodevices</code>.
</p>
<p>To enable the building of these devices you need to install the static
cairographics libraries built by Simon Urbanek at
<ahref="https://www.rforge.net/Cairo/files/cairo-current-win.tar.gz">https://www.rforge.net/Cairo/files/cairo-current-win.tar.gz</a>. Set
the macro ‘<samp>CAIRO_HOME</samp>’ in <samp>MkRules.local</samp>. (Note that this
tarball unpacks with a top-level directory <samp>src/</samp>:
‘<samp>CAIRO_HOME</samp>’ needs to include that directory in its path.)
</p>
<hr>
<aname="Using-ICU-for-collation"></a>
<divclass="header">
<p>
Next: <ahref="#Support-for-libcurl"accesskey="n"rel="next">Support for libcurl</a>, Previous: <ahref="#Building-the-cairo-devices-files"accesskey="p"rel="prev">Building the cairo devices files</a>, Up: <ahref="#Building-from-source"accesskey="u"rel="up">Building from source</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Using-ICU-for-collation-1"></a>
<h4class="subsection">3.1.5 Using ICU for collation</h4>
<p>It is recommended to build R to support ICU (International Components
for Unicode, <ahref="http://site.icu-project.org/">http://site.icu-project.org/</a>) for collation, as is
commonly done on Unix-alikes.
</p>
<p>Two settings are needed in <samp>MkRules.local</samp>,
</p><divclass="example">
<preclass="example"># set to use ICU
# USE_ICU = YES
# path to parent of ICU headers
ICU_PATH = /path/to/ICU
</pre></div>
<p>The first should be uncommented and the second set to the top-level
directory of a suitably packaged binary build of ICU, for example that
at <ahref="https://www.stats.ox.ac.uk/pub/Rtools/goodies/ICU_531.zip">https://www.stats.ox.ac.uk/pub/Rtools/goodies/ICU_531.zip</a>.
Depending on the build, it may be necessary to edit the macro
<code>ICU_LIBS</code>.
</p>
<p>Unlike on a Unix-alike, it is normally necessary to call
<code>icuSetCollate</code> to set a locale before ICU is actually used for
collation, or set the environment variable <code>R_ICU_LOCALE</code>.
</p>
<hr>
<aname="Support-for-libcurl"></a>
<divclass="header">
<p>
Next: <ahref="#Checking-the-build"accesskey="n"rel="next">Checking the build</a>, Previous: <ahref="#Using-ICU-for-collation"accesskey="p"rel="prev">Using ICU for collation</a>, Up: <ahref="#Building-from-source"accesskey="u"rel="up">Building from source</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Support-for-libcurl-1"></a>
<h4class="subsection">3.1.6 Support for libcurl</h4>
<p><code>libcurl</code> version 7.28.0 or later can be used to support
<code>curlGetHeaders</code> and the <code>"libcurl"</code> methods of
<code>download.file</code> and <code>url</code>.
</p>
<p>A suitable distribution can be found <em>via</em>
<ahref="https://www.stats.ox.ac.uk/pub/Rtools/libs.html">https://www.stats.ox.ac.uk/pub/Rtools/libs.html</a> and its unpacked
location should be specified in file <samp>MkRules.local</samp>.
</p>
<p>For secure use of e.g. ‘<samp>https://</samp>’ URLs Windows users may need to
specify the path to up-to-date <em>CA root certificates</em>: see
<code>?download.file</code>.
</p>
<hr>
<aname="Checking-the-build"></a>
<divclass="header">
<p>
Next: <ahref="#Building-the-manuals"accesskey="n"rel="next">Building the manuals</a>, Previous: <ahref="#Support-for-libcurl"accesskey="p"rel="prev">Support for libcurl</a>, Up: <ahref="#Building-from-source"accesskey="u"rel="up">Building from source</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Checking-the-build-1"></a>
<h4class="subsection">3.1.7 Checking the build</h4>
<p>You can test a build by running
</p>
<divclass="example">
<preclass="example">make check
</pre></div>
<p>The recommended packages can be checked by
</p>
<divclass="example">
<preclass="example">make check-recommended
</pre></div>
<p>Other levels of checking are
</p>
<divclass="example">
<preclass="example">make check-devel
</pre></div>
<p>for a more thorough check of the R functionality, and
</p>
<divclass="example">
<preclass="example">make check-all
</pre></div>
<p>for both <code>check-devel</code> and <code>check-recommended</code>.
</p>
<p>If a test fails, there will almost always be a <samp>.Rout.fail</samp> file in
the directory being checked (often <samp>tests/Examples</samp> or
<samp>tests</samp>): examine the file to help pinpoint the problem.
</p>
<p>Parallel checking of package sources (part of <code>make check-devel</code>
and <code>make check-recommended</code>) is possible: see the environment
variable <code>TEST_MC_CORES</code> to the maximum number of processes to be
run in parallel.
</p>
<hr>
<aname="Building-the-manuals"></a>
<divclass="header">
<p>
Next: <ahref="#Building-the-Inno-Setup-installer"accesskey="n"rel="next">Building the Inno Setup installer</a>, Previous: <ahref="#Checking-the-build"accesskey="p"rel="prev">Checking the build</a>, Up: <ahref="#Building-from-source"accesskey="u"rel="up">Building from source</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Building-the-manuals-1"></a>
<h4class="subsection">3.1.8 Building the manuals</h4>
<p>The PDF manuals require <strong>texinfo</strong> 5.1 or later, and can be made by
</p>
<divclass="example">
<preclass="example">make manuals
</pre></div>
<p>If you want to make the info versions (not including the Reference
Manual), use
</p>
<divclass="example">
<preclass="example">cd ../../doc/manual
make -f Makefile.win info
</pre></div>
<p>(all assuming you have <code>pdftex</code>/<code>pdflatex</code> installed and
in your path).
</p>
<p>See the <ahref="#Making-the-manuals">Making the manuals</a> section in the Unix-alike section for setting
options such as the paper size and the fonts used.
</p>
<p>By default it is assumed that <strong>texinfo</strong> is not installed, and the
manuals will not be built. The comments in file <samp>MkRules.dist</samp>
describe settings to build them. (Copy that file to
<samp>MkRules.local</samp> and edit it.) The <strong>texinfo</strong> 5.x package for
use on Windows is available at
<ahref="https://www.stats.ox.ac.uk/pub/Rtools/">https://www.stats.ox.ac.uk/pub/Rtools/</a>: you will also need to
Next: <ahref="#Building-the-MSI-installer"accesskey="n"rel="next">Building the MSI installer</a>, Previous: <ahref="#Building-the-manuals"accesskey="p"rel="prev">Building the manuals</a>, Up: <ahref="#Building-from-source"accesskey="u"rel="up">Building from source</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Building-the-Inno-Setup-installer-1"></a>
<h4class="subsection">3.1.9 Building the Inno Setup installer</h4>
<p>You need to have the files for a complete R build, including bitmap and
Tcl/Tk support and the manuals (which requires <strong>texinfo</strong> installed),
as well as the recommended packages and Inno Setup (see <ahref="#The-Inno-Setup-installer">The Inno Setup installer</a>).
</p>
<p>Once everything is set up
</p>
<divclass="example">
<preclass="example">make distribution
make check-all
</pre></div>
<p>will make all the pieces and the installer and put them in the
<samp>gnuwin32/cran</samp> subdirectory, then check the build. This works by
building all the parts in the sequence:
</p>
<divclass="example">
<preclass="example">rbuild <spanclass="roman">(the executables, the <acronym>FAQ</acronym> docs etc.)</span>
rpackages <spanclass="roman">(the base packages)</span>
htmldocs <spanclass="roman">(the HTML documentation)</span>
<p>will create an installer that defaults to installing R to run in SDI
mode. See <samp>src/gnuwin32/installer/Makefile</samp> for the names and
values that can be set.
</p>
<p>The standard <acronym>CRAN</acronym> distribution of a 32/64-bit installer is
made by first building 32-bit R (just
</p>
<divclass="example">
<preclass="example">make 32-bit
</pre></div>
<p>is needed), and then (in a separate directory) building 64-bit R with
the macro <code>HOME32</code> set in file <samp>MkRules.local</samp> to the
top-level directory of the 32-bit build. Then the <code>make
rinstaller</code> step copies the files that differ between architectures from
the 32-bit build as it builds the installer image.
</p>
<hr>
<aname="Building-the-MSI-installer"></a>
<divclass="header">
<p>
Next: <ahref="#g_t64_002dbit-Windows-builds"accesskey="n"rel="next">64-bit Windows builds</a>, Previous: <ahref="#Building-the-Inno-Setup-installer"accesskey="p"rel="prev">Building the Inno Setup installer</a>, Up: <ahref="#Building-from-source"accesskey="u"rel="up">Building from source</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Building-the-MSI-installer-1"></a>
<h4class="subsection">3.1.10 Building the MSI installer</h4>
<p>It is also possible to build an installer for use with Microsoft
Installer. This is intended for use by sysadmins doing automated
installs, and is not recommended for casual use.
</p>
<p>It makes use of the Windows Installer XML (WiX) toolkit <em>version
3.5</em> (or perhaps later, untested) available from
<ahref="http://wixtoolset.org/">http://wixtoolset.org/</a>. Once WiX is installed, set the path to
its home directory in <samp>MkRules.local</samp>.
</p>
<p>You need to have the files for a complete R build, including bitmap and
Tcl/Tk support and the manuals, as well as the recommended packages.
There is no option in the installer to customize startup options, so
edit <samp>etc/Rconsole</samp> and <samp>etc/Rprofile.site</samp> to set these as
<p>Thanks to David del Campo (Dept of Statistics, University of Oxford)
for suggesting WiX and building a prototype installer.
</p>
<hr>
<aname="g_t64_002dbit-Windows-builds"></a>
<divclass="header">
<p>
Previous: <ahref="#Building-the-MSI-installer"accesskey="p"rel="prev">Building the MSI installer</a>, Up: <ahref="#Building-from-source"accesskey="u"rel="up">Building from source</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="g_t64_002dbit-Windows-builds-1"></a>
<h4class="subsection">3.1.11 64-bit Windows builds</h4>
<p>To build a 64-bit version of R you need a 64-bit toolchain: the only one
discussed here is based on the work of the MinGW-w64 project
(<ahref="http://sourceforge.net/projects/mingw-w64/">http://sourceforge.net/projects/mingw-w64/</a>, but commercial
compilers such as those from Intel and PGI could be used (and have been
by R redistributors).
</p>
<p>Support for MinGW-w64 was developed in the R sources over the period
2008–10 and was first released as part of R 2.11.0. The assistance
of Yu Gong at a crucial step in porting R to MinGW-w64 is gratefully
acknowledged, as well as help from Kai Tietz, the lead developer of the
MinGW-w64 project.
</p>
<p>Windows 64-bit is now completely integrated into the R and package
build systems: a 64-bit build is selected in file <samp>MkRules.local</samp>.
</p>
<hr>
<aname="Testing-a-Windows-Installation"></a>
<divclass="header">
<p>
Previous: <ahref="#Building-from-source"accesskey="p"rel="prev">Building from source</a>, Up: <ahref="#Installing-R-under-Windows"accesskey="u"rel="up">Installing R under Windows</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Testing-an-Installation-1"></a>
<h3class="section">3.2 Testing an Installation</h3>
<p>The Windows installer contains a set of test files used when building
R.
</p>
<p>The <code>Rtools</code> are not needed to run these tests. but more
comprehensive analysis of errors will be given if <code>diff</code> is in
the path (and <code>errorsAreFatal = FALSE</code> is then not needed below).
</p>
<p>Launch either <code>Rgui</code> or <code>Rterm</code>, preferably with
<samp>--vanilla</samp>. Then run
</p>
<divclass="example">
<preclass="example">Sys.setenv(LC_COLLATE = "C", LANGUAGE = "en")
<p>runs the basic tests and then all the tests on the standard and
recommended packages. These tests can be run from anywhere: they write
some of their results in the <samp>tests</samp> folder of the R home
directory (as given by <code>R.home()</code>), and hence may need to be run
under the account used to install R.
</p>
<p>The results of <code>example(md5sums)</code> when testing <strong>tools</strong> will
differ from the reference output as some files are installed with
Windows’ CRLF line endings.
</p>
<hr>
<aname="Installing-R-under-OS-X"></a>
<divclass="header">
<p>
Next: <ahref="#Running-R"accesskey="n"rel="next">Running R</a>, Previous: <ahref="#Installing-R-under-Windows"accesskey="p"rel="prev">Installing R under Windows</a>, Up: <ahref="#Top"accesskey="u"rel="up">Top</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Installing-R-under-OS-X-1"></a>
<h2class="chapter">4 Installing R under OS X</h2>
<aname="index-OS-X-1"></a>
<p>The front page of a <acronym>CRAN</acronym> site has a link ‘Download R for OS
<tr><tdalign="left"valign="top">•<ahref="#Running-R-under-OS-X"accesskey="1">Running R under OS X</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Uninstalling-under-OS-X"accesskey="2">Uninstalling under OS X</a>:</td><td> </td><tdalign="left"valign="top">
Next: <ahref="#Uninstalling-under-OS-X"accesskey="n"rel="next">Uninstalling under OS X</a>, Previous: <ahref="#Installing-R-under-OS-X"accesskey="p"rel="prev">Installing R under OS X</a>, Up: <ahref="#Installing-R-under-OS-X"accesskey="u"rel="up">Installing R under OS X</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Running-R-under-OS-X-1"></a>
<h3class="section">4.1 Running R under OS X</h3>
<p>There are two ways to run R on OS X from a <acronym>CRAN</acronym> binary
distribution.
</p>
<p>There is a GUI console normally installed with the R icon in
<samp>/Applications</samp> which you can run by double-clicking (e.g. from
Launchpad or Finder). (If you cannot find it there it was possibly
installed elsewhere so try searching for it in Spotlight.) This is
usually referred to as <small>R.APP</small> to distinguish it from command-line R:
its user manual is currently part of the OS X FAQ at
<ahref="https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html">https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html</a> and
can be viewed from <small>R.APP</small>’s ‘Help’ menu.
<p>Using the <code>X11</code> device or the X11-based versions of <code>View()</code>
and <code>edit()</code> for data frames and matrices (the latter are the
default for command-line R but not <small>R.APP</small>) requires an X sub-system
to be installed: see <ahref="#OS-X">OS X</a>. (As do the <strong>tcltk</strong> package and
some third-party packages.)
</p>
<hr>
<aname="Uninstalling-under-OS-X"></a>
<divclass="header">
<p>
Next: <ahref="#Multiple-versions"accesskey="n"rel="next">Multiple versions</a>, Previous: <ahref="#Running-R-under-OS-X"accesskey="p"rel="prev">Running R under OS X</a>, Up: <ahref="#Installing-R-under-OS-X"accesskey="u"rel="up">Installing R under OS X</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Uninstalling-under-OS-X-1"></a>
<h3class="section">4.2 Uninstalling under OS X</h3>
<p>R for OS X consists of two parts: the GUI (<small>R.APP</small>) and the R
framework. The un-installation is as simple as removing those folders
(e.g. by dragging them into the Trash). The typical installation will
install the GUI into the <samp>/Applications/R.app</samp> folder and the R
framework into the <samp>/Library/Frameworks/R.framework</samp> folder. The
links to <samp>R</samp> and <samp>Rscript</samp> in <samp>/usr/bin</samp> or
<samp>/usr/local/bin</samp> should also be removed.
</p>
<p>If you want to get rid of R more completely using a Terminal, simply
Previous: <ahref="#Uninstalling-under-OS-X"accesskey="p"rel="prev">Uninstalling under OS X</a>, Up: <ahref="#Installing-R-under-OS-X"accesskey="u"rel="up">Installing R under OS X</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Multiple-versions-1"></a>
<h3class="section">4.3 Multiple versions</h3>
<p>The installer will remove any previous version of the R framework
which it finds installed. This can be avoided by using <code>pkgutil
--forget</code> (see the previous section). However, note that different
versions are installed under
<samp>/Library/Frameworks/R.framework/Versions</samp> as <samp>3.2</samp>,
<samp>3.3</samp> and so on, so it is not possible to have different
‘<samp>3.x.y</samp>’ versions installed for the same ‘<samp>x</samp>’.
</p>
<p>A version of R can be run directly from the command-line as e.g.
<p>However, <small>R.APP</small> will always run the ‘current’ version, that is the last
installed version. A small utility, <code>Rswitch.app</code> (available at
<ahref="https://r.research.att.com/#other">https://r.research.att.com/#other</a>), can be used to change the
‘current’ version. This is of limited use as <small>R.APP</small> 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 <small>R.APP</small>) and then switch back to the
release version.
</p>
<hr>
<aname="Running-R"></a>
<divclass="header">
<p>
Next: <ahref="#Add_002don-packages"accesskey="n"rel="next">Add-on packages</a>, Previous: <ahref="#Installing-R-under-OS-X"accesskey="p"rel="prev">Installing R under OS X</a>, Up: <ahref="#Top"accesskey="u"rel="up">Top</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Running-R-1"></a>
<h2class="chapter">5 Running R</h2>
<p>How to start R and what command-line options are available is discussed
in <ahref="./R-intro.html#Invoking-R">Invoking R</a> in <cite>An Introduction to R</cite>.
</p>
<p>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
<code>ulimit</code> (<code>sh</code>/<code>bash</code>) or <code>limit</code>
(<code>csh</code>/<code>tcsh</code>) to check.)
</p>
<p>R makes use of a number of environment variables, the default values
of many of which are set in file <samp><var>R_HOME</var>/etc/Renviron</samp> (there
are none set by default on Windows and hence no such file). These are
set at <code>configure</code> time, and you would not normally want to
<aname="index-R_005fPAPERSIZE-1"></a>
change them – a possible exception is <code>R_PAPERSIZE</code> (see <ahref="#Setting-paper-size">Setting paper size</a>). The paper size will be deduced from the ‘<samp>LC_PAPER</samp>’
locale category if it exists and <code>R_PAPERSIZE</code> is unset, and this
will normally produce the right choice from ‘<samp>a4</samp>’ and ‘<samp>letter</samp>’
on modern Unix-alikes (but can always be overridden by setting
<code>R_PAPERSIZE</code>).
</p>
<p>Various environment variables can be set to determine where R creates
its per-session temporary directory. The environment variables
<aname="index-TMPDIR-2"></a>
<aname="index-TMP"></a>
<aname="index-TEMP"></a>
<code>TMPDIR</code>, <code>TMP</code> and <code>TEMP</code> 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 <samp>/tmp</samp> on Unix-alikes and the value of
<aname="index-R_005fUSER"></a>
<code>R_USER</code> on Windows. The path should be an absolute path not
containing spaces (and it is best to avoid non-alphanumeric characters
such as <code>+</code>).
</p>
<p>Some Unix-alike systems are set up to remove files and directories
periodically from <samp>/tmp</samp>, for example by a <code>cron</code> job
<aname="index-TMPDIR-3"></a>
running <code>tmpwatch</code>. Set <code>TMPDIR</code> to another directory
before starting long-running jobs on such a system.
</p>
<p>Note that <code>TMPDIR</code> will be used to execute <code>configure</code>
scripts when installing packages, so if <samp>/tmp</samp> has been mounted as
‘<samp>noexec</samp>’, <code>TMPDIR</code> needs to be set to a directory from which
execution is allowed.
</p>
<hr>
<aname="Add_002don-packages"></a>
<divclass="header">
<p>
Next: <ahref="#Internationalization"accesskey="n"rel="next">Internationalization</a>, Previous: <ahref="#Running-R"accesskey="p"rel="prev">Running R</a>, Up: <ahref="#Top"accesskey="u"rel="up">Top</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
<tr><tdalign="left"valign="top">•<ahref="#Setting-up-a-package-repository"accesskey="6">Setting up a package repository</a>:</td><td> </td><tdalign="left"valign="top">
Packages using Gtk+ (<ahref="https://CRAN.R-project.org/package=Cairo"><strong>Cairo</strong></a>, <ahref="https://CRAN.R-project.org/package=RGtk2"><strong>RGtk2</strong></a>,
<ahref="https://CRAN.R-project.org/package=cairoDevice"><strong>cairoDevice</strong></a> and those that depend on them) need the <samp>bin</samp>
directory of a bundled distribution of Gtk2 from
<ahref="http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+">http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+</a> or
<ahref="http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+">http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+</a> in
the path: it should work to have both 32- and 64-bit Gtk+ <samp>bin</samp>
Next: <ahref="#Setting-up-a-package-repository"accesskey="n"rel="next">Setting up a package repository</a>, Previous: <ahref="#Updating-packages"accesskey="p"rel="prev">Updating packages</a>, Up: <ahref="#Add_002don-packages"accesskey="u"rel="up">Add-on packages</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Removing-packages-1"></a>
<h3class="section">6.5 Removing packages</h3>
<aname="index-remove_002epackages"></a>
<aname="index-Packages_002c-removing"></a>
<p>Packages can be removed in a number of ways. From a command prompt they
<p>—once again <code>write_PACKAGES</code> is the simplest way to set this up.
</p>
<hr>
<aname="Checking-installed-source-packages"></a>
<divclass="header">
<p>
Previous: <ahref="#Setting-up-a-package-repository"accesskey="p"rel="prev">Setting up a package repository</a>, Up: <ahref="#Add_002don-packages"accesskey="u"rel="up">Add-on packages</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
<p>and <samp>--build</samp> can be added to zip up the installation.
</p>
<hr>
<aname="Internationalization"></a>
<divclass="header">
<p>
Next: <ahref="#Choosing-between-32_002d-and-64_002dbit-builds"accesskey="n"rel="next">Choosing between 32- and 64-bit builds</a>, Previous: <ahref="#Add_002don-packages"accesskey="p"rel="prev">Add-on packages</a>, Up: <ahref="#Top"accesskey="u"rel="up">Top</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
<tr><tdalign="left"valign="top">•<ahref="#Localization-of-messages"accesskey="2">Localization of messages</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
</table>
<hr>
<aname="Locales"></a>
<divclass="header">
<p>
Next: <ahref="#Localization-of-messages"accesskey="n"rel="next">Localization of messages</a>, Previous: <ahref="#Internationalization"accesskey="p"rel="prev">Internationalization</a>, Up: <ahref="#Internationalization"accesskey="u"rel="up">Internationalization</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Locales-1"></a>
<h3class="section">7.1 Locales</h3>
<aname="index-Locale-1"></a>
<p>A <em>locale</em> 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 <code>Sys.getlocale</code> and
<code>Sys.localeconv</code>.
</p>
<p>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
</p><ul>
<li> A human language. These are generally specified by a lower-case
two-character abbreviation following ISO 639 (see e.g.
<tr><tdalign="left"valign="top">•<ahref="#Locales-under-Unix_002dalikes"accesskey="1">Locales under Unix-alikes</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Locales-under-Windows"accesskey="2">Locales under Windows</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Locales-under-OS-X"accesskey="3">Locales under OS X</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
</table>
<hr>
<aname="Locales-under-Unix_002dalikes"></a>
<divclass="header">
<p>
Next: <ahref="#Locales-under-Windows"accesskey="n"rel="next">Locales under Windows</a>, Previous: <ahref="#Locales"accesskey="p"rel="prev">Locales</a>, Up: <ahref="#Locales"accesskey="u"rel="up">Locales</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Locales-under-Unix_002dalikes-1"></a>
<h4class="subsection">7.1.1 Locales under Unix-alikes</h4>
‘<samp>de_AT.iso885915@euro</samp>’, the components being in the order listed
above. (See <code>man locale</code> and <code>locale -a</code> for more
details.) Similar schemes are used by most Unix-alikes: some (including
some distributions of Linux) use ‘<samp>.utf8</samp>’ rather than ‘<samp>.UTF-8</samp>’.
</p>
<p>Note that whereas UTF-8 locales are nowadays almost universally used,
locales such as ‘<samp>en_GB</samp>’ use 8-bit encodings for backwards
compatibility.
</p>
<hr>
<aname="Locales-under-Windows"></a>
<divclass="header">
<p>
Next: <ahref="#Locales-under-OS-X"accesskey="n"rel="next">Locales under OS X</a>, Previous: <ahref="#Locales-under-Unix_002dalikes"accesskey="p"rel="prev">Locales under Unix-alikes</a>, Up: <ahref="#Locales"accesskey="u"rel="up">Locales</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Locales-under-Windows-1"></a>
<h4class="subsection">7.1.2 Locales under Windows</h4>
<p>Windows also uses locales, but specified in a rather less concise way.
Most users will encounter locales only via drop-down menus, but more
(or if Microsoft moves it yet again, search for ‘<samp>Windows language
country strings</samp>’).
</p>
<p>It offers only one encoding per language.
</p>
<p>Some care is needed with Windows’ locale names. For example,
<code>chinese</code> is Traditional Chinese and not Simplified Chinese as used
in most of the Chinese-speaking world.
</p>
<hr>
<aname="Locales-under-OS-X"></a>
<divclass="header">
<p>
Previous: <ahref="#Locales-under-Windows"accesskey="p"rel="prev">Locales under Windows</a>, Up: <ahref="#Locales"accesskey="u"rel="up">Locales</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Locales-under-OS-X-1"></a>
<h4class="subsection">7.1.3 Locales under OS X</h4>
<p>OS X supports locales in its own particular way, but the R GUI tries to
(e.g., ‘<samp>gray</samp>’) in the standard messages into English.<aname="DOCF23"href="#FOOT23"><sup>23</sup></a> Two other examples: there are catalogues
<p>So, for speed you may want to use a 32-bit build (especially on a
laptop), but to handle large datasets (and perhaps large files) a 64-bit
build. You can often build both and install them in the same place:
See <ahref="#Sub_002darchitectures">Sub-architectures</a>. (This is done for the Windows binary
distributions.)
</p>
<p>Even on 64-bit builds of R there are limits on the size of R
objects (see <code>help("Memory-limits")</code>, some of which stem from the
use of 32-bit integers (especially in FORTRAN code). For example, the
dimensions of an array are limited to <em>2^{31} - 1</em>.
</p>
<hr>
<aname="The-standalone-Rmath-library"></a>
<divclass="header">
<p>
Next: <ahref="#Essential-and-useful-other-programs-under-a-Unix_002dalike"accesskey="n"rel="next">Essential and useful other programs under a Unix-alike</a>, Previous: <ahref="#Choosing-between-32_002d-and-64_002dbit-builds"accesskey="p"rel="prev">Choosing between 32- and 64-bit builds</a>, Up: <ahref="#Top"accesskey="u"rel="up">Top</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="The-standalone-Rmath-library-1"></a>
<h2class="chapter">9 The standalone Rmath library</h2>
Next: <ahref="#Configuration-on-a-Unix_002dalike"accesskey="n"rel="next">Configuration on a Unix-alike</a>, Previous: <ahref="#The-standalone-Rmath-library"accesskey="p"rel="prev">The standalone Rmath library</a>, Up: <ahref="#Top"accesskey="u"rel="up">Top</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
<tr><tdalign="left"valign="top">•<ahref="#Essential-programs-and-libraries"accesskey="1">Essential programs and libraries</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Useful-libraries-and-programs"accesskey="2">Useful libraries and programs</a>:</td><td> </td><tdalign="left"valign="top">
Next: <ahref="#Useful-libraries-and-programs"accesskey="n"rel="next">Useful libraries and programs</a>, Previous: <ahref="#Essential-and-useful-other-programs-under-a-Unix_002dalike"accesskey="p"rel="prev">Essential and useful other programs under a Unix-alike</a>, Up: <ahref="#Essential-and-useful-other-programs-under-a-Unix_002dalike"accesskey="u"rel="up">Essential and useful other programs under a Unix-alike</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Essential-programs-and-libraries-1"></a>
<h3class="section">A.1 Essential programs and libraries</h3>
<p>You need a means of compiling C and FORTRAN 90 (see <ahref="#Using-FORTRAN">Using FORTRAN</a>). Your C compiler should be
<acronym>ISO</acronym>/<acronym>IEC</acronym> 60059<aname="DOCF29"href="#FOOT29"><sup>29</sup></a>, POSIX 1003.1 and C99-compliant.<aname="DOCF30"href="#FOOT30"><sup>30</sup></a> R tries to choose suitable flags for
recent Fedora/RedHat distributions it means (at least) RPMs
‘<samp>libX11</samp>’, ‘<samp>libX11-devel</samp>’, ‘<samp>libXt</samp>’ and ‘<samp>libXt-devel</samp>’.
On Debian/Ubuntu we recommend the meta-package ‘<samp>xorg-dev</samp>’. If you
really do not want these you will need to explicitly configure R
functions<aname="DOCF34"href="#FOOT34"><sup>34</sup></a> are essential, and others<aname="DOCF35"href="#FOOT35"><sup>35</sup></a> will be used if available.
</p>
<p>Installations of <code>zlib</code> (version 1.2.5 or later), <code>libbz2</code>
(version 1.0.6 or later: called <strong>bzip2-libs</strong>/<strong>bzip2-devel</strong> or
<strong>libbz2-1.0</strong>/<strong>libbz2-dev</strong> by some Linux distributions),
<code>liblzma</code><aname="DOCF36"href="#FOOT36"><sup>36</sup></a> version 5.0.3 or
later are required.
</p>
<p>PCRE<aname="DOCF37"href="#FOOT37"><sup>37</sup></a> (version 8.32 or later, although versions 8.10–8.31 will
be accepted with a deprecation warning) is required (or just its library
and headers if packaged separately). PCRE must be built with UTF-8
support (not the default, and checked by <code>configure</code>) and
support for Unicode properties is assumed by some R packages. JIT
support is desirable for the best performance: support for this and
Unicode properties can be checked at run-time by calling
<code>pcre_config()</code>. If building PCRE for use with R a suitable
<strong>collection-latexrecommended</strong>, <strong>collection-fontsextra</strong> and
<strong>collection-latexextra</strong> (assuming they are not installed by
default): Fedora uses names like <strong>texlive-collection-fontsextra</strong> and
Debian/Ubuntu like <strong>texlive-fonts-extra</strong>.
</p>
<aname="index-PATH"></a>
<p>The essential programs should be in your <code>PATH</code> at the time
<code>configure</code> is run: this will capture the full paths.
</p>
<hr>
<aname="Useful-libraries-and-programs"></a>
<divclass="header">
<p>
Next: <ahref="#Linear-algebra"accesskey="n"rel="next">Linear algebra</a>, Previous: <ahref="#Essential-programs-and-libraries"accesskey="p"rel="prev">Essential programs and libraries</a>, Up: <ahref="#Essential-and-useful-other-programs-under-a-Unix_002dalike"accesskey="u"rel="up">Essential and useful other programs under a Unix-alike</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Useful-libraries-and-programs-1"></a>
<h3class="section">A.2 Useful libraries and programs</h3>
<p>The ability to use translated messages makes use of <code>gettext</code> and
most likely needs <acronym>GNU</acronym><code>gettext</code>: you do need this to work
with new translations, but otherwise the version contained in the R
sources will be used if no suitable external <code>gettext</code> is found.
</p>
<p>The ‘modern’ version of the <code>X11()</code>, <code>jpeg()</code>, <code>png()</code>
and <code>tiff()</code> graphics devices uses the <code>cairo</code> and
(optionally) <code>Pango</code> libraries. Cairo version 1.2.0 or later is
required. Pango needs to be at least version 1.10, and 1.12 is the
earliest version we have tested. (For Fedora users we believe the
<code>pango-devel</code> RPM and its dependencies suffice.) R checks for
<code>pkg-config</code>, and uses that to check first that the
‘<samp>pangocairo</samp>’ package is installed (and if not, ‘<samp>cairo</samp>’) and if
additional flags are needed for the ‘<samp>cairo-xlib</samp>’ package, then if
suitable code can be compiled. These tests will fail if
<ahref="https://fedorahosted.org/liberation-fonts/">https://fedorahosted.org/liberation-fonts/</a>,<aname="DOCF43"href="#FOOT43"><sup>43</sup></a> which cover the Latin, Greek and Cyrillic alphabets
<p>Note that the <samp>tk.h</samp> header includes<aname="DOCF44"href="#FOOT44"><sup>44</sup></a> X11 headers, so you will need X11 and its
development files installed.
</p>
<hr>
<aname="Java-support"></a>
<divclass="header">
<p>
Next: <ahref="#Other-compiled-languages"accesskey="n"rel="next">Other compiled languages</a>, Previous: <ahref="#Tcl_002fTk"accesskey="p"rel="prev">Tcl/Tk</a>, Up: <ahref="#Useful-libraries-and-programs"accesskey="u"rel="up">Useful libraries and programs</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Java-support-1"></a>
<h4class="subsection">A.2.2 Java support</h4>
<p>The build process looks for Java support on the host system, and if it
finds it sets some settings which are useful for Java-using packages
(such as <ahref="https://CRAN.R-project.org/package=rJava"><strong>rJava</strong></a> and <ahref="https://CRAN.R-project.org/package=JavaGD"><strong>JavaGD</strong></a>). This check can be
suppressed by configure option <samp>--disable-java</samp>.
<aname="index-JAVA_005fHOME"></a>
Configure variable <code>JAVA_HOME</code> can be set to point to a specific
JRE/JDK, on the <code>configure</code> command line or in the environment.
</p>
<p>Principal amongst these settings are some library paths to the Java
libraries and JVM, which are stored in environment variable
Previous: <ahref="#Java-support"accesskey="p"rel="prev">Java support</a>, Up: <ahref="#Useful-libraries-and-programs"accesskey="u"rel="up">Useful libraries and programs</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Other-compiled-languages-1"></a>
<h4class="subsection">A.2.3 Other compiled languages</h4>
<p>Some add-on packages need a C++ compiler. This is specified by the
configure variables <code>CXX</code>, <code>CXXFLAGS</code> and similar.
<code>configure</code> will normally find a suitable compiler. However, in
most cases this will be a C++98 compiler, and as from R 3.1.0 it is
possible to specify an alternative compiler for use with C++11 by the
configure variables <code>CXX1X</code>, <code>CXX1XSTD</code>, <code>CXX1XFLAGS</code> and
similar. Again, <code>configure</code> will normally find a suitable value
for <code>CXX1XSTD</code> if the compiler given by <code>CXX</code> is capable of
compiling C++11 code, but it is possible that a completely different
compiler will be needed.
</p>
<p>Other packages need full Fortran 90 (or later) support. For source
files with extension <samp>.f90</samp> or <samp>.f95</samp>, the compiler defined by
the macro <code>FC</code> is used by <code>R CMD INSTALL</code>. This is found
when R is configured and is often the same as <code>F77</code>: note that
it is detected by the name of the command without a test that it can
actually compile Fortran 90 code. Set the configure variable <code>FC</code>
to override this if necessary: variables <code>FCFLAGS</code>,
<code>FCPICFLAGS</code>, <code>FCLIBS</code>, <code>SHLIB_FCLD</code> and
<code>SHLIB_FCLDFLAGS</code> might also need to be set.
</p>
<p>See file <samp>config.site</samp> in the R source for more details about
these variables.
</p>
<hr>
<aname="Linear-algebra"></a>
<divclass="header">
<p>
Previous: <ahref="#Useful-libraries-and-programs"accesskey="p"rel="prev">Useful libraries and programs</a>, Up: <ahref="#Essential-and-useful-other-programs-under-a-Unix_002dalike"accesskey="u"rel="up">Essential and useful other programs under a Unix-alike</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
<tr><tdalign="left"valign="top">•<ahref="#Goto-and-OpenBLAS"accesskey="3">Goto and OpenBLAS</a>:</td><td> </td><tdalign="left"valign="top">
<p>Consult its installation guide for how to build ATLAS with
position-independent code, and as a shared library.
</p>
<hr>
<aname="ACML"></a>
<divclass="header">
<p>
Next: <ahref="#Goto-and-OpenBLAS"accesskey="n"rel="next">Goto and OpenBLAS</a>, Previous: <ahref="#ATLAS"accesskey="p"rel="prev">ATLAS</a>, Up: <ahref="#BLAS"accesskey="u"rel="up">BLAS</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="ACML-1"></a>
<h4class="subsubsection">A.3.1.2 ACML</h4>
<p>For ‘<samp>x86_64</samp>’ processors<aname="DOCF46"href="#FOOT46"><sup>46</sup></a> under Linux there is the AMD Core Math Library (ACML).
Previous: <ahref="#LAPACK"accesskey="p"rel="prev">LAPACK</a>, Up: <ahref="#Linear-algebra"accesskey="u"rel="up">Linear algebra</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Caveats-1"></a>
<h4class="subsection">A.3.3 Caveats</h4>
<p>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 native compilers the flag
<samp>-dalign</samp> is needed if <code>sunperf</code> is to be used.
</p>
<p>On some systems it has been necessary that an external
<acronym>BLAS</acronym>/LAPACK was built with the same FORTRAN compiler used to
build R.
</p>
<hr>
<aname="Configuration-on-a-Unix_002dalike"></a>
<divclass="header">
<p>
Next: <ahref="#Platform-notes"accesskey="n"rel="next">Platform notes</a>, Previous: <ahref="#Essential-and-useful-other-programs-under-a-Unix_002dalike"accesskey="p"rel="prev">Essential and useful other programs under a Unix-alike</a>, Up: <ahref="#Top"accesskey="u"rel="up">Top</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Configuration-on-a-Unix_002dalike-1"></a>
<h2class="appendix">Appendix B Configuration on a Unix-alike</h2>
<tr><tdalign="left"valign="top">•<ahref="#Setting-the-shell"accesskey="4">Setting the shell</a>:</td><td> </td><tdalign="left"valign="top">
<tr><tdalign="left"valign="top">•<ahref="#Compile-and-load-flags"accesskey="7">Compile and load flags</a>:</td><td> </td><tdalign="left"valign="top">
Next: <ahref="#Internationalization-support"accesskey="n"rel="next">Internationalization support</a>, Previous: <ahref="#Configuration-on-a-Unix_002dalike"accesskey="p"rel="prev">Configuration on a Unix-alike</a>, Up: <ahref="#Configuration-on-a-Unix_002dalike"accesskey="u"rel="up">Configuration on a Unix-alike</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Configuration-options-1"></a>
<h3class="section">B.1 Configuration options</h3>
<p><code>configure</code> has many options: running
</p>
<divclass="example">
<preclass="example">./configure --help
</pre></div>
<p>will give a list. Probably the most important ones not covered
<p>If you need to re-configure R with different options you may need to run
<code>make clean</code> or even <code>make distclean</code> before doing so.
</p>
<p>The <samp>configure</samp> script has other generic options added by
<code>autoconf</code> and which are not supported for R: in particular
building for one architecture on a different host is not possible.
</p>
<hr>
<aname="Internationalization-support"></a>
<divclass="header">
<p>
Next: <ahref="#Configuration-variables"accesskey="n"rel="next">Configuration variables</a>, Previous: <ahref="#Configuration-options"accesskey="p"rel="prev">Configuration options</a>, Up: <ahref="#Configuration-on-a-Unix_002dalike"accesskey="u"rel="up">Configuration on a Unix-alike</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
<p>Translation of messages is supported via <acronym>GNU</acronym><code>gettext</code>
unless disabled by the configure option <samp>--disable-nls</samp>.
The <code>configure</code> report will show <code>NLS</code> as one of the
‘Additional capabilities’ if support has been compiled in, and running
in an English locale (but not the <code>C</code> locale) will include
</p>
<divclass="example">
<preclass="example"> Natural language support but running in an English locale
</pre></div>
<p>in the greeting on starting R.
</p>
<hr>
<aname="Configuration-variables"></a>
<divclass="header">
<p>
Next: <ahref="#Setting-the-shell"accesskey="n"rel="next">Setting the shell</a>, Previous: <ahref="#Internationalization-support"accesskey="p"rel="prev">Internationalization support</a>, Up: <ahref="#Configuration-on-a-Unix_002dalike"accesskey="u"rel="up">Configuration on a Unix-alike</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
<tr><tdalign="left"valign="top">•<ahref="#Setting-paper-size"accesskey="1">Setting paper size</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
<tr><tdalign="left"valign="top">•<ahref="#Setting-the-browsers"accesskey="2">Setting the browsers</a>:</td><td> </td><tdalign="left"valign="top">
<p>If you have libraries and header files, e.g., for <acronym>GNU</acronym>
readline, in non-system directories, use the variables <code>LDFLAGS</code>
(for libraries, using ‘<samp>-L</samp>’ flags to be passed to the linker) and
<code>CPPFLAGS</code> (for header files, using ‘<samp>-I</samp>’ flags to be passed to
the C/C++ preprocessors), respectively, to specify these locations.
These default to ‘<samp>-L/usr/local/lib</samp>’ (<code>LDFLAGS</code>,
‘<samp>-L/usr/local/lib64</samp>’ on most 64-bit Linux OSes) and
‘<samp>-I/usr/local/include</samp>’ (<code>CPPFLAGS</code>) to catch the most common
cases. If libraries are still not found, then maybe your
compiler/linker does not support re-ordering of <samp>-L</samp> and
<samp>-l</samp> flags (this has been reported to be a problem on HP-UX with
the native <code>cc</code>). In this case, use a different compiler (or a
front end shell script which does the re-ordering).
</p>
<p>These flags can also be used to build a faster-running version of R.
On most platforms using <code>gcc</code>, having ‘<samp>-O3</samp>’ in
<code>CFLAGS</code> and <code>FFLAGS</code> produces worthwhile performance gains
with <code>gcc</code> and <code>gfortran</code>, but may result in a less
reliable build (both segfaults and incorrect numeric computations have
been seen). On systems using the <acronym>GNU</acronym> linker (especially those
using R as a shared library), it is likely that including
‘<samp>-Wl,-O1</samp>’ in <code>LDFLAGS</code> is worthwhile, and
‘<samp>'-Bdirect,--hash-style=both,-Wl,-O1'</samp>’ is recommended at
<ahref="https://lwn.net/Articles/192624/">https://lwn.net/Articles/192624/</a>. Tuning compilation to a
specific <acronym>CPU</acronym> family (e.g. ‘<samp>-mtune=native</samp>’ for
<code>gcc</code>) can give worthwhile performance gains, especially on
older architectures such as ‘<samp>ix86</samp>’.
</p>
<hr>
<aname="Making-manuals"></a>
<divclass="header">
<p>
Previous: <ahref="#Compilation-flags"accesskey="p"rel="prev">Compilation flags</a>, Up: <ahref="#Configuration-variables"accesskey="u"rel="up">Configuration variables</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Making-manuals-1"></a>
<h4class="subsection">B.3.4 Making manuals</h4>
<aname="index-R_005fRD4PDF-1"></a>
<aname="index-R_005fPAPERSIZE-3"></a>
<p>The default settings for making the manuals are controlled by
<code>R_RD4PDF</code> and <code>R_PAPERSIZE</code>.
</p>
<hr>
<aname="Setting-the-shell"></a>
<divclass="header">
<p>
Next: <ahref="#Using-make"accesskey="n"rel="next">Using make</a>, Previous: <ahref="#Configuration-variables"accesskey="p"rel="prev">Configuration variables</a>, Up: <ahref="#Configuration-on-a-Unix_002dalike"accesskey="u"rel="up">Configuration on a Unix-alike</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Setting-the-shell-1"></a>
<h3class="section">B.4 Setting the shell</h3>
<p>By default the shell scripts such as <samp>R</samp> will be ‘<samp>#!/bin/sh</samp>’
scripts (or using the <code>SHELL</code> chosen by <samp>configure</samp>). This is
almost always satisfactory, but on a few systems <samp>/bin/sh</samp> is not a
Bourne shell or clone, and the shell to be used can be changed by
setting the configure variable <code>R_SHELL</code> to a suitable value (a full
path to a shell, e.g. <samp>/usr/local/bin/bash</samp>).
</p>
<hr>
<aname="Using-make"></a>
<divclass="header">
<p>
Next: <ahref="#Using-FORTRAN"accesskey="n"rel="next">Using FORTRAN</a>, Previous: <ahref="#Setting-the-shell"accesskey="p"rel="prev">Setting the shell</a>, Up: <ahref="#Configuration-on-a-Unix_002dalike"accesskey="u"rel="up">Configuration on a Unix-alike</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Using-make-1"></a>
<h3class="section">B.5 Using make</h3>
<aname="index-make"></a>
<p>To compile R, you will most likely find it easiest to use
<acronym>GNU</acronym><code>make</code>, although the Sun <code>make</code> works on
Solaris. The native <code>make</code> has been reported to fail on SGI
Irix 6.5 and Alpha/OSF1 (aka Tru64).
</p>
<p>To build in a separate directory you need a <code>make</code> that supports
the <code>VPATH</code> variable, for example <acronym>GNU</acronym><code>make</code> and
Sun <code>make</code>.
</p>
<p><code>dmake</code> has also been used. e.g, on Solaris 10.
</p>
<p>If you want to use a <code>make</code> by another name, for example if your
<acronym>GNU</acronym><code>make</code> is called ‘<samp>gmake</samp>’, you need to set the
variable <code>MAKE</code> at configure time, for example
</p>
<aname="index-configure-5"></a>
<divclass="example">
<preclass="example">./configure MAKE=gmake
</pre></div>
<hr>
<aname="Using-FORTRAN"></a>
<divclass="header">
<p>
Next: <ahref="#Compile-and-load-flags"accesskey="n"rel="next">Compile and load flags</a>, Previous: <ahref="#Using-make"accesskey="p"rel="prev">Using make</a>, Up: <ahref="#Configuration-on-a-Unix_002dalike"accesskey="u"rel="up">Configuration on a Unix-alike</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Using-FORTRAN-1"></a>
<h3class="section">B.6 Using FORTRAN</h3>
<aname="index-FORTRAN"></a>
<p>To compile R, you need a FORTRAN compiler. The default
<p>Compiling the version of LAPACK in the R sources also requires some
Fortran 90 extensions, but these are not needed if an external LAPACK is
used.
</p>
<p>It might be possible to use <code>f2c</code>, the FORTRAN-to-C converter
(<ahref="http://www.netlib.org/f2c">http://www.netlib.org/f2c</a>), via a script. (An example script
is given in <samp>scripts/f77_f2c</samp>: this can be customized by setting
<aname="index-F2C"></a>
<aname="index-F2CLIBS"></a>
<aname="index-CC"></a>
the environment variables <code>F2C</code>, <code>F2CLIBS</code>, <code>CC</code> and
<aname="index-CPP"></a>
<code>CPP</code>.) You will need to ensure that the FORTRAN type
<code>integer</code> is translated to the C type <code>int</code>. Normally
<samp>f2c.h</samp> contains ‘<samp>typedef long int integer;</samp>’, which will work
on a 32-bit platform but needs to be changed to ‘<samp>typedef int
integer;</samp>’ on a 64-bit platform. If your compiler is not <code>gcc</code>
you will need to set
<aname="index-FPICFLAGS"></a>
<code>FPICFLAGS</code> appropriately. Also, the included LAPACK sources
contain constructs that <code>f2c</code> is unlikely to be able to process,
so you would need to use an external LAPACK library (such as CLAPACK
from <ahref="http://www.netlib.org/clapack/">http://www.netlib.org/clapack/</a>).
</p>
<hr>
<aname="Compile-and-load-flags"></a>
<divclass="header">
<p>
Next: <ahref="#Maintainer-mode"accesskey="n"rel="next">Maintainer mode</a>, Previous: <ahref="#Using-FORTRAN"accesskey="p"rel="prev">Using FORTRAN</a>, Up: <ahref="#Configuration-on-a-Unix_002dalike"accesskey="u"rel="up">Configuration on a Unix-alike</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Compile-and-load-flags-1"></a>
<h3class="section">B.7 Compile and load flags</h3>
<p>A wide range of flags can be set in the file <samp>config.site</samp> or as
configure variables on the command line. We have already mentioned
</p>
<dlcompact="compact">
<dt><code>CPPFLAGS</code></dt>
<dd><p>header file search directory (<samp>-I</samp>) and any other miscellaneous
options for the C and C++ preprocessors and compilers
</p></dd>
<dt><code>LDFLAGS</code></dt>
<dd><p>path (<samp>-L</samp>), stripping (<samp>-s</samp>) and any other miscellaneous
options for the linker
</p></dd>
</dl>
<p>and others include
</p>
<dlcompact="compact">
<dt><code>CFLAGS</code></dt>
<dd><p>debugging and optimization flags, C
</p></dd>
<dt><code>MAIN_CFLAGS</code></dt>
<dd><p>ditto, for compiling the main program
</p></dd>
<dt><code>SHLIB_CFLAGS</code></dt>
<dd><p>for shared objects
</p></dd>
<dt><code>FFLAGS</code></dt>
<dd><p>debugging and optimization flags, FORTRAN
</p></dd>
<dt><code>SAFE_FFLAGS</code></dt>
<dd><p>ditto for source files which need exact floating point behaviour
</p></dd>
<dt><code>MAIN_FFLAGS</code></dt>
<dd><p>ditto, for compiling the main program
</p></dd>
<dt><code>SHLIB_FFLAGS</code></dt>
<dd><p>for shared objects
</p></dd>
<dt><code>MAIN_LDFLAGS</code></dt>
<dd><p>additional flags for the main link
</p></dd>
<dt><code>SHLIB_LDFLAGS</code></dt>
<dd><p>additional flags for linking the shared objects
</p></dd>
<dt><code>LIBnn</code></dt>
<dd><p>the primary library directory, <samp>lib</samp> or <samp>lib64</samp>
</p></dd>
<dt><code>CPICFLAGS</code></dt>
<dd><p>special flags for compiling C code to be turned into a shared object
</p></dd>
<dt><code>FPICFLAGS</code></dt>
<dd><p>special flags for compiling Fortran code to be turned into a shared object
</p></dd>
<dt><code>CXXPICFLAGS</code></dt>
<dd><p>special flags for compiling C++ code to be turned into a shared object
</p></dd>
<dt><code>FCPICFLAGS</code></dt>
<dd><p>special flags for compiling Fortran 95 code to be turned into a shared object
</p></dd>
<dt><code>DEFS</code></dt>
<dd><p>defines to be used when compiling C code in R itself
</p></dd>
</dl>
<p>Library paths specified as <samp>-L/lib/path</samp> in <code>LDFLAGS</code> are
<aname="index-LD_005fLIBRARY_005fPATH-3"></a>
collected together and prepended to <code>LD_LIBRARY_PATH</code> (or your
system’s equivalent), so there should be no need for <samp>-R</samp> or
<samp>-rpath</samp> flags.
</p>
<p>Variables such as <code>CPICFLAGS</code> are determined where possible by
<code>configure</code>. Some systems allows two types of PIC flags, for
example ‘<samp>-fpic</samp>’ and ‘<samp>-fPIC</samp>’, 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.
</p>
<p>To compile a profiling version of R, one might for example want to
use ‘<samp>MAIN_CFLAGS=-pg</samp>’, ‘<samp>MAIN_FFLAGS=-pg</samp>’,
‘<samp>MAIN_LDFLAGS=-pg</samp>’ on platforms where ‘<samp>-pg</samp>’ cannot be used
with position-independent code.
</p>
<p><strong>Beware</strong>: it may be necessary to set <code>CFLAGS</code> and
<code>FFLAGS</code> in ways compatible with the libraries to be used: one
possible issue is the alignment of doubles, another is the way
structures are passed.
</p>
<p>On some platforms <code>configure</code> will select additional flags for
<code>CFLAGS</code>, <code>CPPFLAGS</code>, <code>FFLAGS</code>, <code>CXXFLAGS</code> and
<code>LIBS</code> in <code>R_XTRA_CFLAGS</code> (and so on). These are for options
which are always required, for example to force <acronym>IEC</acronym> 60559
compliance.
</p>
<hr>
<aname="Maintainer-mode"></a>
<divclass="header">
<p>
Previous: <ahref="#Compile-and-load-flags"accesskey="p"rel="prev">Compile and load flags</a>, Up: <ahref="#Configuration-on-a-Unix_002dalike"accesskey="u"rel="up">Configuration on a Unix-alike</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Maintainer-mode-1"></a>
<h3class="section">B.8 Maintainer mode</h3>
<p>There are several files that are part of the R sources but can be
re-generated from their own sources by configuring with option
<samp>--enable-maintainer-mode</samp> and then running <code>make</code> in the
build directory. This requires other tools to be installed, discussed
in the rest of this section.
</p>
<p>File <samp>configure</samp> is created from <samp>configure.ac</samp> and the files
under <samp>m4</samp> by <code>autoconf</code> and <code>aclocal</code>. There is a
formal version requirement on <code>autoconf</code> of 2.62 or later, but
it is unlikely that anything other than the most recent versions have
been thoroughly tested.
</p>
<p>File <samp>src/include/config.h</samp> is created by <code>autoheader</code>.
</p>
<p>Grammar files <samp>*.y</samp> are converted to C sources by an implementation
of <code>yacc</code>, usually <code>bison -y</code>: these are found in
<samp>src/main</samp> and <samp>src/library/tools/src</samp>. It is known that
earlier versions of <code>bison</code> generate code which reads (and in
some cases writes) outside array bounds: <code>bison</code> 2.6.1 was found
to be satisfactory.
</p>
<p>The ultimate sources for package <strong>compiler</strong> are in its <samp>noweb</samp>
directory. To re-create the sources from
<samp>src/library/compiler/noweb/compiler.nw</samp>, the command
<code>notangle</code> is required. This is likely to need to be installed
from the sources at <ahref="https://www.cs.tufts.edu/~nr/noweb/">https://www.cs.tufts.edu/~nr/noweb/</a> (and can
also be found on CTAN). The package sources are only re-created even in
maintainer mode if <samp>src/library/compiler/noweb/compiler.nw</samp> has
been updated.
</p>
<p>It is likely that in future creating <code>configure</code> will need the GNU
‘autoconf archive’ installed. This can be found at
<ahref="https://www.gnu.org/software/autoconf-archive/">https://www.gnu.org/software/autoconf-archive/</a> and as a package
(usually called <strong>autoconf-archive</strong>) in most packaged distributions,
for example Debian, Fedora, OpenCSW, Homebrew and MacPorts.
</p>
<hr>
<aname="Platform-notes"></a>
<divclass="header">
<p>
Next: <ahref="#The-Windows-toolset"accesskey="n"rel="next">The Windows toolset</a>, Previous: <ahref="#Configuration-on-a-Unix_002dalike"accesskey="p"rel="prev">Configuration on a Unix-alike</a>, Up: <ahref="#Top"accesskey="u"rel="up">Top</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Platform-notes-1"></a>
<h2class="appendix">Appendix C Platform notes</h2>
<p>This section provides some notes on building R on different Unix-alike
platforms. These notes are based on tests run on one or two systems in
each case with particular sets of compilers and support libraries.
Success in building R depends on the proper installation and functioning
of support software; your results may differ if you have other versions
of compilers and support libraries.
</p>
<p>Older versions of this manual (for R < 2.10.0) contain notes on
platforms such as HP-UX, IRIX and Alpha/OSF1 for which we have had no
recent reports.
</p>
<p>C macros to select particular platforms can be tricky to track down
(there is a fair amount of misinformation on the Web). The Wiki
(currently) at <ahref="http://sourceforge.net/p/predef/wiki/Home/">http://sourceforge.net/p/predef/wiki/Home/</a> can be
<tr><tdalign="left"valign="top">•<ahref="#Oracle-Solaris-Studio-compilers"accesskey="3">Oracle Solaris Studio compilers</a>:</td><td> </td><tdalign="left"valign="top">
</td></tr>
</table>
<hr>
<aname="Clang"></a>
<divclass="header">
<p>
Next: <ahref="#Intel-compilers"accesskey="n"rel="next">Intel compilers</a>, Previous: <ahref="#Linux"accesskey="p"rel="prev">Linux</a>, Up: <ahref="#Linux"accesskey="u"rel="up">Linux</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Clang-1"></a>
<h4class="subsection">C.2.1 Clang</h4>
<p>R has been built with Linux ‘<samp>ix86</samp>’ and ‘<samp>x86_64</samp>’ C and
C++ compilers (<ahref="http://clang.llvm.org">http://clang.llvm.org</a>) based on the Clang
front-ends, invoked by <code>CC=clang CXX=clang++</code>, together with
<code>gfortran</code>. These take very similar options to the
corresponding GCC compilers.
</p>
<p>This has to be used in conjunction with a Fortran compiler: the
<code>configure</code> code will remove <samp>-lgcc</samp> from <code>FLIBS</code>,
which is needed for some versions of <code>gfortran</code>.
</p>
<p>The current default for <code>clang++</code> is to use the C++ runtime from
the installed <code>g++</code>. Using the runtime from the <code>libc++</code>
project (<ahref="http://libcxx.llvm.org/">http://libcxx.llvm.org/</a>) has also been tested: for some
R packages only the variant using <code>libcxxabi</code> was successful.
</p>
<p>Most builds of <code>clang</code> have no OpenMP support. Builds of
Next: <ahref="#Oracle-Solaris-Studio-compilers"accesskey="n"rel="next">Oracle Solaris Studio compilers</a>, Previous: <ahref="#Clang"accesskey="p"rel="prev">Clang</a>, Up: <ahref="#Linux"accesskey="u"rel="up">Linux</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="Intel-compilers-1"></a>
<h4class="subsection">C.2.2 Intel compilers</h4>
<p>Intel compilers have been used under ‘<samp>ix86</samp>’ and ‘<samp>x86_64</samp>’
Linux. Brian Ripley used version 9.0 of the compilers for
‘<samp>x86_64</samp>’ on Fedora Core 5 with
<tr><tdalign="left"valign="top">•<ahref="#Tcl_002fTk-headers-and-libraries"accesskey="2">Tcl/Tk headers and libraries</a>:</td><td> </td><tdalign="left"valign="top">
even to the choice of particular versions of the tools.<aname="DOCF63"href="#FOOT63"><sup>63</sup></a> The build process for add-on packages is somewhat more
<tr><tdalign="left"valign="top">•<ahref="#The-command-line-tools"accesskey="3">The command line tools</a>:</td><td> </td><tdalign="left"valign="top">
<p>Please read <ahref="#Making-the-manuals">Making the manuals</a> about how to make <samp>fullrefman.pdf</samp>
and set the environment variable <code>R_RD4PDF</code> suitably; ensure you
have the required fonts installed or that ‘<samp>MiKTeX</samp>’ is set up to
install LaTeX packages on first use.
</p>
<hr>
<aname="The-Inno-Setup-installer"></a>
<divclass="header">
<p>
Next: <ahref="#The-command-line-tools"accesskey="n"rel="next">The command line tools</a>, Previous: <ahref="#LaTeX"accesskey="p"rel="prev">LaTeX</a>, Up: <ahref="#The-Windows-toolset"accesskey="u"rel="up">The Windows toolset</a> [<ahref="#SEC_Contents"title="Table of contents"rel="contents">Contents</a>][<ahref="#Function-and-variable-index"title="Index"rel="index">Index</a>]</p>
</div>
<aname="The-Inno-Setup-installer-1"></a>
<h3class="section">D.2 The Inno Setup installer</h3>
<tr><td></td><tdvalign="top"><ahref="#index-Installing-under-Unix_002dalikes">Installing under Unix-alikes</a>:</td><td> </td><tdvalign="top"><ahref="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-Installing-under-Windows">Installing under Windows</a>:</td><td> </td><tdvalign="top"><ahref="#Installing-R-under-Windows">Installing R under Windows</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-Linux">Linux</a>:</td><td> </td><tdvalign="top"><ahref="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-Manuals">Manuals</a>:</td><td> </td><tdvalign="top"><ahref="#Making-the-manuals">Making the manuals</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-OS-X">OS X</a>:</td><td> </td><tdvalign="top"><ahref="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-OS-X-1">OS X</a>:</td><td> </td><tdvalign="top"><ahref="#Installing-R-under-OS-X">Installing R under OS X</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-Repositories">Repositories</a>:</td><td> </td><tdvalign="top"><ahref="#Setting-up-a-package-repository">Setting up a package repository</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-Sources-for-R">Sources for R</a>:</td><td> </td><tdvalign="top"><ahref="#Getting-and-unpacking-the-sources">Getting and unpacking the sources</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-Subversion">Subversion</a>:</td><td> </td><tdvalign="top"><ahref="#Using-Subversion-and-rsync">Using Subversion and rsync</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-Subversion-1">Subversion</a>:</td><td> </td><tdvalign="top"><ahref="#Essential-programs-and-libraries">Essential programs and libraries</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-Vignettes">Vignettes</a>:</td><td> </td><tdvalign="top"><ahref="#Essential-programs-and-libraries">Essential programs and libraries</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-winCairo_002edll">winCairo.dll</a>:</td><td> </td><tdvalign="top"><ahref="#Building-the-cairo-devices-files">Building the cairo devices files</a></td></tr>
<tr><tdcolspan="4"><hr></td></tr>
</table>
<tablesummary=""><tr><thvalign="top">Jump to: </th><td><aclass="summary-letter"href="#Concept-index_cp_letter-A"><b>A</b></a>
<tr><td></td><tdvalign="top"><ahref="#index-CYGWIN"><code>CYGWIN</code></a>:</td><td> </td><tdvalign="top"><ahref="#The-command-line-tools">The command line tools</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-LANG"><code>LANG</code></a>:</td><td> </td><tdvalign="top"><ahref="#Localization-of-messages">Localization of messages</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-LANGUAGE"><code>LANGUAGE</code></a>:</td><td> </td><tdvalign="top"><ahref="#Localization-of-messages">Localization of messages</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-LANGUAGE-1"><code>LANGUAGE</code></a>:</td><td> </td><tdvalign="top"><ahref="#Localization-of-messages">Localization of messages</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-LC_005fALL"><code>LC_ALL</code></a>:</td><td> </td><tdvalign="top"><ahref="#Localization-of-messages">Localization of messages</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-LC_005fCOLLATE"><code>LC_COLLATE</code></a>:</td><td> </td><tdvalign="top"><ahref="#Testing-a-Unix_002dalike-Installation">Testing a Unix-alike Installation</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-LC_005fMESSAGES"><code>LC_MESSAGES</code></a>:</td><td> </td><tdvalign="top"><ahref="#Localization-of-messages">Localization of messages</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-LD_005fLIBRARY_005fPATH-3"><code>LD_LIBRARY_PATH</code></a>:</td><td> </td><tdvalign="top"><ahref="#Compile-and-load-flags">Compile and load flags</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-PAPERSIZE"><code>PAPERSIZE</code></a>:</td><td> </td><tdvalign="top"><ahref="#Setting-paper-size">Setting paper size</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-PATH"><code>PATH</code></a>:</td><td> </td><tdvalign="top"><ahref="#Essential-programs-and-libraries">Essential programs and libraries</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-PATH-3"><code>PATH</code></a>:</td><td> </td><tdvalign="top"><ahref="#The-Windows-toolset">The Windows toolset</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-R_005fBROWSER"><code>R_BROWSER</code></a>:</td><td> </td><tdvalign="top"><ahref="#Setting-the-browsers">Setting the browsers</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-R_005fGSCMD"><code>R_GSCMD</code></a>:</td><td> </td><tdvalign="top"><ahref="#Useful-libraries-and-programs">Useful libraries and programs</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-R_005fPAPERSIZE"><code>R_PAPERSIZE</code></a>:</td><td> </td><tdvalign="top"><ahref="#Making-the-manuals">Making the manuals</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-R_005fPAPERSIZE-2"><code>R_PAPERSIZE</code></a>:</td><td> </td><tdvalign="top"><ahref="#Setting-paper-size">Setting paper size</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-R_005fPDFVIEWER"><code>R_PDFVIEWER</code></a>:</td><td> </td><tdvalign="top"><ahref="#Setting-the-browsers">Setting the browsers</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-R_005fRD4PDF"><code>R_RD4PDF</code></a>:</td><td> </td><tdvalign="top"><ahref="#Making-the-manuals">Making the manuals</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-TAR"><code>TAR</code></a>:</td><td> </td><tdvalign="top"><ahref="#Essential-programs-and-libraries">Essential programs and libraries</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-TAR_005fOPTIONS"><code>TAR_OPTIONS</code></a>:</td><td> </td><tdvalign="top"><ahref="#Getting-and-unpacking-the-sources">Getting and unpacking the sources</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-TAR_005fOPTIONS-1"><code>TAR_OPTIONS</code></a>:</td><td> </td><tdvalign="top"><ahref="#Getting-the-source-files">Getting the source files</a></td></tr>
<tr><td></td><tdvalign="top"><ahref="#index-TMPDIR-1"><code>TMPDIR</code></a>:</td><td> </td><tdvalign="top"><ahref="#Building-the-core-files">Building the core files</a></td></tr>