R/R-admin.html

7338 lines
390 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual is for R, version 3.2.3 (2015-12-10).
Copyright (C) 2001-2015 R Core Team
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by the R Core Team. -->
<!-- Created by GNU Texinfo 6.0, http://www.gnu.org/software/texinfo/ -->
<head>
<title>R Installation and Administration</title>
<meta name="description" content="R Installation and Administration">
<meta name="keywords" content="R Installation and Administration">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2any">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="#Top" rel="start" title="Top">
<link href="#Function-and-variable-index" rel="index" title="Function and variable index">
<link href="#SEC_Contents" rel="contents" title="Table of Contents">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space: nowrap}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: serif; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
body {
margin-left: 5%;
margin-right: 5%;
}
h1 {
background: white;
color: rgb(25%, 25%, 25%);
font-family: monospace;
font-size: xx-large;
text-align: center;
}
h2 {
background: white;
color: rgb(40%, 40%, 40%);
font-family: monospace;
font-size: x-large;
text-align: center;
}
h3 {
background: white;
color: rgb(40%, 40%, 40%);
font-family: monospace;
font-size: large;
}
h4 {
background: white;
color: rgb(40%, 40%, 40%);
font-family: monospace;
}
span.samp {
font-family: monospace;
}
span.command {
font-family: monospace;
}
span.option {
font-family: monospace;
}
span.file {
font-family: monospace;
}
span.env {
font-family: monospace;
}
ul {
margin-top: 0.25ex;
margin-bottom: 0.25ex;
}
li {
margin-top: 0.25ex;
margin-bottom: 0.25ex;
}
p {
margin-top: 0.6ex;
margin-bottom: 1.2ex;
}
-->
</style>
</head>
<body lang="en">
<h1 class="settitle" align="center">R Installation and Administration</h1>
<a name="SEC_Contents"></a>
<h2 class="contents-heading">Table of Contents</h2>
<div class="contents">
<ul class="no-bullet">
<li><a name="toc-Obtaining-R-1" href="#Obtaining-R">1 Obtaining R</a>
<ul class="no-bullet">
<li><a name="toc-Getting-and-unpacking-the-sources-1" href="#Getting-and-unpacking-the-sources">1.1 Getting and unpacking the sources</a></li>
<li><a name="toc-Getting-patched-and-development-versions-1" href="#Getting-patched-and-development-versions">1.2 Getting patched and development versions</a>
<ul class="no-bullet">
<li><a name="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><a name="toc-Installing-R-under-Unix_002dalikes-1" href="#Installing-R-under-Unix_002dalikes">2 Installing R under Unix-alikes</a>
<ul class="no-bullet">
<li><a name="toc-Simple-compilation-1" href="#Simple-compilation">2.1 Simple compilation</a></li>
<li><a name="toc-Help-options-1" href="#Help-options">2.2 Help options</a></li>
<li><a name="toc-Making-the-manuals-1" href="#Making-the-manuals">2.3 Making the manuals</a></li>
<li><a name="toc-Installation-1" href="#Installation">2.4 Installation</a></li>
<li><a name="toc-Uninstallation-1" href="#Uninstallation">2.5 Uninstallation</a></li>
<li><a name="toc-Sub_002darchitectures-1" href="#Sub_002darchitectures">2.6 Sub-architectures</a>
<ul class="no-bullet">
<li><a name="toc-Multilib-1" href="#Multilib">2.6.1 Multilib</a></li>
</ul></li>
<li><a name="toc-Other-Options-1" href="#Other-Options">2.7 Other Options</a>
<ul class="no-bullet">
<li><a name="toc-OpenMP-Support-1" href="#OpenMP-Support">2.7.1 OpenMP Support</a></li>
</ul></li>
<li><a name="toc-Testing-an-Installation" href="#Testing-a-Unix_002dalike-Installation">2.8 Testing an Installation</a></li>
</ul></li>
<li><a name="toc-Installing-R-under-Windows-1" href="#Installing-R-under-Windows">3 Installing R under Windows</a>
<ul class="no-bullet">
<li><a name="toc-Building-from-source-1" href="#Building-from-source">3.1 Building from source</a>
<ul class="no-bullet">
<li><a name="toc-Getting-the-tools-1" href="#Getting-the-tools">3.1.1 Getting the tools</a></li>
<li><a name="toc-Getting-the-source-files-1" href="#Getting-the-source-files">3.1.2 Getting the source files</a></li>
<li><a name="toc-Building-the-core-files-1" href="#Building-the-core-files">3.1.3 Building the core files</a></li>
<li><a name="toc-Building-the-cairo-devices" href="#Building-the-cairo-devices-files">3.1.4 Building the cairo devices</a></li>
<li><a name="toc-Using-ICU-for-collation-1" href="#Using-ICU-for-collation">3.1.5 Using ICU for collation</a></li>
<li><a name="toc-Support-for-libcurl-1" href="#Support-for-libcurl">3.1.6 Support for libcurl</a></li>
<li><a name="toc-Checking-the-build-1" href="#Checking-the-build">3.1.7 Checking the build</a></li>
<li><a name="toc-Building-the-manuals-1" href="#Building-the-manuals">3.1.8 Building the manuals</a></li>
<li><a name="toc-Building-the-Inno-Setup-installer-1" href="#Building-the-Inno-Setup-installer">3.1.9 Building the Inno Setup installer</a></li>
<li><a name="toc-Building-the-MSI-installer-1" href="#Building-the-MSI-installer">3.1.10 Building the MSI installer</a></li>
<li><a name="toc-64_002dbit-Windows-builds-1" href="#g_t64_002dbit-Windows-builds">3.1.11 64-bit Windows builds</a></li>
</ul></li>
<li><a name="toc-Testing-an-Installation-1" href="#Testing-a-Windows-Installation">3.2 Testing an Installation</a></li>
</ul></li>
<li><a name="toc-Installing-R-under-OS-X-1" href="#Installing-R-under-OS-X">4 Installing R under OS X</a>
<ul class="no-bullet">
<li><a name="toc-Running-R-under-OS-X-1" href="#Running-R-under-OS-X">4.1 Running R under OS X</a></li>
<li><a name="toc-Uninstalling-under-OS-X-1" href="#Uninstalling-under-OS-X">4.2 Uninstalling under OS X</a></li>
<li><a name="toc-Multiple-versions-1" href="#Multiple-versions">4.3 Multiple versions</a></li>
</ul></li>
<li><a name="toc-Running-R-1" href="#Running-R">5 Running R</a></li>
<li><a name="toc-Add_002don-packages-1" href="#Add_002don-packages">6 Add-on packages</a>
<ul class="no-bullet">
<li><a name="toc-Default-packages-1" href="#Default-packages">6.1 Default packages</a></li>
<li><a name="toc-Managing-libraries-1" href="#Managing-libraries">6.2 Managing libraries</a></li>
<li><a name="toc-Installing-packages-1" href="#Installing-packages">6.3 Installing packages</a>
<ul class="no-bullet">
<li><a name="toc-Windows" href="#Windows-packages">6.3.1 Windows</a></li>
<li><a name="toc-OS-X-1" href="#OS-X-packages">6.3.2 OS X</a></li>
<li><a name="toc-Customizing-package-compilation-1" href="#Customizing-package-compilation">6.3.3 Customizing package compilation</a></li>
<li><a name="toc-Multiple-sub_002darchitectures-1" href="#Multiple-sub_002darchitectures">6.3.4 Multiple sub-architectures</a></li>
<li><a name="toc-Byte_002dcompilation-1" href="#Byte_002dcompilation">6.3.5 Byte-compilation</a></li>
</ul></li>
<li><a name="toc-Updating-packages-1" href="#Updating-packages">6.4 Updating packages</a></li>
<li><a name="toc-Removing-packages-1" href="#Removing-packages">6.5 Removing packages</a></li>
<li><a name="toc-Setting-up-a-package-repository-1" href="#Setting-up-a-package-repository">6.6 Setting up a package repository</a></li>
<li><a name="toc-Checking-installed-source-packages-1" href="#Checking-installed-source-packages">6.7 Checking installed source packages</a></li>
</ul></li>
<li><a name="toc-Internationalization-and-Localization" href="#Internationalization">7 Internationalization and Localization</a>
<ul class="no-bullet">
<li><a name="toc-Locales-1" href="#Locales">7.1 Locales</a>
<ul class="no-bullet">
<li><a name="toc-Locales-under-Unix_002dalikes-1" href="#Locales-under-Unix_002dalikes">7.1.1 Locales under Unix-alikes</a></li>
<li><a name="toc-Locales-under-Windows-1" href="#Locales-under-Windows">7.1.2 Locales under Windows</a></li>
<li><a name="toc-Locales-under-OS-X-1" href="#Locales-under-OS-X">7.1.3 Locales under OS X</a></li>
</ul></li>
<li><a name="toc-Localization-of-messages-1" href="#Localization-of-messages">7.2 Localization of messages</a></li>
</ul></li>
<li><a name="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><a name="toc-The-standalone-Rmath-library-1" href="#The-standalone-Rmath-library">9 The standalone Rmath library</a>
<ul class="no-bullet">
<li><a name="toc-Unix_002dalikes" href="#Unix_002dalike-standalone">9.1 Unix-alikes</a></li>
<li><a name="toc-Windows-1" href="#Windows-standalone">9.2 Windows</a></li>
</ul></li>
<li><a name="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>
<ul class="no-bullet">
<li><a name="toc-Essential-programs-and-libraries-1" href="#Essential-programs-and-libraries">A.1 Essential programs and libraries</a></li>
<li><a name="toc-Useful-libraries-and-programs-1" href="#Useful-libraries-and-programs">A.2 Useful libraries and programs</a>
<ul class="no-bullet">
<li><a name="toc-Tcl_002fTk-1" href="#Tcl_002fTk">A.2.1 Tcl/Tk</a></li>
<li><a name="toc-Java-support-1" href="#Java-support">A.2.2 Java support</a></li>
<li><a name="toc-Other-compiled-languages-1" href="#Other-compiled-languages">A.2.3 Other compiled languages</a></li>
</ul></li>
<li><a name="toc-Linear-algebra-1" href="#Linear-algebra">A.3 Linear algebra</a>
<ul class="no-bullet">
<li><a name="toc-BLAS-1" href="#BLAS">A.3.1 BLAS</a>
<ul class="no-bullet">
<li><a name="toc-ATLAS-1" href="#ATLAS">A.3.1.1 ATLAS</a></li>
<li><a name="toc-ACML-1" href="#ACML">A.3.1.2 ACML</a></li>
<li><a name="toc-Goto-and-OpenBLAS-1" href="#Goto-and-OpenBLAS">A.3.1.3 Goto and OpenBLAS</a></li>
<li><a name="toc-Intel-MKL" href="#MKL">A.3.1.4 Intel MKL</a></li>
<li><a name="toc-Shared-BLAS-1" href="#Shared-BLAS">A.3.1.5 Shared BLAS</a></li>
</ul></li>
<li><a name="toc-LAPACK-1" href="#LAPACK">A.3.2 LAPACK</a></li>
<li><a name="toc-Caveats-1" href="#Caveats">A.3.3 Caveats</a></li>
</ul></li>
</ul></li>
<li><a name="toc-Configuration-on-a-Unix_002dalike-1" href="#Configuration-on-a-Unix_002dalike">Appendix B Configuration on a Unix-alike</a>
<ul class="no-bullet">
<li><a name="toc-Configuration-options-1" href="#Configuration-options">B.1 Configuration options</a></li>
<li><a name="toc-Internationalization-support-1" href="#Internationalization-support">B.2 Internationalization support</a></li>
<li><a name="toc-Configuration-variables-1" href="#Configuration-variables">B.3 Configuration variables</a>
<ul class="no-bullet">
<li><a name="toc-Setting-paper-size-1" href="#Setting-paper-size">B.3.1 Setting paper size</a></li>
<li><a name="toc-Setting-the-browsers-1" href="#Setting-the-browsers">B.3.2 Setting the browsers</a></li>
<li><a name="toc-Compilation-flags-1" href="#Compilation-flags">B.3.3 Compilation flags</a></li>
<li><a name="toc-Making-manuals-1" href="#Making-manuals">B.3.4 Making manuals</a></li>
</ul></li>
<li><a name="toc-Setting-the-shell-1" href="#Setting-the-shell">B.4 Setting the shell</a></li>
<li><a name="toc-Using-make-1" href="#Using-make">B.5 Using make</a></li>
<li><a name="toc-Using-FORTRAN-1" href="#Using-FORTRAN">B.6 Using FORTRAN</a></li>
<li><a name="toc-Compile-and-load-flags-1" href="#Compile-and-load-flags">B.7 Compile and load flags</a></li>
<li><a name="toc-Maintainer-mode-1" href="#Maintainer-mode">B.8 Maintainer mode</a></li>
</ul></li>
<li><a name="toc-Platform-notes-1" href="#Platform-notes">Appendix C Platform notes</a>
<ul class="no-bullet">
<li><a name="toc-X11-issues-1" href="#X11-issues">C.1 X11 issues</a></li>
<li><a name="toc-Linux-1" href="#Linux">C.2 Linux</a>
<ul class="no-bullet">
<li><a name="toc-Clang-1" href="#Clang">C.2.1 Clang</a></li>
<li><a name="toc-Intel-compilers-1" href="#Intel-compilers">C.2.2 Intel compilers</a></li>
<li><a name="toc-Oracle-Solaris-Studio-compilers-1" href="#Oracle-Solaris-Studio-compilers">C.2.3 Oracle Solaris Studio compilers</a></li>
</ul></li>
<li><a name="toc-OS-X-2" href="#OS-X">C.3 OS X</a>
<ul class="no-bullet">
<li><a name="toc-Mavericks-and-later-1" href="#Mavericks-and-later">C.3.1 Mavericks and later</a></li>
<li><a name="toc-Lion-and-Mountain-Lion-1" href="#Lion-and-Mountain-Lion">C.3.2 Lion and Mountain Lion</a></li>
<li><a name="toc-Snow-Leopard-1" href="#Snow-Leopard">C.3.3 Snow Leopard</a></li>
<li><a name="toc-El-Capitan-1" href="#El-Capitan">C.3.4 El Capitan</a></li>
<li><a name="toc-Tcl_002fTk-headers-and-libraries-1" href="#Tcl_002fTk-headers-and-libraries">C.3.5 Tcl/Tk headers and libraries</a></li>
<li><a name="toc-Java" href="#Java-_0028OS-X_0029">C.3.6 Java</a></li>
<li><a name="toc-Frameworks-1" href="#Frameworks">C.3.7 Frameworks</a></li>
<li><a name="toc-Building-R_002eapp-1" href="#Building-R_002eapp">C.3.8 Building R.app</a></li>
</ul></li>
<li><a name="toc-Solaris-1" href="#Solaris">C.4 Solaris</a>
<ul class="no-bullet">
<li><a name="toc-Using-gcc-1" href="#Using-gcc">C.4.1 Using gcc</a></li>
</ul></li>
<li><a name="toc-AIX-1" href="#AIX">C.5 AIX</a></li>
<li><a name="toc-FreeBSD-1" href="#FreeBSD">C.6 FreeBSD</a></li>
<li><a name="toc-OpenBSD" href="#OpenBSD">C.7 OpenBSD</a></li>
<li><a name="toc-Cygwin-1" href="#Cygwin">C.8 Cygwin</a></li>
<li><a name="toc-New-platforms-1" href="#New-platforms">C.9 New platforms</a></li>
</ul></li>
<li><a name="toc-The-Windows-toolset-1" href="#The-Windows-toolset">Appendix D The Windows toolset</a>
<ul class="no-bullet">
<li><a name="toc-LaTeX-1" href="#LaTeX">D.1 LaTeX</a></li>
<li><a name="toc-The-Inno-Setup-installer-1" href="#The-Inno-Setup-installer">D.2 The Inno Setup installer</a></li>
<li><a name="toc-The-command-line-tools-1" href="#The-command-line-tools">D.3 The command line tools</a></li>
<li><a name="toc-The-MinGW_002dw64-toolchain-1" href="#The-MinGW_002dw64-toolchain">D.4 The MinGW-w64 toolchain</a></li>
<li><a name="toc-Useful-additional-programs-1" href="#Useful-additional-programs">D.5 Useful additional programs</a></li>
</ul></li>
<li><a name="toc-Function-and-variable-index-1" href="#Function-and-variable-index">Function and variable index</a></li>
<li><a name="toc-Concept-index-1" href="#Concept-index">Concept index</a></li>
<li><a name="toc-Environment-variable-index-1" href="#Environment-variable-index">Environment variable index</a></li>
</ul>
</div>
<a name="Top"></a>
<div class="header">
<p>
Next: <a href="#Obtaining-R" accesskey="n" rel="next">Obtaining R</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="R-Installation-and-Administration"></a>
<h1 class="top">R Installation and Administration</h1>
<p>This is a guide to installation and administration for R.
</p>
<p>This manual is for R, version 3.2.3 (2015-12-10).
</p>
<p>Copyright &copy; 2001&ndash;2015 R Core Team
</p>
<blockquote>
<p>Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
</p>
<p>Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
</p>
<p>Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by the R Core Team.
</p></blockquote>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Obtaining-R" accesskey="1">Obtaining R</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Installing-R-under-Unix_002dalikes" accesskey="2">Installing R under Unix-alikes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Installing-R-under-Windows" accesskey="3">Installing R under Windows</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Installing-R-under-OS-X" accesskey="4">Installing R under OS X</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Running-R" accesskey="5">Running R</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Add_002don-packages" accesskey="6">Add-on packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Internationalization" accesskey="7">Internationalization</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Choosing-between-32_002d-and-64_002dbit-builds" accesskey="8">Choosing between 32- and 64-bit builds</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#The-standalone-Rmath-library" accesskey="9">The standalone Rmath library</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Essential and useful other programs under a Unix-alike</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Platform-notes">Platform notes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#The-Windows-toolset">The Windows toolset</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Function-and-variable-index">Function and variable index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Concept-index">Concept index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Environment-variable-index">Environment variable index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Obtaining-R"></a>
<div class="header">
<p>
Next: <a href="#Installing-R-under-Unix_002dalikes" accesskey="n" rel="next">Installing R under Unix-alikes</a>, Previous: <a href="#Top" accesskey="p" rel="prev">Top</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Obtaining-R-1"></a>
<h2 class="chapter">1 Obtaining R</h2>
<a name="index-Obtaining-R"></a>
<p>Sources, binaries and documentation for R can be obtained via
<acronym>CRAN</acronym>, the &ldquo;Comprehensive R Archive Network&rdquo; whose current
members are listed at <a href="https://CRAN.R-project.org/mirrors.html">https://CRAN.R-project.org/mirrors.html</a>.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Getting-and-unpacking-the-sources" accesskey="1">Getting and unpacking the sources</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Getting-patched-and-development-versions" accesskey="2">Getting patched and development versions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Getting-and-unpacking-the-sources"></a>
<div class="header">
<p>
Next: <a href="#Getting-patched-and-development-versions" accesskey="n" rel="next">Getting patched and development versions</a>, Previous: <a href="#Obtaining-R" accesskey="p" rel="prev">Obtaining R</a>, Up: <a href="#Obtaining-R" accesskey="u" rel="up">Obtaining R</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Getting-and-unpacking-the-sources-1"></a>
<h3 class="section">1.1 Getting and unpacking the sources</h3>
<a name="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
</p>
<div class="example">
<pre class="example">tar -xf R-<var>x</var>.<var>y</var>.<var>z</var>.tar.gz
</pre></div>
<p>on systems that have a suitable<a name="DOCF1" href="#FOOT1"><sup>1</sup></a> <code>tar</code> installed. On other systems you need to
have the <code>gzip</code> program installed, when you can use
</p>
<div class="example">
<pre class="example">gzip -dc R-<var>x</var>.<var>y</var>.<var>z</var>.tar.gz | tar -xf -
</pre></div>
<p>The pathname of the directory into which the sources are unpacked should
not contain spaces, as most <code>make</code> programs (and specifically
<acronym>GNU</acronym> <code>make</code>) do not expect spaces.
</p>
<p>If you want the build to be usable by a group of users, set <code>umask</code>
before unpacking so that the files will be readable by the target group
(e.g., <code>umask 022</code> to be usable by all users). Keep this
setting of <code>umask</code> whilst building and installing.
</p>
<p>If you use a recent <acronym>GNU</acronym> version of <code>tar</code> and do this
as a root account (which on Windows includes accounts with administrator
privileges) you may see many warnings about changing ownership. In
which case you can use
</p>
<div class="example">
<pre class="example">tar --no-same-owner -xf R-<var>x</var>.<var>y</var>.<var>z</var>.tar.gz
</pre></div>
<p>and perhaps also include the option <samp>--no-same-permissions</samp>.
<a name="index-TAR_005fOPTIONS"></a>
(These options can also be set in the <code>TAR_OPTIONS</code> environment
variable: if more than one option is included they should be separated
by spaces.)
</p>
<hr>
<a name="Getting-patched-and-development-versions"></a>
<div class="header">
<p>
Previous: <a href="#Getting-and-unpacking-the-sources" accesskey="p" rel="prev">Getting and unpacking the sources</a>, Up: <a href="#Obtaining-R" accesskey="u" rel="up">Obtaining R</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Getting-patched-and-development-versions-1"></a>
<h3 class="section">1.2 Getting patched and development versions</h3>
<p>A patched version of the current release, &lsquo;<samp>r-patched</samp>&rsquo;, and the
current development version, &lsquo;<samp>r-devel</samp>&rsquo;, are available as daily
tarballs and via access to the R Subversion repository. (For the two
weeks prior to the release of a minor (3.x.0) version, &lsquo;<samp>r-patched</samp>&rsquo;
tarballs may refer to beta/release candidates of the upcoming release,
the patched version of the current release being available via
Subversion.)
</p>
<p>The tarballs are available from
<a href="https://stat.ethz.ch/R/daily">https://stat.ethz.ch/R/daily</a>. Download
<samp>R-patched.tar.gz</samp> or <samp>R-devel.tar.gz</samp> (or the <samp>.tar.bz2</samp>
versions) and unpack as described in the previous section. They are
built in exactly the same way as distributions of R releases.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Using-Subversion-and-rsync" accesskey="1">Using Subversion and rsync</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Using-Subversion-and-rsync"></a>
<div class="header">
<p>
Previous: <a href="#Getting-patched-and-development-versions" accesskey="p" rel="prev">Getting patched and development versions</a>, Up: <a href="#Getting-patched-and-development-versions" accesskey="u" rel="up">Getting patched and development versions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Using-Subversion-and-rsync-1"></a>
<h4 class="subsection">1.2.1 Using Subversion and rsync</h4>
<a name="index-Subversion"></a>
<p>Sources are also available via <a href="https://svn.R-project.org/R/">https://svn.R-project.org/R/</a>, the
R Subversion repository. If you have a Subversion client (see
<a href="https://subversion.apache.org/">https://subversion.apache.org/</a>), you can check out and update the
current &lsquo;<samp>r-devel</samp>&rsquo; from
<a href="https://svn.r-project.org/R/trunk/">https://svn.r-project.org/R/trunk/</a> and the current
&lsquo;<samp>r-patched</samp>&rsquo; from
&lsquo;<samp>https://svn.r-project.org/R/branches/R-<var>x</var>-<var>y</var>-branch/</samp>&rsquo;
(where <var>x</var> and <var>y</var> are the major and minor number of the current
released version of R). E.g., use
</p>
<div class="example">
<pre class="example">svn checkout https://svn.r-project.org/R/trunk/ <var>path</var>
</pre></div>
<p>to check out &lsquo;<samp>r-devel</samp>&rsquo; into directory <var>path</var> (which will be
created if necessary). The alpha, beta and RC versions of an upcoming
<var>x.y.0</var> release are available from
&lsquo;<samp>https://svn.r-project.org/R/branches/R-<var>x</var>-<var>y</var>-branch/</samp>&rsquo; in
the four-week period prior to the release.
</p>
<p>Note that &lsquo;<samp>https:</samp>&rsquo; is required<a name="DOCF2" href="#FOOT2"><sup>2</sup></a>,
and that the SSL certificate for the Subversion server of the R
project should be recognized as from a trusted source.
</p>
<p>Note that retrieving the sources by e.g. <code>wget -r</code> or
<code>svn export</code> from that URL will not work (and will give a error
early in the <code>make</code> process): the Subversion information is
needed to build R.
</p>
<p>The Subversion repository does not contain the current sources for the
recommended packages, which can be obtained by <code>rsync</code> or
downloaded from <acronym>CRAN</acronym>. To use <code>rsync</code> to install the
appropriate sources for the recommended packages, run
<code>./tools/rsync-recommended</code> from the top-level directory of the
R sources.
</p>
<p>If downloading manually from <acronym>CRAN</acronym>, do ensure that you have the
correct versions of the recommended packages: if the number in the file
<samp>VERSION</samp> is &lsquo;<samp><var>x</var>.<var>y</var>.<var>z</var></samp>&rsquo; you need to download
the contents of &lsquo;<samp>https://CRAN.R-project.org/src/contrib/<var>dir</var></samp>&rsquo;,
where <var>dir</var> is &lsquo;<samp><var>x</var>.<var>y</var>.<var>z</var>/Recommended</samp>&rsquo; for
r-devel or <samp><var>x</var>.<var>y</var>-patched/Recommended</samp> for r-patched,
respectively, to directory <samp>src/library/Recommended</samp> in the sources
you have unpacked. After downloading manually you need to execute
<code>tools/link-recommended</code> from the top level of the sources to
make the requisite links in <samp>src/library/Recommended</samp>. A suitable
incantation from the top level of the R sources using <code>wget</code>
might be (for the correct value of <samp><var>dir</var></samp>)
</p>
<div class="example">
<pre class="example">wget -r -l1 --no-parent -A\*.gz -nd -P src/library/Recommended \
https://CRAN.R-project.org/src/contrib/<var>dir</var>
./tools/link-recommended
</pre></div>
<hr>
<a name="Installing-R-under-Unix_002dalikes"></a>
<div class="header">
<p>
Next: <a href="#Installing-R-under-Windows" accesskey="n" rel="next">Installing R under Windows</a>, Previous: <a href="#Obtaining-R" accesskey="p" rel="prev">Obtaining R</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Installing-R-under-Unix_002dalikes-1"></a>
<h2 class="chapter">2 Installing R under Unix-alikes</h2>
<a name="index-Installing-under-Unix_002dalikes"></a>
<p>R will configure and build under most common Unix and Unix-alike
platforms including &lsquo;<samp><var>cpu</var>-*-linux-gnu</samp>&rsquo; for the
&lsquo;<samp>alpha</samp>&rsquo;, &lsquo;<samp>arm</samp>&rsquo;, &lsquo;<samp>hppa</samp>&rsquo;, &lsquo;<samp>ix86</samp>&rsquo;,
&lsquo;<samp>m68k</samp>&rsquo;, &lsquo;<samp>mips</samp>&rsquo;, &lsquo;<samp>mipsel</samp>&rsquo;, &lsquo;<samp>powerpc</samp>&rsquo;,
&lsquo;<samp>s390</samp>&rsquo;, &lsquo;<samp>sparc</samp>&rsquo;, and &lsquo;<samp>x86_64</samp>&rsquo; <acronym>CPU</acronym>s,
&lsquo;<samp>x86_64-apple-darwin</samp>&rsquo;, &lsquo;<samp>i386-sun-solaris</samp>&rsquo; and
&lsquo;<samp>sparc-sun-solaris</samp>&rsquo; as well as
perhaps (it is tested less frequently on these platforms)
&lsquo;<samp>i386-apple-darwin</samp>&rsquo;, &lsquo;<samp>i386-*-freebsd</samp>&rsquo;, &lsquo;<samp>x86_64-*-freebsd</samp>&rsquo;,
&lsquo;<samp>i386-*-netbsd</samp>&rsquo;, &lsquo;<samp>x86_64/*-openbsd</samp>&rsquo; and
&lsquo;<samp>powerpc-ibm-aix6*</samp>&rsquo;
</p>
<a name="index-Linux"></a>
<a name="index-OS-X"></a>
<p>In addition, binary distributions are available for some common Linux
distributions and for OS X (formerly Mac OS). See the <acronym>FAQ</acronym> for
current details. These are installed in platform-specific ways, so for
the rest of this chapter we consider only building from the sources.
</p>
<p>Cross-building is not possible: installing R builds a minimal version
of R and then runs many R scripts to complete the build.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Simple-compilation" accesskey="1">Simple compilation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Help-options" accesskey="2">Help options</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Making-the-manuals" accesskey="3">Making the manuals</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Installation" accesskey="4">Installation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Uninstallation" accesskey="5">Uninstallation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Sub_002darchitectures" accesskey="6">Sub-architectures</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Other-Options" accesskey="7">Other Options</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Testing-a-Unix_002dalike-Installation" accesskey="8">Testing a Unix-alike Installation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Simple-compilation"></a>
<div class="header">
<p>
Next: <a href="#Help-options" accesskey="n" rel="next">Help options</a>, Previous: <a href="#Installing-R-under-Unix_002dalikes" accesskey="p" rel="prev">Installing R under Unix-alikes</a>, Up: <a href="#Installing-R-under-Unix_002dalikes" accesskey="u" rel="up">Installing R under Unix-alikes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Simple-compilation-1"></a>
<h3 class="section">2.1 Simple compilation</h3>
<p>First review the essential and useful tools and libraries in
<a href="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Essential and useful other programs under a Unix-alike</a>, and install
those you
<a name="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.<a name="DOCF3" href="#FOOT3"><sup>3</sup></a>
</p>
<a name="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 <a href="#Setting-paper-size">Setting paper size</a>.) Issue the
following commands:
</p>
<a name="index-configure"></a>
<div class="example">
<pre class="example">./configure
make
</pre></div>
<p>(See <a href="#Using-make">Using make</a> if your make is not called &lsquo;<samp>make</samp>&rsquo;.) Users of
Debian-based 64-bit systems<a name="DOCF4" href="#FOOT4"><sup>4</sup></a> may need
</p>
<div class="example">
<pre class="example">./configure LIBnn=lib
make
</pre></div>
<p>Then check the built system works correctly by
</p>
<div class="example">
<pre class="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 <a href="#Running-R">Running R</a>).
</p>
<p>More comprehensive testing can be done by
</p>
<div class="example">
<pre class="example">make check-devel
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">make check-all
</pre></div>
<p>see file <samp>tests/README</samp> and <a href="#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 <a href="#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>
<a name="index-configure-1"></a>
<div class="example">
<pre class="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
<a href="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>
<a name="Help-options"></a>
<div class="header">
<p>
Next: <a href="#Making-the-manuals" accesskey="n" rel="next">Making the manuals</a>, Previous: <a href="#Simple-compilation" accesskey="p" rel="prev">Simple compilation</a>, Up: <a href="#Installing-R-under-Unix_002dalikes" accesskey="u" rel="up">Installing R under Unix-alikes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Help-options-1"></a>
<h3 class="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
<code>configure</code> option <samp>--enable-prebuilt-html</samp>. Whether
<code>R CMD INSTALL</code> (and hence <code>install.packages</code>) pre-builds
<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
<a name="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>
<a name="Making-the-manuals"></a>
<div class="header">
<p>
Next: <a href="#Installation" accesskey="n" rel="next">Installation</a>, Previous: <a href="#Help-options" accesskey="p" rel="prev">Help options</a>, Up: <a href="#Installing-R-under-Unix_002dalikes" accesskey="u" rel="up">Installing R under Unix-alikes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Making-the-manuals-1"></a>
<h3 class="section">2.3 Making the manuals</h3>
<a name="index-Manuals"></a>
<p>There is a set of manuals that can be built from the sources,
</p>
<dl compact="compact">
<dt>&lsquo;<samp>fullrefman</samp>&rsquo;</dt>
<dd><p>Printed versions of all the help pages for base and recommended packages
(around 3500 pages).
</p></dd>
<dt>&lsquo;<samp>refman</samp>&rsquo;</dt>
<dd><p>Printed versions of the help pages for selected base packages (around
2000 pages)
</p></dd>
<dt>&lsquo;<samp>R-FAQ</samp>&rsquo;</dt>
<dd><p>R <acronym>FAQ</acronym>
</p></dd>
<dt>&lsquo;<samp>R-intro</samp>&rsquo;</dt>
<dd><p>&ldquo;An Introduction to R&rdquo;.
</p></dd>
<dt>&lsquo;<samp>R-data</samp>&rsquo;</dt>
<dd><p>&ldquo;R Data Import/Export&rdquo;.
</p></dd>
<dt>&lsquo;<samp>R-admin</samp>&rsquo;</dt>
<dd><p>&ldquo;R Installation and Administration&rdquo;, this manual.
</p></dd>
<dt>&lsquo;<samp>R-exts</samp>&rsquo;</dt>
<dd><p>&ldquo;Writing R Extensions&rdquo;.
</p></dd>
<dt>&lsquo;<samp>R-lang</samp>&rsquo;</dt>
<dd><p>&ldquo;The R Language Definition&rdquo;.
</p></dd>
</dl>
<p>To make these (with &lsquo;<samp>fullrefman</samp>&rsquo; rather than &lsquo;<samp>refman</samp>&rsquo;), use
</p>
<div class="example">
<pre class="example">make pdf <span class="roman">to create PDF versions</span>
make info <span class="roman">to create info files (not &lsquo;<samp>refman</samp>&rsquo; nor &lsquo;<samp>fullrefman</samp>&rsquo;).</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 &lsquo;<samp>MAKEINFO</samp>&rsquo; 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>
<a name="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 &lsquo;<samp>letter</samp>&rsquo;.)
</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>
<dl compact="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><a name="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
<a href="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.
This is a large installation, obtainable from
<a href="https://www.ctan.org/tex-archive/fonts/ps-type1/cm-super/">https://www.ctan.org/tex-archive/fonts/ps-type1/cm-super/</a>
and its mirrors. These type-1 fonts have poor hinting and so are
nowhere near as readable on-screen as the other three options.
</p>
</dd>
<dt><code>ae</code></dt>
<dd><p>A package to use composites of Computer Modern fonts. This works well
most of the time, and its PDF is more readable on-screen than the
previous two options. There are three fonts for which it will need to
use bitmapped fonts, <samp>tctt0900.600pk</samp>, <samp>tctt1000.600pk</samp> and
<samp>tcrm1000.600pk</samp>. Unfortunately, if those files are not available,
Acrobat Reader will substitute completely incorrect glyphs so you need
to examine the logs carefully.
</p></dd>
</dl>
<p>The default can be overridden by setting the environment variable
<a name="index-R_005fRD4PDF"></a>
<code>R_RD4PDF</code>. (On Unix-alikes, this will be picked up at install time
and stored in <samp>etc/Renviron</samp>, but can still be overridden when the
manuals are built, using <code>make -e</code>.) The usual<a name="DOCF6" href="#FOOT6"><sup>6</sup></a> default value for <code>R_RD4PDF</code> is
&lsquo;<samp>times,inconsolata,hyper</samp>&rsquo;: omit &lsquo;<samp>hyper</samp>&rsquo; if you do not want
hyperlinks (e.g. for printing the manual) or do not have LaTeX
package <strong>hyperref</strong>, and omit &lsquo;<samp>inconsolata</samp>&rsquo; if you do not have
LaTeX package <strong>inconsolata</strong> installed.
</p>
<p>Further options, e.g for <strong>hyperref</strong>, can be included in a file
<samp>Rd.cfg</samp> somewhere on your LaTeX search path. For example, if
you prefer the text and not the page number in the table of contents to
be hyperlinked use
</p><div class="example">
<pre class="example">\ifthenelse{\boolean{Rd@use@hyper}}{\hypersetup{linktoc=section}}{}
</pre></div>
<p>or
</p><div class="example">
<pre class="example">\ifthenelse{\boolean{Rd@use@hyper}}{\hypersetup{linktoc=all}}{}
</pre></div>
<p>to hyperlink both text and page number.
</p>
<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><div class="example">
<pre class="example">make ebooks
make epub
make mobi
</pre></div>
<p>This requires <code>ebook-convert</code> from <code>Calibre</code>
(<a href="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>
<a name="Installation"></a>
<div class="header">
<p>
Next: <a href="#Uninstallation" accesskey="n" rel="next">Uninstallation</a>, Previous: <a href="#Making-the-manuals" accesskey="p" rel="prev">Making the manuals</a>, Up: <a href="#Installing-R-under-Unix_002dalikes" accesskey="u" rel="up">Installing R under Unix-alikes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Installation-1"></a>
<h3 class="section">2.4 Installation</h3>
<a name="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 &lsquo;<samp>022</samp>&rsquo;) before unpacking
the sources and throughout the build process.
</p>
<p>After
</p>
<a name="index-configure-2"></a>
<div class="example">
<pre class="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>
<div class="example">
<pre class="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>
<dl compact="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, &hellip;). Here
<var>LIBnn</var> is usually &lsquo;<samp>lib</samp>&rsquo;, but may be &lsquo;<samp>lib64</samp>&rsquo; 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
the option <samp>--prefix</samp>, as in
</p>
<a name="index-configure-3"></a>
<div class="example">
<pre class="example">./configure --prefix=/where/you/want/R/to/go
</pre></div>
<p>where the value should be an absolute path. This causes <code>make
install</code> to install the R script to
<samp>/where/you/want/R/to/go/bin</samp>, and so on. The prefix of the
installation directories can be seen in the status message that is
displayed at the end of <code>configure</code>. The installation may need
to be done by the owner of <samp><var>prefix</var></samp>, often a root account.
</p>
<p>You can install into another directory tree by using
</p>
<div class="example">
<pre class="example">make prefix=/path/to/here install
</pre></div>
<p>at least with <acronym>GNU</acronym> or Solaris <code>make</code> (but not some
older Unix makes).
</p>
<p>More precise control is available at configure time via options: see
<code>configure --help</code> for details. (However, most of the &lsquo;Fine
tuning of the installation directories&rsquo; options are not used by R.)
</p>
<p>Configure options <samp>--bindir</samp> and <samp>--mandir</samp> are supported
and govern where a copy of the <code>R</code> script and the <code>man</code>
page are installed.
</p>
<p>The configure option <samp>--libdir</samp> controls where the main R
files are installed: the default is &lsquo;<samp><var>eprefix</var>/<var>LIBnn</var></samp>&rsquo;,
where <var>eprefix</var> is the prefix used for installing
architecture-dependent files, defaults to <var>prefix</var>, and can be set
via the configure option <samp>--exec-prefix</samp>.
</p>
<p>Each of <code>bindir</code>, <code>mandir</code> and <code>libdir</code> can also be
specified on the <code>make install</code> command line (at least for
<acronym>GNU</acronym> <code>make</code>).
</p>
<p>The <code>configure</code> or <code>make</code> variables <code>rdocdir</code> and
<code>rsharedir</code> can be used to install the system-independent
<samp>doc</samp> and <samp>share</samp> directories to somewhere other than
<code>libdir</code>. The C header files can be installed to the value of
<code>rincludedir</code>: note that as the headers are not installed into a
subdirectory you probably want something like
<code>rincludedir=/usr/local/include/R-3.2.3</code>.
</p>
<p>If you want the R home to be something other than
<samp><var>libdir</var>/R</samp>, use <samp>rhome</samp>: for example
</p>
<div class="example">
<pre class="example">make install rhome=/usr/local/lib64/R-3.2.3
</pre></div>
<p>will use a version-specific R home on a non-Debian Linux 64-bit
system.
</p>
<p>If you have made R as a shared/static library you can install it in
your system&rsquo;s library directory by
</p>
<div class="example">
<pre class="example">make prefix=/path/to/here install-libR
</pre></div>
<p>where <code>prefix</code> is optional, and <code>libdir</code> will give more
precise control.<a name="DOCF7" href="#FOOT7"><sup>7</sup></a> However, you should not install
to a directory mentioned in <code>LDPATHS</code> (e.g.
<samp>/usr/local/lib64</samp>) if you intend to work with multiple versions of
R, since that directory may be given precedence over the <samp>lib</samp>
directory of other R installations.
</p>
<div class="example">
<pre class="example">make install-strip
</pre></div>
<p>will install stripped executables, and on platforms where this is
supported, stripped libraries in directories <samp>lib</samp> and
<samp>modules</samp> and in the standard packages.
</p>
<p>Note that installing R into a directory whose path contains spaces is
not supported, and some aspects (such as installing source packages)
will not work.
</p>
<a name="index-Manuals_002c-installing"></a>
<p>To install info and PDF versions of the manuals, use one or both of
</p>
<div class="example">
<pre class="example">make install-info
make install-pdf
</pre></div>
<p>Once again, it is optional to specify <code>prefix</code>, <code>libdir</code> or
<code>rhome</code> (the PDF manuals are installed under the R home
directory). (<code>make install-info</code> needs <code>Perl</code> installed
if there is no command <code>install-info</code> on the system.)
</p>
<p>More precise control is possible. For info, the setting used is that of
<code>infodir</code> (default <samp><var>prefix</var>/info</samp>, set by configure
option <samp>--infodir</samp>). The PDF files are installed into the R
<samp>doc</samp> tree, set by the <code>make</code> variable <code>rdocdir</code>.
</p>
<p>A staged installation is possible, that it is installing R into a
temporary directory in order to move the installed tree to its final
destination. In this case <code>prefix</code> (and so on) should reflect the
<a name="index-DESTDIR"></a>
final destination, and <code>DESTDIR</code> should be used: see
<a href="https://www.gnu.org/prep/standards/html_node/DESTDIR.html">https://www.gnu.org/prep/standards/html_node/DESTDIR.html</a>.
</p>
<p>You can optionally install the run-time tests that are part of
<code>make check-all</code> by
</p>
<div class="example">
<pre class="example">make install-tests
</pre></div>
<p>which populates a <samp>tests</samp> directory in the installation.
</p>
<hr>
<a name="Uninstallation"></a>
<div class="header">
<p>
Next: <a href="#Sub_002darchitectures" accesskey="n" rel="next">Sub-architectures</a>, Previous: <a href="#Installation" accesskey="p" rel="prev">Installation</a>, Up: <a href="#Installing-R-under-Unix_002dalikes" accesskey="u" rel="up">Installing R under Unix-alikes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Uninstallation-1"></a>
<h3 class="section">2.5 Uninstallation</h3>
<p>You can uninstall R by
</p>
<div class="example">
<pre class="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
</p>
<div class="example">
<pre class="example">make prefix=/path/to/here uninstall-libR
</pre></div>
<hr>
<a name="Sub_002darchitectures"></a>
<div class="header">
<p>
Next: <a href="#Other-Options" accesskey="n" rel="next">Other Options</a>, Previous: <a href="#Uninstallation" accesskey="p" rel="prev">Uninstallation</a>, Up: <a href="#Installing-R-under-Unix_002dalikes" accesskey="u" rel="up">Installing R under Unix-alikes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Sub_002darchitectures-1"></a>
<h3 class="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 &lsquo;<samp>r_arch=<var>name</var></samp>&rsquo; 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
&lsquo;<samp>x86_64</samp>&rsquo; 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 &lsquo;<samp>r_arch</samp>&rsquo;). The space savings can be considerable: on
&lsquo;<samp>x86_64</samp>&rsquo; 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>
<div class="example">
<pre class="example">R --arch=<var>name</var>
</pre></div>
<p>and just running &lsquo;<samp>R</samp>&rsquo; 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
extra builds by
</p>
<div class="example">
<pre class="example">R --arch=<var>name</var> CMD INSTALL --libs-only <var>pkg1</var> <var>pkg2</var> &hellip;
</pre></div>
<p>If you want to mix sub-architectures compiled on different platforms
(for example &lsquo;<samp>x86_64</samp>&rsquo; Linux and &lsquo;<samp>i686</samp>&rsquo; Linux), it is
wise to use explicit names for each, and you may also need to set
<samp>libdir</samp> to ensure that they install into the same place.
</p>
<p>When sub-architectures are used the version of <code>Rscript</code> in
e.g. <samp>/usr/bin</samp> will be the last installed, but
architecture-specific versions will be available in e.g.
<samp>/usr/lib64/R/bin/exec${<var>R_ARCH</var>}</samp>. Normally all installed
architectures will run on the platform so the architecture of
<code>Rscript</code> itself does not matter. The executable
<code>Rscript</code> will run the <code>R</code> script, and at that time the
<a name="index-R_005fARCH"></a>
setting of the <code>R_ARCH</code> environment variable determines the
architecture which is run.
</p>
<p>When running post-install tests with sub-architectures, use
</p>
<div class="example">
<pre class="example">R --arch=<var>name</var> CMD make check[-devel|all]
</pre></div>
<p>to select a sub-architecture to check.
</p>
<p>Sub-architectures are also used on Windows, but by selecting executables
within the appropriate <samp>bin</samp> directory,
<samp><var>R_HOME</var>/bin/i386</samp> or <samp><var>R_HOME</var>/bin/x64</samp>. For
backwards compatibility with R &lt; 2.12.0, there are executables
<samp><var>R_HOME</var>/bin/R.exe</samp> or <samp><var>R_HOME</var>/bin/Rscript.exe</samp>:
these will run an executable from one of the subdirectories, which one
being taken first from the
<a name="index-R_005fARCH-1"></a>
<code>R_ARCH</code> environment variable, then from the
<samp>--arch</samp> command-line option<a name="DOCF8" href="#FOOT8"><sup>8</sup></a> and finally from the
installation default (which is 32-bit for a combined 32/64 bit R
installation).
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Multilib" accesskey="1">Multilib</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Multilib"></a>
<div class="header">
<p>
Previous: <a href="#Sub_002darchitectures" accesskey="p" rel="prev">Sub-architectures</a>, Up: <a href="#Sub_002darchitectures" accesskey="u" rel="up">Sub-architectures</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Multilib-1"></a>
<h4 class="subsection">2.6.1 Multilib</h4>
<p>On Linux<a name="DOCF9" href="#FOOT9"><sup>9</sup></a>, there is an alternative mechanism for mixing 32-bit and 64-bit
libraries known as <em>multilib</em>. If a Linux distribution supports
multilib, then parallel builds of R may be installed in the
sub-directories <samp>lib</samp> (32-bit) and <samp>lib64</samp> (64-bit). The
build to be run may then be selected using the <code>setarch</code>
command. For example, a 32-bit build may be run by
</p>
<div class="example">
<pre class="example">setarch i686 R
</pre></div>
<p>The <code>setarch</code> command is only operational if both 32-bit and
64-bit builds are installed. If there is only one installation of R,
then this will always be run regardless of the architecture specified
by the <code>setarch</code> command.
</p>
<p>There can be problems with installing packages on the non-native
architecture. It is a good idea to run e.g. <code>setarch i686 R</code> for
sessions in which packages are to be installed, even if that is the only
version of R installed (since this tells the package installation
code the architecture needed).
</p>
<p>At present there is a potential problem with packages using Java, as
the post-install for a &lsquo;<samp>i686</samp>&rsquo; RPM on &lsquo;<samp>x86_64</samp>&rsquo; Linux
reconfigures Java and will find the &lsquo;<samp>x86_64</samp>&rsquo; Java. If you know
where a 32-bit Java is installed you may be able to run (as root)
</p>
<div class="example">
<pre class="example">export JAVA_HOME=&lt;path to jre directory of 32-bit Java&gt;
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>
<a name="Other-Options"></a>
<div class="header">
<p>
Next: <a href="#Testing-a-Unix_002dalike-Installation" accesskey="n" rel="next">Testing a Unix-alike Installation</a>, Previous: <a href="#Sub_002darchitectures" accesskey="p" rel="prev">Sub-architectures</a>, Up: <a href="#Installing-R-under-Unix_002dalikes" accesskey="u" rel="up">Installing R under Unix-alikes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Other-Options-1"></a>
<h3 class="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
and recommended packages are lazyloaded but not byte-compiled.
(Alternatively the (make or environment) variable
<code>R_NO_BASE_COMPILE</code> can be set to a non-empty value for the duration
of the build.)
</p>
<p>Option <samp>--with-internal-tzcode</samp> makes use of R&rsquo;s own code and
copy of the Olson database for managing timezones. This will be
preferred where there are issues with the system implementation, usually
involving times after 2037 or before 1916. An alternative time-zone
directory<a name="DOCF10" href="#FOOT10"><sup>10</sup></a> can be used, pointed
to by environment variable <code>TZDIR</code>: this should contain files such
as <samp>Europe/London</samp>. On all tested OSes the system timezone was
deduced correctly, but if necessary it can be set as the value of
environment variable <code>TZ</code>.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#OpenMP-Support" accesskey="1">OpenMP Support</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="OpenMP-Support"></a>
<div class="header">
<p>
Previous: <a href="#Other-Options" accesskey="p" rel="prev">Other Options</a>, Up: <a href="#Other-Options" accesskey="u" rel="up">Other Options</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="OpenMP-Support-1"></a>
<h4 class="subsection">2.7.1 OpenMP Support</h4>
<p>By default <code>configure</code> searches for suitable
options<a name="DOCF11" href="#FOOT11"><sup>11</sup></a> for OpenMP support for the C, C++98, FORTRAN
77 and Fortran compilers.
</p>
<p>Only the C result is currently used for R itself, and only if
<code>MAIN_LD</code>/<code>DYLIB_LD</code> were not specified. This can be
overridden by specifying
</p><div class="example">
<pre class="example">R_OPENMP_CFLAGS
</pre></div>
<p>Use for packages has similar restrictions (involving <code>SHLIB_LD</code> and
similar: note that as FORTRAN 77 code is normally linked by the C
compiler, both need to support OpenMP) and can be overridden by
specifying some of
</p><div class="example">
<pre class="example">SHLIB_OPENMP_CFLAGS
SHLIB_OPENMP_CXXFLAGS
SHLIB_OPENMP_FCFLAGS
SHLIB_OPENMP_FFLAGS
</pre></div>
<p>Setting to an empty value will disable OpenMP for that compiler (and
configuring with <samp>--disable-openmp</samp> will disable all detection of
OpenMP). Note that the <code>configure</code> detection test is to compile
and link a standalone OpenMP program, which is not the same as compiling
a shared object and loading it into the C program of R&rsquo;s executable.
Note that overridden values are not tested.
</p>
<hr>
<a name="Testing-a-Unix_002dalike-Installation"></a>
<div class="header">
<p>
Previous: <a href="#Other-Options" accesskey="p" rel="prev">Other Options</a>, Up: <a href="#Installing-R-under-Unix_002dalikes" accesskey="u" rel="up">Installing R under Unix-alikes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Testing-an-Installation"></a>
<h3 class="section">2.8 Testing an Installation</h3>
<p>Full testing is possible only if the test files have been installed with
</p>
<div class="example">
<pre class="example">make install-tests
</pre></div>
<p>which populates a <samp>tests</samp> directory in the installation.
</p>
<p>If this has been done, two testing routes are available.
The first is to move to the home directory of the R installation
(as given by <code>R.home()</code>) and run
</p>
<div class="example">
<pre class="example">cd tests
## followed by one of
../bin/R CMD make check
../bin/R CMD make check-devel
../bin/R CMD make check-all
</pre></div>
<p>and other useful targets are <code>test-BasePackages</code> and
<code>test-Recommended</code> to the run tests of the standard and
recommended packages (if installed) respectively.
</p>
<p>This re-runs all the tests relevant to the installed R (including for
example code in the package vignettes), but not for example the ones
checking the example code in the manuals nor making the standalone Rmath
library. This can occasionally be useful when the operating environment
has been changed, for example by OS updates or by substituting the
<acronym>BLAS</acronym> (see <a href="#Shared-BLAS">Shared BLAS</a>).
</p>
<p>Parallel checking of packages may be possible: set the environment
variable <code>TEST_MC_CORES</code> to the maximum number of processes to be
run in parallel. This affects both checking the package examples (part
of <code>make check</code>) and package sources (part of <code>make
check-devel</code> and <code>make check-recommended</code>). It does require a
<code>make</code> command which supports the <code>make -j <var>n</var></code>
option: most do but on Solaris you need to select GNU <code>make</code> or
<code>dmake</code>. Where parallel checking of package sources is done, a log
file <samp><var>pngname</var>.log</samp> is left in the <code>tests</code> directory for
inspection.
</p>
<p>Alternatively, the installed R can be run, preferably with
<samp>--vanilla</samp>. Then
<a name="index-LC_005fCOLLATE"></a>
</p>
<div class="example">
<pre class="example">Sys.setenv(LC_COLLATE = &quot;C&quot;, LC_TIME = &quot;C&quot;, LANGUAGE = &quot;en&quot;)
library(&quot;tools&quot;)
testInstalledBasic(&quot;both&quot;)
testInstalledPackages(scope = &quot;base&quot;)
testInstalledPackages(scope = &quot;recommended&quot;)
</pre></div>
<p>runs the basic tests and then all the tests on the standard and
recommended packages. These tests can be run from anywhere: the basic
tests write their results in the <samp>tests</samp> folder of the R home
directory and run fewer tests than the first approach: in particular
they do not test things which need Internet access&mdash;that can be tested
by
</p><div class="example">
<pre class="example">testInstalledBasic(&quot;internet&quot;)
</pre></div>
<p>(On Windows that runs the tests using whichever of internal or WinInet
internet functions has been selected for that session: to test both run
this twice selecting both options using <code>setInternet2</code>.)
</p>
<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>
<div class="example">
<pre class="example">LANGUAGE=en
</pre></div>
<p>and use a UTF-8 or Latin-1 locale.
</p>
<hr>
<a name="Installing-R-under-Windows"></a>
<div class="header">
<p>
Next: <a href="#Installing-R-under-OS-X" accesskey="n" rel="next">Installing R under OS X</a>, Previous: <a href="#Installing-R-under-Unix_002dalikes" accesskey="p" rel="prev">Installing R under Unix-alikes</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Installing-R-under-Windows-1"></a>
<h2 class="chapter">3 Installing R under Windows</h2>
<a name="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
&lsquo;<samp>ix86</samp>&rsquo; and &lsquo;<samp>x86_64</samp>&rsquo; <acronym>CPU</acronym>s.
</p>
<p>Your file system must allow long file names (as is likely except
perhaps for some network-mounted systems).
</p>
<p>Installation is <em>via</em> the installer
<samp>R-3.2.3-win.exe</samp>. Just double-click on the icon and
follow the instructions. When installing on a 64-bit version of Windows
the options will include 32- or 64-bit versions of R (and the default is
to install both). You can uninstall R from the Control Panel.
</p>
<p>Note that you will be asked to choose a language for installation, and
that choice applies to both installation and un-installation but not to
running R itself.
</p>
<p>See the <a href="https://CRAN.R-project.org/bin/windows/base/rw-FAQ.html">R
Windows <acronym>FAQ</acronym></a> for more details on the binary installer.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Building-from-source" accesskey="1">Building from source</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Testing-a-Windows-Installation" accesskey="2">Testing a Windows Installation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Building-from-source"></a>
<div class="header">
<p>
Next: <a href="#Testing-a-Windows-Installation" accesskey="n" rel="next">Testing a Windows Installation</a>, Previous: <a href="#Installing-R-under-Windows" accesskey="p" rel="prev">Installing R under Windows</a>, Up: <a href="#Installing-R-under-Windows" accesskey="u" rel="up">Installing R under Windows</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Building-from-source-1"></a>
<h3 class="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 &lsquo;<samp>C</samp>&rsquo; 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
<a href="https://CRAN.R-project.org/bin/windows/extsoft">https://CRAN.R-project.org/bin/windows/extsoft</a> or
<a href="https://www.stats.ox.ac.uk/pub/Rtools/libs.html">https://www.stats.ox.ac.uk/pub/Rtools/libs.html</a>.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Getting-the-tools" accesskey="1">Getting the tools</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Getting-the-source-files" accesskey="2">Getting the source files</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Building-the-core-files" accesskey="3">Building the core files</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Building-the-cairo-devices-files" accesskey="4">Building the cairo devices files</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Using-ICU-for-collation" accesskey="5">Using ICU for collation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Support-for-libcurl" accesskey="6">Support for libcurl</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Checking-the-build" accesskey="7">Checking the build</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Building-the-manuals" accesskey="8">Building the manuals</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Building-the-Inno-Setup-installer" accesskey="9">Building the Inno Setup installer</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Building-the-MSI-installer">Building the MSI installer</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#g_t64_002dbit-Windows-builds">64-bit Windows builds</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Getting-the-tools"></a>
<div class="header">
<p>
Next: <a href="#Getting-the-source-files" accesskey="n" rel="next">Getting the source files</a>, Previous: <a href="#Building-from-source" accesskey="p" rel="prev">Building from source</a>, Up: <a href="#Building-from-source" accesskey="u" rel="up">Building from source</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Getting-the-tools-1"></a>
<h4 class="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 <a href="#The-Windows-toolset">The Windows toolset</a> (and perhaps updates in
<a href="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 <a href="#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 &ldquo;Full installation&rdquo;, 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>
<a name="Getting-the-source-files"></a>
<div class="header">
<p>
Next: <a href="#Building-the-core-files" accesskey="n" rel="next">Building the core files</a>, Previous: <a href="#Getting-the-tools" accesskey="p" rel="prev">Getting the tools</a>, Up: <a href="#Building-from-source" accesskey="u" rel="up">Building from source</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Getting-the-source-files-1"></a>
<h4 class="subsection">3.1.2 Getting the source files</h4>
<p>You need to collect the following sets of files:
</p><ul>
<li> Get the R source code tarball <samp>R-3.2.3.tar.gz</samp> from
<acronym>CRAN</acronym>. Open a command window (or another shell) at directory
<var>R_HOME</var>, and run
<div class="example">
<pre class="example">tar -xf R-3.2.3.tar.gz
</pre></div>
<p>to create the source tree in <var>R_HOME</var>. <strong>Beware</strong>: do use
<code>tar</code> to extract the sources rather than tools such as WinZip.
If you are using an account with administrative privileges you may get a
lot of messages which can be suppressed by
</p>
<div class="example">
<pre class="example">tar --no-same-owner -xf R-3.2.3.tar.gz
</pre></div>
<a name="index-TAR_005fOPTIONS-1"></a>
<p>or perhaps better, set the environment variable <code>TAR_OPTIONS</code> to the
value &lsquo;<samp>--no-same-owner --no-same-permissions</samp>&rsquo;.
</p>
<p>It is also possible to obtain the source code using Subversion; see
<a href="#Obtaining-R">Obtaining R</a> for details.
</p>
</li><li> If you are not using a tarball you need to obtain copies of the
recommended packages from <acronym>CRAN</acronym>. Put the <samp>.tar.gz</samp> files
in <samp><var>R_HOME</var>/src/library/Recommended</samp> and run <code>make
link-recommended</code>. If you have an Internet connection, you can do this
automatically by running in <samp><var>R_HOME</var>/src/gnuwin32</samp>
<div class="example">
<pre class="example">make rsync-recommended
</pre></div>
</li><li> The binary distributions of external software. Download
<div class="example">
<pre class="example">https://www.stats.ox.ac.uk/pub/Rtools/goodies/multilib/local320.zip
</pre></div>
<p>create an empty directory, say <samp>c:/R/extsoft</samp>, and unpack it in
that directory by e.g.
</p>
<div class="example">
<pre class="example">unzip local320.zip -d c:/R/extsoft
</pre></div>
</li><li> Make a local copy of the configuration rules by
<div class="example">
<pre class="example">cd <var>R_HOME</var>/src/gnuwin32
cp MkRules.dist MkRules.local
</pre></div>
<p>and edit <samp>MkRules.local</samp>, uncommenting <code>EXT_LIBS</code> and setting
it to the appropriate path (in our example <samp>c:/R/extsoft</samp>).
</p>
<p>Look through the file <samp>MkRules.local</samp> and make any other changes
needed: in particular, this is where a 64-bit build is selected and the
locations are set of external software for ICU collation and the
cairo-based devices.
</p>
</li></ul>
<p>The following additional item is normally installed by
<samp>Rtools31.exe</samp>. If instead you choose to do a completely manual
build you will also need
</p>
<ul>
<li> The Tcl/Tk support files are contained in <samp>Rtools31.exe</samp> and
available as <samp>.zip</samp> files from
<a href="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>
<a name="Building-the-core-files"></a>
<div class="header">
<p>
Next: <a href="#Building-the-cairo-devices-files" accesskey="n" rel="next">Building the cairo devices files</a>, Previous: <a href="#Getting-the-source-files" accesskey="p" rel="prev">Getting the source files</a>, Up: <a href="#Building-from-source" accesskey="u" rel="up">Building from source</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Building-the-core-files-1"></a>
<h4 class="subsection">3.1.3 Building the core files</h4>
<a name="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>
<div class="example">
<pre class="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.
<div class="example">
<pre class="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>
<a name="Building-the-cairo-devices-files"></a>
<div class="header">
<p>
Next: <a href="#Using-ICU-for-collation" accesskey="n" rel="next">Using ICU for collation</a>, Previous: <a href="#Building-the-core-files" accesskey="p" rel="prev">Building the core files</a>, Up: <a href="#Building-from-source" accesskey="u" rel="up">Building from source</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Building-the-cairo-devices"></a>
<h4 class="subsection">3.1.4 Building the cairo devices</h4>
<a name="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 = &quot;cairo&quot;</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
<a href="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 &lsquo;<samp>CAIRO_HOME</samp>&rsquo; in <samp>MkRules.local</samp>. (Note that this
tarball unpacks with a top-level directory <samp>src/</samp>:
&lsquo;<samp>CAIRO_HOME</samp>&rsquo; needs to include that directory in its path.)
</p>
<hr>
<a name="Using-ICU-for-collation"></a>
<div class="header">
<p>
Next: <a href="#Support-for-libcurl" accesskey="n" rel="next">Support for libcurl</a>, Previous: <a href="#Building-the-cairo-devices-files" accesskey="p" rel="prev">Building the cairo devices files</a>, Up: <a href="#Building-from-source" accesskey="u" rel="up">Building from source</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Using-ICU-for-collation-1"></a>
<h4 class="subsection">3.1.5 Using ICU for collation</h4>
<p>It is recommended to build R to support ICU (International Components
for Unicode, <a href="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><div class="example">
<pre class="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 <a href="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>
<a name="Support-for-libcurl"></a>
<div class="header">
<p>
Next: <a href="#Checking-the-build" accesskey="n" rel="next">Checking the build</a>, Previous: <a href="#Using-ICU-for-collation" accesskey="p" rel="prev">Using ICU for collation</a>, Up: <a href="#Building-from-source" accesskey="u" rel="up">Building from source</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Support-for-libcurl-1"></a>
<h4 class="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>&quot;libcurl&quot;</code> methods of
<code>download.file</code> and <code>url</code>.
</p>
<p>A suitable distribution can be found <em>via</em>
<a href="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. &lsquo;<samp>https://</samp>&rsquo; 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>
<a name="Checking-the-build"></a>
<div class="header">
<p>
Next: <a href="#Building-the-manuals" accesskey="n" rel="next">Building the manuals</a>, Previous: <a href="#Support-for-libcurl" accesskey="p" rel="prev">Support for libcurl</a>, Up: <a href="#Building-from-source" accesskey="u" rel="up">Building from source</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Checking-the-build-1"></a>
<h4 class="subsection">3.1.7 Checking the build</h4>
<p>You can test a build by running
</p>
<div class="example">
<pre class="example">make check
</pre></div>
<p>The recommended packages can be checked by
</p>
<div class="example">
<pre class="example">make check-recommended
</pre></div>
<p>Other levels of checking are
</p>
<div class="example">
<pre class="example">make check-devel
</pre></div>
<p>for a more thorough check of the R functionality, and
</p>
<div class="example">
<pre class="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>
<a name="Building-the-manuals"></a>
<div class="header">
<p>
Next: <a href="#Building-the-Inno-Setup-installer" accesskey="n" rel="next">Building the Inno Setup installer</a>, Previous: <a href="#Checking-the-build" accesskey="p" rel="prev">Checking the build</a>, Up: <a href="#Building-from-source" accesskey="u" rel="up">Building from source</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Building-the-manuals-1"></a>
<h4 class="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>
<div class="example">
<pre class="example">make manuals
</pre></div>
<p>If you want to make the info versions (not including the Reference
Manual), use
</p>
<div class="example">
<pre class="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 <a href="#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
<a href="https://www.stats.ox.ac.uk/pub/Rtools/">https://www.stats.ox.ac.uk/pub/Rtools/</a>: you will also need to
install <code>Perl</code><a name="DOCF12" href="#FOOT12"><sup>12</sup></a>
</p>
<hr>
<a name="Building-the-Inno-Setup-installer"></a>
<div class="header">
<p>
Next: <a href="#Building-the-MSI-installer" accesskey="n" rel="next">Building the MSI installer</a>, Previous: <a href="#Building-the-manuals" accesskey="p" rel="prev">Building the manuals</a>, Up: <a href="#Building-from-source" accesskey="u" rel="up">Building from source</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Building-the-Inno-Setup-installer-1"></a>
<h4 class="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 <a href="#The-Inno-Setup-installer">The Inno Setup installer</a>).
</p>
<p>Once everything is set up
</p>
<div class="example">
<pre class="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>
<div class="example">
<pre class="example">rbuild <span class="roman">(the executables, the <acronym>FAQ</acronym> docs etc.)</span>
rpackages <span class="roman">(the base packages)</span>
htmldocs <span class="roman">(the HTML documentation)</span>
cairodevices <span class="roman">(the cairo-based graphics devices)</span>
recommended <span class="roman">(the recommended packages)</span>
vignettes <span class="roman">(the vignettes in base packages:</span>
<span class="roman"> only needed if building from an <code>svn</code> checkout)</span>
manuals <span class="roman">(the PDF manuals)</span>
rinstaller <span class="roman">(the install program)</span>
crandir <span class="roman">(the <acronym>CRAN</acronym> distribution directory, only for 64-bit builds)</span>
</pre></div>
<p>The parts can be made individually if a full build is not needed, but
earlier parts must be built before later ones. (The <samp>Makefile</samp>
doesn&rsquo;t enforce this dependency&mdash;some build targets force a lot of
computation even if all files are up to date.) The first four targets
are the default build if just <code>make</code> (or <code>make all</code>) is
run.
</p>
<p>Parallel make is not supported and likely to fail.
</p>
<p>If you want to customize the installation by adding extra packages,
replace <code>make rinstaller</code> by something like
</p>
<div class="example">
<pre class="example">make rinstaller EXTRA_PKGS='pkg1 pkg2 pkg3'
</pre></div>
<p>An alternative way to customize the installer starting with a binary
distribution is to first make an installation of R from the standard
installer, then add packages and make other customizations to that
installation. Then (after having customized file <samp>MkRules</samp>,
possibly <em>via</em> <samp>MkRules.local</samp>, and having made R in the
source tree) in <samp>src/gnuwin32/installer</samp> run
</p>
<div class="example">
<pre class="example">make myR IMAGEDIR=rootdir
</pre></div>
<p>where <samp>rootdir</samp> is the path to the root of the customized
installation (in double quotes if it contains spaces or backslashes).
</p>
<p>Both methods create an executable with a standard name such as
<samp>R-3.2.3-win.exe</samp>, so please rename it to indicate that
it is customized. If you intend to <em>distribute</em> a customized
installer please do check that license requirements are met &ndash; note that
the installer will state that the contents are distributed under GPL
and this has a requirement for <em>you</em> to supply the complete sources
(including the R sources even if you started with a binary distribution
of R, and also the sources of any extra packages (including their
external software) which are included).
</p>
<p>The defaults for the startup parameters may also be customized. For example
</p>
<div class="example">
<pre class="example">make myR IMAGEDIR=rootdir MDISDI=1
</pre></div>
<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>
<div class="example">
<pre class="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>
<a name="Building-the-MSI-installer"></a>
<div class="header">
<p>
Next: <a href="#g_t64_002dbit-Windows-builds" accesskey="n" rel="next">64-bit Windows builds</a>, Previous: <a href="#Building-the-Inno-Setup-installer" accesskey="p" rel="prev">Building the Inno Setup installer</a>, Up: <a href="#Building-from-source" accesskey="u" rel="up">Building from source</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Building-the-MSI-installer-1"></a>
<h4 class="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
<a href="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
required. Then
</p>
<div class="example">
<pre class="example">cd installer
make msi
</pre></div>
<p>which will result in a file with a name like
<samp>R-3.2.3-win32.msi</samp>. This can be double-clicked to be
installed, but those who need it will know what to do with it (usually
by running <code>msiexec /i</code> with additional options). Properties
that users might want to set from the <code>msiexec</code> command line
include &lsquo;<samp>ALLUSERS</samp>&rsquo;, &lsquo;<samp>INSTALLDIR</samp>&rsquo; (something like
<samp>c:\Program Files\R\R-3.2.3</samp>) and &lsquo;<samp>RMENU</samp>&rsquo; (the path
to the &lsquo;<samp>R</samp>&rsquo; folder on the start menu) and &lsquo;<samp>STARTDIR</samp>&rsquo; (the
starting directory for R shortcuts, defaulting to something like
<samp>c:\Users\name\Documents\R</samp>).
</p>
<p>The MSI installer can be built both from a 32-bit build of R
(<samp>R-3.2.3-win32.msi</samp>) and from a 64-bit build of R
(<samp>R-3.2.3-win64.msi</samp>, optionally including 32-bit files
by setting the macro <code>HOME32</code>, when the name is
<samp>R-3.2.3-win.msi</samp>). Unlike the main installer, a 64-bit
MSI installer can only be run on 64-bit Windows.
</p>
<p>Thanks to David del Campo (Dept of Statistics, University of Oxford)
for suggesting WiX and building a prototype installer.
</p>
<hr>
<a name="g_t64_002dbit-Windows-builds"></a>
<div class="header">
<p>
Previous: <a href="#Building-the-MSI-installer" accesskey="p" rel="prev">Building the MSI installer</a>, Up: <a href="#Building-from-source" accesskey="u" rel="up">Building from source</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="g_t64_002dbit-Windows-builds-1"></a>
<h4 class="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
(<a href="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&ndash;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>
<a name="Testing-a-Windows-Installation"></a>
<div class="header">
<p>
Previous: <a href="#Building-from-source" accesskey="p" rel="prev">Building from source</a>, Up: <a href="#Installing-R-under-Windows" accesskey="u" rel="up">Installing R under Windows</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Testing-an-Installation-1"></a>
<h3 class="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>
<div class="example">
<pre class="example">Sys.setenv(LC_COLLATE = &quot;C&quot;, LANGUAGE = &quot;en&quot;)
library(&quot;tools&quot;)
testInstalledBasic(&quot;both&quot;)
testInstalledPackages(scope = &quot;base&quot;, errorsAreFatal = FALSE)
testInstalledPackages(scope = &quot;recommended&quot;, errorsAreFatal = FALSE)
</pre></div>
<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&rsquo; CRLF line endings.
</p>
<hr>
<a name="Installing-R-under-OS-X"></a>
<div class="header">
<p>
Next: <a href="#Running-R" accesskey="n" rel="next">Running R</a>, Previous: <a href="#Installing-R-under-Windows" accesskey="p" rel="prev">Installing R under Windows</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Installing-R-under-OS-X-1"></a>
<h2 class="chapter">4 Installing R under OS X</h2>
<a name="index-OS-X-1"></a>
<p>The front page of a <acronym>CRAN</acronym> site has a link &lsquo;Download R for OS
X&rsquo;. Click on that, then download the file <samp>R-3.2.3.pkg</samp>
and install it. This runs on OS X 10.9 and later (Mavericks, Yosemite,
El Capitan<a name="DOCF13" href="#FOOT13"><sup>13</sup></a>, &hellip;).
</p>
<p>There may be<a name="DOCF14" href="#FOOT14"><sup>14</sup></a> a
separate installer package <samp>R-3.2.3-snowleopard.pkg</samp>,
which runs on OS X 10.6 and later (Snow Leopard, Lion, Mountain Lion,
Mavericks, Yosemite, &hellip;); it is a 64-bit (&lsquo;<samp>x86_64</samp>&rsquo;) build
which should run on all Macs from mid-2008 on.
</p>
<p>Installers for R-patched and R-devel are usually available from
<a href="https://r.research.att.com">https://r.research.att.com</a>, including a
<samp>R-3-2-branch-snowleopard-signed.pkg</samp> build for R-patched.
</p>
<p>For some older versions of the OS you can in principle (it is little
tested) install R from the sources.
</p>
<p>It is important that if you use a binary installer package that your OS
is fully updated: look at &lsquo;Updates&rsquo; from the &lsquo;App Store&rsquo; to be sure.
(If using XQuartz, check that is current.)
</p>
<p>To install, just double-click on the icon of the file you downloaded.
At the &lsquo;Installation Type&rsquo; stage, note the option to &lsquo;Customize&rsquo;. This
currently shows four components: everyone will need the &lsquo;R Framework&rsquo;
component: the remaining components are optional. (The &lsquo;Tcl/Tk&rsquo; component
is needed to use package <strong>tcltk</strong>. The &lsquo;Texinfo&rsquo; component is only
needed by those installing source packages.)
</p>
<p>This is an Apple Installer package. If you encounter any problem during
the installation, please check the Installer log by clicking on the
&ldquo;Window&rdquo; menu and item &ldquo;Installer Log&rdquo;. The full output (select
&ldquo;Show All Log&rdquo;) is useful for tracking down problems. Note the the
installer is clever enough to try to upgrade the last-installed version
of the application where you installed it (which may not be where you
want this time &hellip;).
</p>
<p>Various parts of the build require XQuartz to be installed: : see
<a href="https://xquartz.macosforge.org/">https://xquartz.macosforge.org/</a>. These include the <strong>tcltk</strong>
package and the <code>X11</code> device: attempting to use these without
XQuartz will remind you.
</p>
<p>If you update your OS X version, you should re-install R (and perhaps
XQuartz): the installer tailors the installation to the current version
of the OS.
</p>
<p>For building R from source, see <a href="#OS-X">OS X</a>.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Running-R-under-OS-X" accesskey="1">Running R under OS X</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Uninstalling-under-OS-X" accesskey="2">Uninstalling under OS X</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Multiple-versions" accesskey="3">Multiple versions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Running-R-under-OS-X"></a>
<div class="header">
<p>
Next: <a href="#Uninstalling-under-OS-X" accesskey="n" rel="next">Uninstalling under OS X</a>, Previous: <a href="#Installing-R-under-OS-X" accesskey="p" rel="prev">Installing R under OS X</a>, Up: <a href="#Installing-R-under-OS-X" accesskey="u" rel="up">Installing R under OS X</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Running-R-under-OS-X-1"></a>
<h3 class="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
<a href="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>&rsquo;s &lsquo;Help&rsquo; menu.
</p>
<p>You can run command-line R from a Terminal<a name="DOCF15" href="#FOOT15"><sup>15</sup></a> so these
can be typed as commands like any other Unix-alike: see the next chapter
of this manual. There are some small differences which may surprise
users of R on other platforms, notably the default location of the
personal library directory (under <samp>~/Library/R</samp>,
e.g. <samp>~/Library/R/3.3/library</samp>), and that warnings, messages and
other output to <samp>stderr</samp> are highlighted in bold.
</p>
<p>It has been reported that running <small>R.APP</small> under Yosemite may fail if no
preferences are stored, so if it fails when launched for the very first
time, try it again (the first attempt will store some preferences).
</p>
<p>Users of <small>R.APP</small> under Mavericks and later need to be aware of the &lsquo;App
Nap&rsquo; feature
(<a href="https://developer.apple.com/library/mac/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_9.html">https://developer.apple.com/library/mac/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_9.html</a>)
which can cause R tasks to appear to run very slowly when not
producing output in the console. Here are three ways to avoid it:
</p>
<ul>
<li> Ensure that the console is completely visible (or at least the activity
indicator at the top right corner is visible).
</li><li> Call &lsquo;<samp>Get Info</samp>&rsquo; on the application (e.g. from Finder). This may
have two tick boxes in the &lsquo;General&rsquo; panel: click the one named &lsquo;Prevent
App Nap&rsquo; if it is not already ticked. (This only available for builds
made prior to Mavericks.)
</li><li> In a Terminal, run
<div class="example">
<pre class="example">defaults write org.R-project.R NSAppSleepDisabled -bool YES
</pre></div>
<p>(see <a href="https://developer.apple.com/library/mac/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_9.html">https://developer.apple.com/library/mac/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_9.html</a>).
</p></li></ul>
<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 <a href="#OS-X">OS X</a>. (As do the <strong>tcltk</strong> package and
some third-party packages.)
</p>
<hr>
<a name="Uninstalling-under-OS-X"></a>
<div class="header">
<p>
Next: <a href="#Multiple-versions" accesskey="n" rel="next">Multiple versions</a>, Previous: <a href="#Running-R-under-OS-X" accesskey="p" rel="prev">Running R under OS X</a>, Up: <a href="#Installing-R-under-OS-X" accesskey="u" rel="up">Installing R under OS X</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Uninstalling-under-OS-X-1"></a>
<h3 class="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
run (use <samp>/usr/local/bin</samp> on El Capitan):
</p>
<div class="example">
<pre class="example">sudo rm -rf /Library/Frameworks/R.framework /Applications/R.app \
/usr/bin/R /usr/bin/Rscript
</pre></div>
<p>The installation consists of four Apple packages:
<code>org.r-project.R.x86_64.fw.pkg</code>,
<code>org.r-project.R.x86_64.GUI.pkg</code>,
<code>org.r-project.x86_64.tcltk.x11</code> and
<code>org.r-project.x86_64.texinfo</code> (not all of which need be
installed). You can use <code>pkgutil --forget</code> if you want the Apple
Installer to forget about the package without deleting its files (useful
for the R framework when installing multiple R versions in parallel),
or after you have deleted the files.
</p>
<p>Uninstalling the Tcl/Tk or Texinfo components (which are installed under
<samp>/usr/local</samp>) is not as simple. You can list the files they installed
in a Terminal by
</p>
<div class="example">
<pre class="example">pkgutil --files org.r-project.x86_64.tcltk.x11
pkgutil --files org.r-project.x86_64.texinfo
</pre></div>
<p>These are paths relative to <samp>/</samp>, the root of the file system.
</p>
<hr>
<a name="Multiple-versions"></a>
<div class="header">
<p>
Previous: <a href="#Uninstalling-under-OS-X" accesskey="p" rel="prev">Uninstalling under OS X</a>, Up: <a href="#Installing-R-under-OS-X" accesskey="u" rel="up">Installing R under OS X</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Multiple-versions-1"></a>
<h3 class="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
&lsquo;<samp>3.x.y</samp>&rsquo; versions installed for the same &lsquo;<samp>x</samp>&rsquo;.
</p>
<p>A version of R can be run directly from the command-line as e.g.
</p><div class="example">
<pre class="example">/Library/Frameworks/R.framework/Versions/3.2/Resources/bin/R
</pre></div>
<p>However, <small>R.APP</small> will always run the &lsquo;current&rsquo; version, that is the last
installed version. A small utility, <code>Rswitch.app</code> (available at
<a href="https://r.research.att.com/#other">https://r.research.att.com/#other</a>), can be used to change the
&lsquo;current&rsquo; 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>
<a name="Running-R"></a>
<div class="header">
<p>
Next: <a href="#Add_002don-packages" accesskey="n" rel="next">Add-on packages</a>, Previous: <a href="#Installing-R-under-OS-X" accesskey="p" rel="prev">Installing R under OS X</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Running-R-1"></a>
<h2 class="chapter">5 Running R</h2>
<p>How to start R and what command-line options are available is discussed
in <a href="./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
<a name="index-R_005fPAPERSIZE-1"></a>
change them &ndash; a possible exception is <code>R_PAPERSIZE</code> (see <a href="#Setting-paper-size">Setting paper size</a>). The paper size will be deduced from the &lsquo;<samp>LC_PAPER</samp>&rsquo;
locale category if it exists and <code>R_PAPERSIZE</code> is unset, and this
will normally produce the right choice from &lsquo;<samp>a4</samp>&rsquo; and &lsquo;<samp>letter</samp>&rsquo;
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
<a name="index-TMPDIR-2"></a>
<a name="index-TMP"></a>
<a name="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
<a name="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
<a name="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
&lsquo;<samp>noexec</samp>&rsquo;, <code>TMPDIR</code> needs to be set to a directory from which
execution is allowed.
</p>
<hr>
<a name="Add_002don-packages"></a>
<div class="header">
<p>
Next: <a href="#Internationalization" accesskey="n" rel="next">Internationalization</a>, Previous: <a href="#Running-R" accesskey="p" rel="prev">Running R</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Add_002don-packages-1"></a>
<h2 class="chapter">6 Add-on packages</h2>
<a name="index-Packages"></a>
<a name="index-Libraries"></a>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Default-packages" accesskey="1">Default packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Managing-libraries" accesskey="2">Managing libraries</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Installing-packages" accesskey="3">Installing packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Updating-packages" accesskey="4">Updating packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Removing-packages" accesskey="5">Removing packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Setting-up-a-package-repository" accesskey="6">Setting up a package repository</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Checking-installed-source-packages" accesskey="7">Checking installed source packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<p>It is helpful to use the correct terminology. A <em>package</em> is
loaded from a <em>library</em> by the function <code>library()</code>. Thus a
library is a directory containing installed packages; the main library
is <samp><var>R_HOME</var>/library</samp>, but others can be used, for example by
<a name="index-R_005fLIBS"></a>
setting the environment variable <code>R_LIBS</code> or using the R function
<code>.libPaths()</code>.
</p>
<hr>
<a name="Default-packages"></a>
<div class="header">
<p>
Next: <a href="#Managing-libraries" accesskey="n" rel="next">Managing libraries</a>, Previous: <a href="#Add_002don-packages" accesskey="p" rel="prev">Add-on packages</a>, Up: <a href="#Add_002don-packages" accesskey="u" rel="up">Add-on packages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Default-packages-1"></a>
<h3 class="section">6.1 Default packages</h3>
<a name="index-Packages_002c-default"></a>
<p>The set of packages loaded on startup is by default
</p>
<div class="example">
<pre class="example">&gt; getOption(&quot;defaultPackages&quot;)
[1] &quot;datasets&quot; &quot;utils&quot; &quot;grDevices&quot; &quot;graphics&quot; &quot;stats&quot; &quot;methods&quot;
</pre></div>
<p>(plus, of course, <strong>base</strong>) and this can be changed by setting the
option in startup code (e.g. in <samp>~/.Rprofile</samp>). It is initially
<a name="index-R_005fDEFAULT_005fPACKAGES"></a>
set to the value of the environment variable <code>R_DEFAULT_PACKAGES</code> if
set (as a comma-separated list). Setting <code>R_DEFAULT_PACKAGES=NULL</code>
ensures that only package <strong>base</strong> is loaded.
</p>
<p>Changing the set of default packages is normally used to reduce the set
for speed when scripting: in particular not using <strong>methods</strong> will
reduce the start-up time by a factor of up to two (and this is done by
<code>Rscript</code>). But it can also be used to customize R, e.g.
for class use.
</p>
<hr>
<a name="Managing-libraries"></a>
<div class="header">
<p>
Next: <a href="#Installing-packages" accesskey="n" rel="next">Installing packages</a>, Previous: <a href="#Default-packages" accesskey="p" rel="prev">Default packages</a>, Up: <a href="#Add_002don-packages" accesskey="u" rel="up">Add-on packages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Managing-libraries-1"></a>
<h3 class="section">6.2 Managing libraries</h3>
<a name="index-Libraries_002c-managing"></a>
<p>R packages are installed into <em>libraries</em>, which are
directories in the file system containing a subdirectory for each
package installed there.
</p>
<p>R comes with a single library, <samp><var>R_HOME</var>/library</samp> which is
the value of the R object &lsquo;<samp>.Library</samp>&rsquo; containing the standard and
recommended<a name="DOCF16" href="#FOOT16"><sup>16</sup></a> packages.
Both sites and users can create others and make use of them (or not) in
an R session. At the lowest level &lsquo;<samp>.libPaths()</samp>&rsquo; can be used to
add paths to the collection of libraries or to report the current
collection.
</p>
<a name="index-Libraries_002c-site"></a>
<a name="index-Site-libraries"></a>
<p>R will automatically make use of a site-specific library
<samp><var>R_HOME</var>/site-library</samp> if this exists (it does not in a
vanilla R installation). This location can be overridden by
setting<a name="DOCF17" href="#FOOT17"><sup>17</sup></a> &lsquo;<samp>.Library.site</samp>&rsquo; in
<samp><var>R_HOME</var>/etc/Rprofile.site</samp>, or (not recommended) by setting
the
<a name="index-R_005fLIBS_005fSITE"></a>
environment variable <code>R_LIBS_SITE</code>. Like &lsquo;<samp>.Library</samp>&rsquo;, the
site libraries are always included by &lsquo;<samp>.libPaths()</samp>&rsquo;.
</p>
<a name="index-Libraries_002c-user"></a>
<a name="index-User-libraries"></a>
<a name="index-R_005fLIBS_005fUSER"></a>
<p>Users can have one or more libraries, normally specified by the
environment variable <code>R_LIBS_USER</code>. This has a default value (to
see it, use &lsquo;<samp>Sys.getenv(&quot;R_LIBS_USER&quot;)</samp>&rsquo; within an R session),
but that is only used if the corresponding directory actually exists
(which by default it will not).
</p>
<p>Both <code>R_LIBS_USER</code> and <code>R_LIBS_SITE</code> can specify multiple
library paths, separated by colons (semicolons on Windows).
</p>
<hr>
<a name="Installing-packages"></a>
<div class="header">
<p>
Next: <a href="#Updating-packages" accesskey="n" rel="next">Updating packages</a>, Previous: <a href="#Managing-libraries" accesskey="p" rel="prev">Managing libraries</a>, Up: <a href="#Add_002don-packages" accesskey="u" rel="up">Add-on packages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Installing-packages-1"></a>
<h3 class="section">6.3 Installing packages</h3>
<a name="index-Packages_002c-installing"></a>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Windows-packages" accesskey="1">Windows packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#OS-X-packages" accesskey="2">OS X packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Customizing-package-compilation" accesskey="3">Customizing package compilation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Multiple-sub_002darchitectures" accesskey="4">Multiple sub-architectures</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Byte_002dcompilation" accesskey="5">Byte-compilation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<p>Packages may be distributed in source form or compiled binary form.
Installing source packages which contain C/C++/Fortran code requires
that compilers and related tools be installed. Binary packages are
platform-specific and generally need no special tools to install, but
see the documentation for your platform for details.
</p>
<p>Note that you may need to specify implicitly or explicitly the library to
which the package is to be installed. This is only an issue if you have
more than one library, of course.
</p>
<a name="index-TMPDIR-4"></a>
<p>Ensure that the environment variable <code>TMPDIR</code> is either unset (and
<samp>/tmp</samp> exists and can be written in and executed from) or is the
absolute path to a valid temporary directory, not containing spaces.
</p>
<p>For most users it suffices to call
&lsquo;<samp>install.packages(<var>pkgname</var>)</samp>&rsquo; or its GUI equivalent if the
intention is to install a <acronym>CRAN</acronym> package and internet access is
available.<a name="DOCF18" href="#FOOT18"><sup>18</sup></a> On most systems &lsquo;<samp>install.packages()</samp>&rsquo;
will allow packages to be selected from a list box (typically with
several thousand items).
</p>
<p>To install packages from source on a Unix-alike use in a terminal
</p>
<div class="example">
<pre class="example">R CMD INSTALL -l /path/to/library <var>pkg1</var> <var>pkg2</var> &hellip;
</pre></div>
<p>The part &lsquo;<samp>-l /path/to/library</samp>&rsquo; can be omitted, in which case the
first library of a normal R session is used (that shown by
<code>.libPaths()[1]</code>).
</p>
<p>There are a number of options available: use <code>R CMD INSTALL --help</code>
to see the current list.
</p>
<a name="index-install_002epackages"></a>
<p>Alternatively, packages can be downloaded and installed from within
R. First choose your nearest <acronym>CRAN</acronym> mirror using
<code>chooseCRANmirror()</code>. Then download and install packages
<strong>pkg1</strong> and <strong>pkg2</strong> by
</p>
<div class="example">
<pre class="example">&gt; install.packages(c(&quot;pkg1&quot;, &quot;pkg2&quot;))
</pre></div>
<p>The essential dependencies of the specified packages will also be fetched.
Unless the library is specified (argument <code>lib</code>) the first library
in the library search path is used: if this is not writable, R will
ask the user (in an interactive session) if the default personal library
should be created, and if allowed to will install the packages there.
</p>
<p>If you want to fetch a package and all those it depends on (in any way)
that are not already installed, use e.g.
</p>
<div class="example">
<pre class="example">&gt; install.packages(&quot;Rcmdr&quot;, dependencies = TRUE)
</pre></div>
<p><code>install.packages</code> can install a source package from a local
<samp>.tar.gz</samp> file (or a URL to such a file) by setting argument
<code>repos</code> to <code>NULL</code>: this will be selected automatically if the
name given is a single <samp>.tar.gz</samp> file.
</p>
<p><code>install.packages</code> can look in several repositories, specified as a
character vector by the argument <code>repos</code>: these can include a
<acronym>CRAN</acronym> mirror, Bioconductor, Omegahat, R-forge, rforge.net,
local archives, local files, &hellip;). Function
<code>setRepositories()</code> can select amongst those repositories that the
R installation is aware of.
</p>
<p>Naive users sometimes forget that as well as installing a package, they
have to use <code>library</code> to make its functionality available.
</p>
<hr>
<a name="Windows-packages"></a>
<div class="header">
<p>
Next: <a href="#OS-X-packages" accesskey="n" rel="next">OS X packages</a>, Previous: <a href="#Installing-packages" accesskey="p" rel="prev">Installing packages</a>, Up: <a href="#Installing-packages" accesskey="u" rel="up">Installing packages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Windows"></a>
<h4 class="subsection">6.3.1 Windows</h4>
<p>What <code>install.packages</code> does by default is different on Unix-alikes
(except OS X) and Windows. On Unix-alikes it consults the list of
available <em>source</em> packages on <acronym>CRAN</acronym> (or other
repository/ies), downloads the latest version of the package sources,
and installs them (via <code>R CMD INSTALL</code>). On Windows it looks (by
default) first at the list of <em>binary</em> versions of packages
available for your version of R and downloads the latest versions (if
any). If no binary version is available or the source version is newer,
it will install the source versions of packages without compiled
C/C++/Fortran code, and offer to do so for those with, if <code>make</code>
is available (and this can be tuned by option
<code>&quot;install.packages.compile.from.source&quot;</code>).
</p>
<p>On Windows <code>install.packages</code> can also install a binary package
from a local <samp>zip</samp> file (or the URL of such a file) by setting
argument <code>repos</code> to <code>NULL</code>. <code>Rgui.exe</code> has a menu
<code>Packages</code> with a GUI interface to <code>install.packages</code>,
<code>update.packages</code> and <code>library</code>.
</p>
<p>Windows binary packages for R are distributed as a single binary
containing either or both architectures (32- and 64-bit).
</p>
<p>A few of the binary packages need other software to be installed on your
system: see for example
<a href="https://CRAN.R-project.org/bin/windows/contrib/3.2/@ReadMe">https://CRAN.R-project.org/bin/windows/contrib/3.2/@ReadMe</a>.
Packages using Gtk+ (<a href="https://CRAN.R-project.org/package=Cairo"><strong>Cairo</strong></a>, <a href="https://CRAN.R-project.org/package=RGtk2"><strong>RGtk2</strong></a>,
<a href="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
<a href="http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+">http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+</a> or
<a href="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>
directories in the path on a 64-bit version of R.
</p>
<p><code>R CMD INSTALL</code> works in Windows to install source packages. No
additional tools are needed if the package does not contain compiled
code, and <code>install.packages(type=&quot;source&quot;)</code> will work for such
packages (and for those with compiled code if the tools (see <a href="#The-Windows-toolset">The Windows toolset</a>) are in the path). We have seen occasional permission
problems after unpacking source packages on some systems: these have
been circumvented by setting the environment variable
<code>R_INSTALL_TAR</code> to &lsquo;<samp>tar.exe</samp>&rsquo;.
<a name="index-R_005fINSTALL_005fTAR"></a>
</p>
<p>If you have only a source package that is known to work with current
R and just want a binary Windows build of it, you could make use of
the building service offered at
<a href="http://win-builder.r-project.org/">http://win-builder.r-project.org/</a>.
</p>
<p>For almost all packages <code>R CMD INSTALL</code> will attempt to install
both 32- and 64-bit builds of a package if run from a 32/64-bit install
of R. It will report success if the installation of the architecture
of the running <code>R</code> succeeded, whether or not the other
architecture was successfully installed. The exceptions are packages
with a non-empty <samp>configure.win</samp> script or which make use of
<samp>src/Makefile.win</samp>. If <samp>configure.win</samp> does something
appropriate to both architectures use<a name="DOCF19" href="#FOOT19"><sup>19</sup></a> option
<samp>--force-biarch</samp>: otherwise <code>R CMD INSTALL
--merge-multiarch</code> can be applied to a source tarball to merge separate
32- and 64-bit installs. (This can only be applied to a tarball, and
will only succeed if both installs succeed.)
</p>
<p>If you have a package without compiled code and no Windows-specific
help, you can zip up an installation on another OS and install from that
zip file on Windows. However, such a package can be installed from the
sources on Windows without any additional tools.
</p>
<a name="index-LOCAL_005fSOFT"></a>
<p>There is provision to make use of a system-wide library of installed
external software by setting the <code>make</code> variable
<code>LOCAL_SOFT</code>, to give an equivalent of <samp>/usr/local</samp> on a
Unix-alike. This can be set in <samp>src/gnuwin/MkRules.local</samp> when
R is built from sources (see the comments in
<samp>src/gnuwin/MkRules.dist</samp>), or in file<a name="DOCF20" href="#FOOT20"><sup>20</sup></a> <samp>etc/i386/Makeconf</samp> or <samp>etc/x64/Makeconf</samp> for an
installed version of R. The version used by <acronym>CRAN</acronym> can be
installed as described in <a href="#Building-from-source">Building from source</a>.
</p>
<hr>
<a name="OS-X-packages"></a>
<div class="header">
<p>
Next: <a href="#Customizing-package-compilation" accesskey="n" rel="next">Customizing package compilation</a>, Previous: <a href="#Windows-packages" accesskey="p" rel="prev">Windows packages</a>, Up: <a href="#Installing-packages" accesskey="u" rel="up">Installing packages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="OS-X-1"></a>
<h4 class="subsection">6.3.2 OS X</h4>
<p>On OS X <code>install.packages</code> works as it does on other Unix-alike
systems, but there are additional types starting with <code>mac.binary</code>
(available for the <acronym>CRAN</acronym> distribution but not when compiling
from source: <code>mac.binary.mavericks</code> for a &lsquo;Mavericks&rsquo; build with
<code>&quot;default&quot;</code> a synonym for the appropriate variant) which can be
passed to <code>install.packages</code> in order to download and install
binary packages from a suitable repository. These OS X binary package
files have the extension &lsquo;<samp>.tgz</samp>&rsquo;. The <small>R.APP</small> GUI provides menus
for installation of either binary or source packages, from
<acronym>CRAN</acronym> or local files.
</p>
<p>On R builds using binary packages, the default is type <code>both</code>:
this looks first at the list of binary packages available for your
version of R and installs the latest versions (if any). If no binary
version is available or the source version is newer, it will install the
source versions of packages without compiled C/C++/Fortran code and offer
to do so for those with, if <code>make</code> is available.
</p>
<p>Note that most binary packages including compiled code are tied to a
particular series (e.g. R 3.2.x or 3.1.x) of R.
</p>
<p>You should not attempt to mix-and-match binary packages built for the
&lsquo;Snow Leopard&rsquo; and &lsquo;Mavericks&rsquo; <acronym>CRAN</acronym> distributions: doing so is
likely to lead to crashes or failures to load.
</p>
<p>Installing source packages which do not contain compiled code should
work with no additional tools. For others you will need the
&lsquo;Command Line Tools&rsquo; for <code>Xcode</code> and compilers which match those
used to build R: see <a href="#OS-X">OS X</a>.
</p>
<p>Package <a href="https://CRAN.R-project.org/package=rJava"><strong>rJava</strong></a> and those which depend on it need a Java runtime
installed and several packages need X11 installed, including those using
Tk. For Mountain Lion and later see <a href="#OS-X">OS X</a> and <a href="#Java-_0028OS-X_0029">Java (OS X)</a>.
</p>
<p>Tcl/Tk extensions <code>BWidget</code> and <code>Tktable</code> are part of the
Tcl/Tk contained in the R installer. These are required by a number
of <acronym>CRAN</acronym> and Bioconductor packages.
</p>
<p>A few of the binary packages need other software to be installed on your
system. In particular packages using Gtk+ (<a href="https://CRAN.R-project.org/package=RGtk2"><strong>RGtk2</strong></a>,
<a href="https://CRAN.R-project.org/package=cairoDevice"><strong>cairoDevice</strong></a> and those that depend on them) need the GTK
framework installed from <a href="https://r.research.att.com/libs/">https://r.research.att.com/libs/</a>: the
appropriate version at the time of writing was
<a href="https://r.research.att.com/libs/GTK_2.24.17-X11.pkg">https://r.research.att.com/libs/GTK_2.24.17-X11.pkg</a>
</p>
<p>The default compilers specified in
<samp>/Library/Frameworks/R.framework/Resources/etc/Makeconf</samp> depend on
the version of OS X under which R was installed, and are appropriate
to the latest version of the command-line tools for that version
of OS X. The settings can be changed, either by editing that file or in
a file such as <samp>~/.R/Makevars</samp> (see the next section). Entries
which may need to be changed include &lsquo;<samp>CC</samp>&rsquo;, &lsquo;<samp>CXX</samp>&rsquo;, &lsquo;<samp>FC</samp>&rsquo;,
&lsquo;<samp>F77</samp>&rsquo;, &lsquo;<samp>FLIBS</samp>&rsquo; and the corresponding flags, and perhaps
&lsquo;<samp>CXXCPP</samp>&rsquo;, &lsquo;<samp>DYLIB_LD</samp>&rsquo;, &lsquo;<samp>MAIN_LD</samp>&rsquo;, &lsquo;<samp>SHLIB_CXXLD</samp>&rsquo;,
&lsquo;<samp>SHLIB_FCLD</samp>&rsquo; and &lsquo;<samp>SHLIB_LD</samp>&rsquo;.
</p>
<p>So for example you could select <code>clang</code> for both C and C++ with
extensive checking by having in <samp>~/.R/Makevars</samp>
</p><div class="example">
<pre class="example">CC=clang
CXX=clang++
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
</pre></div>
<p>and for a version of <code>gfortran-4.2</code> we needed
</p><div class="example">
<pre class="example">FLIBS=-lgfortran
</pre></div>
<hr>
<a name="Customizing-package-compilation"></a>
<div class="header">
<p>
Next: <a href="#Multiple-sub_002darchitectures" accesskey="n" rel="next">Multiple sub-architectures</a>, Previous: <a href="#OS-X-packages" accesskey="p" rel="prev">OS X packages</a>, Up: <a href="#Installing-packages" accesskey="u" rel="up">Installing packages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Customizing-package-compilation-1"></a>
<h4 class="subsection">6.3.3 Customizing package compilation</h4>
<p>The R system and package-specific compilation flags can be overridden or
added to by setting the appropriate Make variables in the personal file
<samp><var>HOME</var>/.R/Makevars-<var>R_PLATFORM</var></samp> (but
<samp><var>HOME</var>/.R/Makevars.win</samp> or <samp><var>HOME</var>/.R/Makevars.win64</samp>
on Windows), or if that does not exist, <samp><var>HOME</var>/.R/Makevars</samp>,
where &lsquo;<samp>R_PLATFORM</samp>&rsquo; is the platform for which R was built, as
available in the <code>platform</code> component of the R variable
<code>R.version</code>. An alternative personal file can be specified
<em>via</em> the environment variable <code>R_MAKEVARS_USER</code>.
</p>
<p>Package developers are encouraged to use this mechanism to enable a
reasonable amount of diagnostic messaging (&ldquo;warnings&rdquo;) when compiling,
such as e.g. <samp>-Wall -pedantic</samp> for tools from GCC, the Gnu
Compiler Collection.
</p>
<p>Note that this mechanism can also be used when it necessary to change
the optimization level for a particular package. For example
</p>
<div class="example">
<pre class="example">## <span class="roman">for C code</span>
CFLAGS=-g -O -mtune=native
## <span class="roman">for C++ code</span>
CXXFLAGS=-g -O -mtune=native
## <span class="roman">for Fortran code</span>
FFLAGS=-g -O -mtune=native
## <span class="roman">for Fortran 9x code</span>
FCFLAGS=-g -O -mtune=native
</pre></div>
<p>Another use is to override the settings in a binary installation of R.
For example, to use a different Fortran compiler on OS X
</p>
<div class="example">
<pre class="example">F77 = /usr/local/gfortran/bin/gfortran
FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin14/5.2.0
-L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
</pre></div>
<p>(line split for legibility here).
</p>
<p>There is also provision for a site-wide <samp>Makevars.site</samp> file under
<samp><var>R_HOME</var>/etc</samp> (in a sub-architecture-specific directory if
appropriate). This is read immediately after <samp>Makeconf</samp>, and an
alternative file can be specified by environment variable
<code>R_MAKEVARS_SITE</code>.
</p>
<p>Note that these mechanisms do not work with packages which fail to pass
settings down to sub-makes, perhaps reading <samp>etc/Makeconf</samp> in
makefiles in subdirectories. Fortunately such packages are unusual.
</p>
<hr>
<a name="Multiple-sub_002darchitectures"></a>
<div class="header">
<p>
Next: <a href="#Byte_002dcompilation" accesskey="n" rel="next">Byte-compilation</a>, Previous: <a href="#Customizing-package-compilation" accesskey="p" rel="prev">Customizing package compilation</a>, Up: <a href="#Installing-packages" accesskey="u" rel="up">Installing packages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Multiple-sub_002darchitectures-1"></a>
<h4 class="subsection">6.3.4 Multiple sub-architectures</h4>
<p>When installing packages from their sources, there are some extra
considerations on installations which use sub-architectures. These are
commonly used on Windows but can in principle be used on other
platforms.
</p>
<p>When a source package is installed by a build of R which supports
multiple sub-architectures, the normal installation process installs the
packages for all sub-architectures. The exceptions are
</p>
<dl compact="compact">
<dt><em>Unix-alikes</em></dt>
<dd>
<p>where there is an <samp>configure</samp> script, or a file <samp>src/Makefile</samp>.
</p>
</dd>
<dt><em>Windows</em></dt>
<dd>
<p>where there is a non-empty <samp>configure.win</samp> script, or a file
<samp>src/Makefile.win</samp> (with some exceptions where the package is known
to have an architecture-independent <samp>configure.win</samp>, or if
<samp>--force-biarch</samp> or field &lsquo;<samp>Biarch</samp>&rsquo; in the <samp>DESCRIPTION</samp>
file is used to assert so).
</p>
</dd>
</dl>
<p>In those cases only the current architecture is installed. Further
sub-architectures can be installed by
</p>
<div class="example">
<pre class="example">R CMD INSTALL --libs-only <var>pkg</var>
</pre></div>
<p>using the path to <code>R</code> or <code>R --arch</code> to select the
additional sub-architecture. There is also <code>R CMD INSTALL
--merge-multiarch</code> to build and merge the two architectures, starting
with a source tarball.
</p>
<hr>
<a name="Byte_002dcompilation"></a>
<div class="header">
<p>
Previous: <a href="#Multiple-sub_002darchitectures" accesskey="p" rel="prev">Multiple sub-architectures</a>, Up: <a href="#Installing-packages" accesskey="u" rel="up">Installing packages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Byte_002dcompilation-1"></a>
<h4 class="subsection">6.3.5 Byte-compilation</h4>
<p>The base and recommended packages are byte-compiled by default. Other
packages can be byte-compiled on installation by using <code>R CMD
INSTALL</code> with option <samp>--byte-compile</samp> or by
<code>install.packages(type = &quot;source&quot;, INSTALL_opts =
&quot;--byte-compile&quot;)</code>.
</p>
<p>Not all contributed packages work correctly when byte-compiled (for
example because they interfere with the sealing of namespaces). For
most packages (especially those which make extensive use of compiled
code) the speed-up is small. Unless a package is used frequently the
time spent in byte-compilation can outweigh the time saved in execution:
also byte-compilation can add substantially to the installed size of the
package.
</p>
<p>Byte-compilation can be controlled on a per-package basis by the
&lsquo;<samp>ByteCompile</samp>&rsquo; field in the <samp>DESCRIPTION</samp> file.
</p>
<hr>
<a name="Updating-packages"></a>
<div class="header">
<p>
Next: <a href="#Removing-packages" accesskey="n" rel="next">Removing packages</a>, Previous: <a href="#Installing-packages" accesskey="p" rel="prev">Installing packages</a>, Up: <a href="#Add_002don-packages" accesskey="u" rel="up">Add-on packages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Updating-packages-1"></a>
<h3 class="section">6.4 Updating packages</h3>
<a name="index-update_002epackages"></a>
<a name="index-Packages_002c-updating"></a>
<p>The command <code>update.packages()</code> is the simplest way to ensure that
all the packages on your system are up to date. It downloads the list
of available packages and their current versions, compares it with those
installed and offers to fetch and install any that have later versions
on the repositories.
</p>
<p>An alternative interface to keeping packages up-to-date is provided by
the command <code>packageStatus()</code>, which returns an object with
information on all installed packages and packages available at multiple
repositories. The <code>print</code> and <code>summary</code> methods give an
overview of installed and available packages, the <code>upgrade</code> method
offers to fetch and install the latest versions of outdated packages.
</p>
<p>One sometimes-useful additional piece of information that
<code>packageStatus()</code> returns is the status of a package, as
<code>&quot;ok&quot;</code>, <code>&quot;upgrade&quot;</code> or <code>&quot;unavailable&quot;</code> (in the currently
selected repositories). For example
</p>
<div class="example">
<pre class="example">&gt; inst &lt;- packageStatus()$inst
&gt; inst[inst$Status != &quot;ok&quot;, c(&quot;Package&quot;, &quot;Version&quot;, &quot;Status&quot;)]
Package Version Status
Biobase Biobase 2.8.0 unavailable
RCurl RCurl 1.4-2 upgrade
Rgraphviz Rgraphviz 1.26.0 unavailable
rgdal rgdal 0.6-27 upgrade
</pre></div>
<hr>
<a name="Removing-packages"></a>
<div class="header">
<p>
Next: <a href="#Setting-up-a-package-repository" accesskey="n" rel="next">Setting up a package repository</a>, Previous: <a href="#Updating-packages" accesskey="p" rel="prev">Updating packages</a>, Up: <a href="#Add_002don-packages" accesskey="u" rel="up">Add-on packages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Removing-packages-1"></a>
<h3 class="section">6.5 Removing packages</h3>
<a name="index-remove_002epackages"></a>
<a name="index-Packages_002c-removing"></a>
<p>Packages can be removed in a number of ways. From a command prompt they
can be removed by
</p>
<div class="example">
<pre class="example">R CMD REMOVE -l /path/to/library <var>pkg1</var> <var>pkg2</var> &hellip;
</pre></div>
<p>From a running R process they can be removed by
</p>
<div class="example">
<pre class="example">&gt; remove.packages(c(&quot;pkg1&quot;, &quot;pkg2&quot;),
lib = file.path(&quot;path&quot;, &quot;to&quot;, &quot;library&quot;))
</pre></div>
<p>Finally, in most installations one can just remove the package directory
from the library.
</p>
<hr>
<a name="Setting-up-a-package-repository"></a>
<div class="header">
<p>
Next: <a href="#Checking-installed-source-packages" accesskey="n" rel="next">Checking installed source packages</a>, Previous: <a href="#Removing-packages" accesskey="p" rel="prev">Removing packages</a>, Up: <a href="#Add_002don-packages" accesskey="u" rel="up">Add-on packages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Setting-up-a-package-repository-1"></a>
<h3 class="section">6.6 Setting up a package repository</h3>
<a name="index-Repositories"></a>
<p>Utilities such as <code>install.packages</code> can be pointed at any
<acronym>CRAN</acronym>-style repository, and R users may want to set up their
own. The &lsquo;base&rsquo; of a repository is a URL such as
<a href="http://www.omegahat.org/R/">http://www.omegahat.org/R/</a>: this must be an URL scheme that
<code>download.packages</code> supports (which also includes &lsquo;<samp>ftp://</samp>&rsquo; and
&lsquo;<samp>file://</samp>&rsquo; and on most systems &lsquo;<samp>https://</samp>&rsquo;). Under that base
URL there should be directory trees for one or more of the following
types of package distributions:
</p>
<ul>
<li> <code>&quot;source&quot;</code>: located at <samp>src/contrib</samp> and containing
<samp>.tar.gz</samp> files. Other forms of compression can be used, e.g.
<samp>.tar.bz2</samp> or <samp>.tar.xz</samp> files. Complete repositories contain
the sources corresponding to any binary packages, and in any case it is
wise to have a <samp>src/contrib</samp> area with a possibly empty
<samp>PACKAGES</samp> file.
</li><li> <code>&quot;win.binary&quot;</code>: located at <samp>bin/windows/contrib/<var>x.y</var></samp> for
R versions <var>x.y.z</var> and containing <samp>.zip</samp> files for Windows.
</li><li> <code>&quot;mac.binary.mavericks&quot;</code>: located at
<samp>bin/macosx/mavericks/contrib/<var>3.y</var></samp> for the CRAN build for
&lsquo;Mavericks&rsquo; (and later) for R versions <var>3.y.z</var>, containing
<samp>.tgz</samp> files.
</li><li> <code>&quot;mac.binary&quot;</code>: located at
<samp>bin/macosx/contrib/<var>3.y</var></samp> for a CRAN build for
&lsquo;Snow Leopard&rsquo; (and later) for R versions <var>3.y.z</var>, containing
<samp>.tgz</samp> files.
</li></ul>
<p>Each terminal directory must also contain a <samp>PACKAGES</samp> file. This
can be a concatenation of the <samp>DESCRIPTION</samp> files of the packages
separated by blank lines, but only a few of the fields are needed. The
simplest way to set up such a file is to use function
<code>write_PACKAGES</code> in the <strong>tools</strong> package, and its help explains
which fields are needed. Optionally there can also be a
<samp>PACKAGES.gz</samp> file, a <code>gzip</code>-compressed version of
<samp>PACKAGES</samp>&mdash;as this will be downloaded in preference to
<samp>PACKAGES</samp> it should be included for large repositories. (If you
have a mis-configured server that does not report correctly non-existent
files you may need <samp>PACKAGES.gz</samp>.)
</p>
<p>To add your repository to the list offered by <code>setRepositories()</code>,
see the help file for that function.
</p>
<p>Incomplete repositories are better specified <em>via</em> a
<code>contriburl</code> argument than <em>via</em> being set as a repository.
</p>
<p>A repository can contain subdirectories, when the descriptions in the
<samp>PACKAGES</samp> file of packages in subdirectories must include a line
of the form
</p>
<div class="example">
<pre class="example">Path: <var>path/to/subdirectory</var>
</pre></div>
<p>&mdash;once again <code>write_PACKAGES</code> is the simplest way to set this up.
</p>
<hr>
<a name="Checking-installed-source-packages"></a>
<div class="header">
<p>
Previous: <a href="#Setting-up-a-package-repository" accesskey="p" rel="prev">Setting up a package repository</a>, Up: <a href="#Add_002don-packages" accesskey="u" rel="up">Add-on packages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Checking-installed-source-packages-1"></a>
<h3 class="section">6.7 Checking installed source packages</h3>
<p>It can be convenient to run <code>R CMD check</code> on an installed
package, particularly on a platform which uses sub-architectures. The
outline of how to do this is, with the source package in directory
<samp><var>pkg</var></samp> (or a tarball filename):
</p>
<div class="example">
<pre class="example">R CMD INSTALL -l <var>libdir</var> <var>pkg</var> &gt; <var>pkg</var>.log 2&gt;&amp;1
R CMD check -l <var>libdir</var> --install=check:<var>pkg</var>.log <var>pkg</var>
</pre></div>
<p>Where sub-architectures are in use the <code>R CMD check</code> line can be
repeated with additional architectures by
</p>
<div class="example">
<pre class="example">R --arch <var>arch</var> CMD check -l <var>libdir</var> --extra-arch --install=check:<var>pkg</var>.log <var>pkg</var>
</pre></div>
<p>where <samp>--extra-arch</samp> selects only those checks which depend on
the installed code and not those which analyse the sources. (If
multiple sub-architectures fail only because they need different
settings, e.g. environment variables, <samp>--no-multiarch</samp> may need
to be added to the <code>INSTALL</code> lines.) On Unix-alikes the
architecture to run is selected by <samp>--arch</samp>: this can also be
used on Windows with <samp><var>R_HOME</var>/bin/R.exe</samp>, but it is more usual
to select the path to the <code>Rcmd.exe</code> of the desired
architecture.
</p>
<p>So on Windows to install, check and package for distribution a source
package from a tarball which has been tested on another platform one
might use
</p>
<div class="example">
<pre class="example">.../bin/i386/Rcmd INSTALL -l <var>libdir</var> <var>tarball</var> --build &gt; <var>pkg</var>.log 2&gt;&amp;1
.../bin/i386/Rcmd check -l <var>libdir</var> --extra-arch --install=check:<var>pkg</var>.log <var>pkg</var>
.../bin/x64/Rcmd check -l <var>libdir</var> --extra-arch --install=check:<var>pkg</var>.log <var>pkg</var>
</pre></div>
<p>where one might want to run the second and third lines in a different
shell with different settings for environment variables and the path (to
find external software, notably for Gtk+).
</p>
<p><code>R CMD INSTALL</code> can do a <code>i386</code> install and then add the
<code>x64</code> DLL from a single command by
</p>
<div class="example">
<pre class="example">R CMD INSTALL --merge-multiarch -l <var>libdir</var> <var>tarball</var>
</pre></div>
<p>and <samp>--build</samp> can be added to zip up the installation.
</p>
<hr>
<a name="Internationalization"></a>
<div class="header">
<p>
Next: <a href="#Choosing-between-32_002d-and-64_002dbit-builds" accesskey="n" rel="next">Choosing between 32- and 64-bit builds</a>, Previous: <a href="#Add_002don-packages" accesskey="p" rel="prev">Add-on packages</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Internationalization-and-Localization"></a>
<h2 class="chapter">7 Internationalization and Localization</h2>
<a name="index-Internationalization"></a>
<a name="index-Localization"></a>
<p><em>Internationalization</em> refers to the process of enabling support
for many human languages, and <em>localization</em> to adapting to a
specific country and language.
</p>
<p>Current builds of R support all the character sets that the
underlying OS can handle. These are interpreted according to the
<a name="index-Locale"></a>
current <code>locale</code>, a sufficiently complicated topic to merit a
separate section. Note though that R has no built-in support for
right-to-left languages and bidirectional output, relying on the OS
services. For example, how character vectors in UTF-8 containing both
English digits and Hebrew characters are printed is OS-dependent (and
perhaps locale-dependent).
</p>
<p>The other aspect of the internationalization is support for the
translation of messages. This is enabled in almost all builds of R.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Locales" accesskey="1">Locales</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Localization-of-messages" accesskey="2">Localization of messages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Locales"></a>
<div class="header">
<p>
Next: <a href="#Localization-of-messages" accesskey="n" rel="next">Localization of messages</a>, Previous: <a href="#Internationalization" accesskey="p" rel="prev">Internationalization</a>, Up: <a href="#Internationalization" accesskey="u" rel="up">Internationalization</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Locales-1"></a>
<h3 class="section">7.1 Locales</h3>
<a name="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.
<a href="https://en.wikipedia.org/wiki/ISO_639-1">https://en.wikipedia.org/wiki/ISO_639-1</a>).
</li><li> A &lsquo;territory&rsquo;, used mainly to specify the currency. These are generally
specified by an upper-case two-character abbreviation following ISO 3166
(see e.g. <a href="https://en.wikipedia.org/wiki/ISO_3166">https://en.wikipedia.org/wiki/ISO_3166</a>).
</li><li> A charset encoding, which determines both how a byte stream should be
divided into characters, and which characters the subsequences of bytes
represent. Sometimes the combination of language and territory is used
to specify the encoding, for example to distinguish between traditional
and simplified Chinese.
</li><li> Optionally, a modifier, for example to indicate that Austria is to be
considered pre- or post-Euro. The modifier is also used to indicate the
script (<code>@latin</code>, <code>@cyrillic</code> for Serbian, <code>@iqtelif</code>)
or language dialect (e.g. <code>@saaho</code>, a dialect of Afar, and
<code>@bokmal</code> and <code>@nynorsk</code>, dialects of Norwegian regarded by
some OSes as separate languages, <code>no</code> and <code>nn</code>).
</li></ul>
<p>R is principally concerned with the first (for translations) and
third. Note that the charset may be deducible from the language, as
some OSes offer only one charset per language.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Locales-under-Unix_002dalikes" accesskey="1">Locales under Unix-alikes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Locales-under-Windows" accesskey="2">Locales under Windows</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Locales-under-OS-X" accesskey="3">Locales under OS X</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Locales-under-Unix_002dalikes"></a>
<div class="header">
<p>
Next: <a href="#Locales-under-Windows" accesskey="n" rel="next">Locales under Windows</a>, Previous: <a href="#Locales" accesskey="p" rel="prev">Locales</a>, Up: <a href="#Locales" accesskey="u" rel="up">Locales</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Locales-under-Unix_002dalikes-1"></a>
<h4 class="subsection">7.1.1 Locales under Unix-alikes</h4>
<p>Modern Linux uses the XPG<a name="DOCF21" href="#FOOT21"><sup>21</sup></a> locale specifications which have the form
&lsquo;<samp>en_GB</samp>&rsquo;, &lsquo;<samp>en_GB.UTF-8</samp>&rsquo;, &lsquo;<samp>aa_ER.UTF-8@saaho</samp>&rsquo;,
&lsquo;<samp>de_AT.iso885915@euro</samp>&rsquo;, 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 &lsquo;<samp>.utf8</samp>&rsquo; rather than &lsquo;<samp>.UTF-8</samp>&rsquo;.
</p>
<p>Note that whereas UTF-8 locales are nowadays almost universally used,
locales such as &lsquo;<samp>en_GB</samp>&rsquo; use 8-bit encodings for backwards
compatibility.
</p>
<hr>
<a name="Locales-under-Windows"></a>
<div class="header">
<p>
Next: <a href="#Locales-under-OS-X" accesskey="n" rel="next">Locales under OS X</a>, Previous: <a href="#Locales-under-Unix_002dalikes" accesskey="p" rel="prev">Locales under Unix-alikes</a>, Up: <a href="#Locales" accesskey="u" rel="up">Locales</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Locales-under-Windows-1"></a>
<h4 class="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
information and lists can be found at
<a href="https://msdn.microsoft.com/en-us/library/hzz3tw78(v=vs.80)">https://msdn.microsoft.com/en-us/library/hzz3tw78(v=vs.80)</a>
(or if Microsoft moves it yet again, search for &lsquo;<samp>Windows language
country strings</samp>&rsquo;).
</p>
<p>It offers only one encoding per language.
</p>
<p>Some care is needed with Windows&rsquo; 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>
<a name="Locales-under-OS-X"></a>
<div class="header">
<p>
Previous: <a href="#Locales-under-Windows" accesskey="p" rel="prev">Locales under Windows</a>, Up: <a href="#Locales" accesskey="u" rel="up">Locales</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Locales-under-OS-X-1"></a>
<h4 class="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
make this easier for users. See
<a href="https://developer.apple.com/documentation/MacOSX/Conceptual/BPInternational/">https://developer.apple.com/documentation/MacOSX/Conceptual/BPInternational/</a>
for how users can set their locales. As with Windows, end users will
generally only see lists of languages/territories. Users of R in a
terminal may need to set the locale to something like &lsquo;<samp>en_GB.UTF-8</samp>&rsquo;
if it defaults to &lsquo;<samp>C</samp>&rsquo; (as it sometimes does when logging in
remotely and for batch jobs: note whether <code>Terminal</code> sets the
<code>LANG</code> environment variable is an (advanced) preference, but does so
by default).
</p>
<p>Internally OS X uses a form similar to Linux: the main difference from
other Unix-alikes is that where a character set is not specified it is
assumed to be <code>UTF-8</code>.
</p>
<hr>
<a name="Localization-of-messages"></a>
<div class="header">
<p>
Previous: <a href="#Locales" accesskey="p" rel="prev">Locales</a>, Up: <a href="#Internationalization" accesskey="u" rel="up">Internationalization</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Localization-of-messages-1"></a>
<h3 class="section">7.2 Localization of messages</h3>
<p>The preferred language for messages is by default taken from the locale.
This can be overridden first by the setting of the environment variable
<a name="index-LANGUAGE"></a>
<a name="index-LC_005fALL"></a>
<a name="index-LC_005fMESSAGES"></a>
<a name="index-LANG"></a>
<code>LANGUAGE</code> and then<a name="DOCF22" href="#FOOT22"><sup>22</sup></a>
by the environment variables <code>LC_ALL</code>, <code>LC_MESSAGES</code> and
<code>LANG</code>. (The last three are normally used to set the locale and so
should not be needed, but the first is only used to select the language
for messages.) The code tries hard to map locales to languages, but on
some systems (notably Windows) the locale names needed for the
environment variable <code>LC_ALL</code> do not all correspond to XPG language
names and so <code>LANGUAGE</code> may need to be set. (One example is
&lsquo;<samp>LC_ALL=es</samp>&rsquo; on Windows which sets the locale to Estonian and the
language to Spanish.)
</p>
<p>It is usually possible to change the language once R is running
<em>via</em> (not Windows) <code>Sys.setlocale(&quot;LC_MESSAGES&quot;,
&quot;new_locale&quot;)</code>, or by setting an environment variable such as
<code>LANGUAGE</code>, <em>provided</em><a name="DOCF23" href="#FOOT23"><sup>23</sup></a> the language you are changing to can be output in
the current character set. But this is OS-specific, and has been known
to stop working on an OS upgrade.
</p>
<p>Messages are divided into <em>domains</em>, and translations may be
available for some or all messages in a domain. R makes use of the
following domains.
</p>
<ul>
<li> Domain <code>R</code> for the C-level error and warning messages from the R
interpreter.
</li><li> Domain <code>R-<var>pkg</var></code> for the R <code>stop</code>, <code>warning</code> and
<code>message</code> messages in each package, including <code>R-base</code> for the
<strong>base</strong> package.
</li><li> Domain <code><var>pkg</var></code> for the C-level messages in each package.
</li><li> Domain <code>RGui</code> for the menus etc of the R for Windows GUI front-end.
</li></ul>
<p>Dividing up the messages in this way allows R to be extensible: as
packages are loaded, their message translation catalogues can be loaded
too.
</p>
<p>R can be built without support for translations, but it is enabled by
default.
</p>
<p>R-level and C-level domains are subtly different, for example in the way
strings are canonicalized before being passed for translation.
</p>
<p>Translations are looked for by domain according to the currently
specified language, as specifically as possible, so for example an
Austrian (&lsquo;<samp>de_AT</samp>&rsquo;) translation catalogue will be used in preference
to a generic German one (&lsquo;<samp>de</samp>&rsquo;) for an Austrian user. However, if a
specific translation catalogue exists but does not contain a
translation, the less specific catalogues are consulted. For example,
R has catalogues for &lsquo;<samp>en_GB</samp>&rsquo; that translate the Americanisms
(e.g., &lsquo;<samp>gray</samp>&rsquo;) in the standard messages into English.<a name="DOCF24" href="#FOOT24"><sup>24</sup></a> Two other examples: there are catalogues
for &lsquo;<samp>es</samp>&rsquo;, which is Spanish as written in Spain and these will by
default also be used in Spanish-speaking Latin American countries, and
also for &lsquo;<samp>pt_BR</samp>&rsquo;, which are used for Brazilian locales but not for
locales specifying Portugal.
</p>
<p>Translations in the right language but the wrong charset are made use of
<a name="index-LANGUAGE-1"></a>
by on-the-fly re-encoding. The <code>LANGUAGE</code> variable (only) can be a
colon-separated list, for example &lsquo;<samp>se:de</samp>&rsquo;, giving a set of
languages in decreasing order of preference. One special value is
&lsquo;<samp>en@quot</samp>&rsquo;, which can be used in a UTF-8 locale to have American
error messages with pairs of single quotes translated to Unicode directional
quotes.
</p>
<p>If no suitable translation catalogue is found or a particular message is
not translated in any suitable catalogue, &lsquo;English&rsquo;<a name="DOCF25" href="#FOOT25"><sup>25</sup></a> is used.
</p>
<p>See <a href="https://developer.r-project.org/Translations30.html">https://developer.r-project.org/Translations30.html</a> for how to
prepare and install translation catalogues.
</p>
<hr>
<a name="Choosing-between-32_002d-and-64_002dbit-builds"></a>
<div class="header">
<p>
Next: <a href="#The-standalone-Rmath-library" accesskey="n" rel="next">The standalone Rmath library</a>, Previous: <a href="#Internationalization" accesskey="p" rel="prev">Internationalization</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Choosing-between-32_002d-and-64_002dbit-builds-1"></a>
<h2 class="chapter">8 Choosing between 32- and 64-bit builds</h2>
<p>Almost all current <acronym>CPU</acronym>s have both 32- and 64-bit sets of
instructions. Most OSes running on such <acronym>CPU</acronym>s offer the choice
of building a 32-bit or a 64-bit version of R (and details are given
below under specific OSes). For most a 32-bit version is the default,
but for some (e.g., &lsquo;<samp>x86_64</samp>&rsquo; Linux and OS X &gt;= 10.6)
64-bit is.
</p>
<p>All current versions of R use 32-bit integers and
<acronym>ISO</acronym>/<acronym>IEC</acronym>&nbsp;60559<a name="DOCF26" href="#FOOT26"><sup>26</sup></a> double-precision reals, and so compute to
the same precision<a name="DOCF27" href="#FOOT27"><sup>27</sup></a> and with the same limits on the sizes of
numerical quantities. The principal difference is in the size of the
pointers.
</p>
<p>64-bit builds have both advantages and disadvantages:
</p><ul>
<li> The total virtual memory space made available to a 32-bit process is
limited by the pointer size to 4GB, and on most OSes to 3GB (or even
2GB). The limits for 64-bit processes are much larger (e.g.
8&ndash;128TB).
<p>R allocates memory for large objects as needed, and removes any
unused ones at garbage collection. When the sizes of objects become an
appreciable fraction of the address limit, fragmentation of the address
space becomes an issue and there may be no hole available that is the
size requested. This can cause more frequent garbage collection or the
inability to allocate large objects. As a guide, this will become an
issue for 32-bit builds with objects more than 10% of the size of the
address space (around 300Mb) or when the total size of objects in use is
around one third (around 1Gb).
</p>
</li><li> Only 64-bit builds support &lsquo;long vectors&rsquo;, those with <em>2^{31}</em> or
more elements (each of which needs 16GB of storage for a numeric
vector).
</li><li> Most 32-bit OSes by default limit file sizes to 2GB (and this may also
apply to 32-bit builds on 64-bit OSes). This can often be worked
around: and <code>configure</code> selects suitable defines if this is
possible. (We have also largely worked around that limit on 32-bit
Windows.) 64-bit builds have much larger limits.
</li><li> Because the pointers are larger, R&rsquo;s basic structures are larger.
This means that R objects take more space and (usually) more time to
manipulate. So 64-bit builds of R will, all other things being
equal, run slower than 32-bit builds. (On Sparc Solaris the difference
was 15-20%.)
</li><li> However, &lsquo;other things&rsquo; may not be equal. In the specific case of
&lsquo;<samp>x86_64</samp>&rsquo; <em>vs</em> &lsquo;<samp>ix86</samp>&rsquo;, the 64-bit CPU has features
(such as SSE2 instructions) which are guaranteed to be present but are
optional on the 32-bit CPU, and also has more general-purpose registers.
This means that on chips like a desktop Intel Core 2 Duo the vanilla
64-bit version of R has been around 10% faster on both Linux and OS
X. (Laptop CPUs are usually relatively slower in 64-bit mode.)
</li></ul>
<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 <a href="#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(&quot;Memory-limits&quot;)</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>
<a name="The-standalone-Rmath-library"></a>
<div class="header">
<p>
Next: <a href="#Essential-and-useful-other-programs-under-a-Unix_002dalike" accesskey="n" rel="next">Essential and useful other programs under a Unix-alike</a>, Previous: <a href="#Choosing-between-32_002d-and-64_002dbit-builds" accesskey="p" rel="prev">Choosing between 32- and 64-bit builds</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="The-standalone-Rmath-library-1"></a>
<h2 class="chapter">9 The standalone Rmath library</h2>
<p>The routines supporting the distribution and
special<a name="DOCF28" href="#FOOT28"><sup>28</sup></a> functions in R
and a few others are declared in C header file <samp>Rmath.h</samp>. These
can be compiled into a standalone library for linking to other
applications. (Note that they are not a separate library when R is
built, and the standalone version differs in several ways.)
</p>
<p>The makefiles and other sources needed are in directory
<samp>src/nmath/standalone</samp>, so the following instructions assume that
is the current working directory (in the build directory tree on a
Unix-alike if that is separate from the sources).
</p>
<p><samp>Rmath.h</samp> contains &lsquo;<samp>R_VERSION_STRING</samp>&rsquo;, which is a character
string containing the current R version, for example <code>&quot;3.2.0&quot;</code>.
</p>
<p>There is full access to R&rsquo;s handling of <code>NaN</code>, <code>Inf</code> and
<code>-Inf</code> via special versions of the macros and functions
</p>
<div class="example">
<pre class="example"> ISNAN, R_FINITE, R_log, R_pow and R_pow_di
</pre></div>
<p>and (extern) constants <code>R_PosInf</code>, <code>R_NegInf</code> and <code>NA_REAL</code>.
</p>
<p>There is no support for R&rsquo;s notion of missing values, in particular
not for <code>NA_INTEGER</code> nor the distinction between <code>NA</code> and
<code>NaN</code> for doubles.
</p>
<p>A little care is needed to use the random-number routines. You will
need to supply the uniform random number generator
</p>
<div class="example">
<pre class="example"> double unif_rand(void)
</pre></div>
<p>or use the one supplied (and with a shared library or DLL you may
have to use the one supplied, which is the Marsaglia-multicarry with
an entry point
</p>
<div class="example">
<pre class="example"> set_seed(unsigned int, unsigned int)
</pre></div>
<p>to set its seeds).
</p>
<p>The facilities to change the normal random number generator are
available through the constant N01_kind. This takes values
from the enumeration type
</p>
<div class="example">
<pre class="example">typedef enum {
BUGGY_KINDERMAN_RAMAGE,
AHRENS_DIETER,
BOX_MULLER,
USER_NORM,
INVERSION,
KINDERMAN_RAMAGE
} N01type;
</pre></div>
<p>(and &lsquo;<samp>USER_NORM</samp>&rsquo; is not available).
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Unix_002dalike-standalone" accesskey="1">Unix-alike standalone</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Windows-standalone" accesskey="2">Windows standalone</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Unix_002dalike-standalone"></a>
<div class="header">
<p>
Next: <a href="#Windows-standalone" accesskey="n" rel="next">Windows standalone</a>, Previous: <a href="#The-standalone-Rmath-library" accesskey="p" rel="prev">The standalone Rmath library</a>, Up: <a href="#The-standalone-Rmath-library" accesskey="u" rel="up">The standalone Rmath library</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Unix_002dalikes"></a>
<h3 class="section">9.1 Unix-alikes</h3>
<p>If R has not already been made in the directory tree,
<code>configure</code> must be run as described in the main build
instructions.
</p>
<p>Then (in <samp>src/nmath/standalone</samp>)
</p>
<div class="example">
<pre class="example">make
</pre></div>
<p>will make standalone libraries <samp>libRmath.a</samp> and <samp>libRmath.so</samp>
(<samp>libRmath.dylib</samp> on OS X): &lsquo;<samp>make static</samp>&rsquo; and &lsquo;<samp>make
shared</samp>&rsquo; will create just one of them.
</p>
<p>To use the routines in your own C or C++ programs, include
</p>
<div class="example">
<pre class="example">#define MATHLIB_STANDALONE
#include &lt;Rmath.h&gt;
</pre></div>
<p>and link against &lsquo;<samp>-lRmath</samp>&rsquo; (and &lsquo;<samp>-lm</samp>&rsquo; if needed on your OS).
The example file <samp>test.c</samp> does nothing useful, but is provided to
test the process (via <code>make test</code>). Note that you will probably
not be able to run it unless you add the directory containing
<a name="index-LD_005fLIBRARY_005fPATH"></a>
<samp>libRmath.so</samp> to the <code>LD_LIBRARY_PATH</code> environment variable
(<samp>libRmath.dylib</samp>, <code>DYLD_LIBRARY_PATH</code> on OS X).
</p>
<p>The targets
</p>
<div class="example">
<pre class="example">make install
make uninstall
</pre></div>
<p>will (un)install the header <samp>Rmath.h</samp> and shared and static
<a name="index-DESTDIR-1"></a>
libraries (if built). Both <code>prefix=</code> and <code>DESTDIR</code> are
supported, together with more precise control as described for the main
build.
</p>
<p>&lsquo;<samp>make install</samp>&rsquo; installs a file for <code>pkg-config</code> to use by
e.g.
</p>
<div class="example">
<pre class="example">$(CC) `pkg-config --cflags libRmath` -c test.c
$(CC) `pkg-config --libs libRmath` test.o -o test
</pre></div>
<p>On some systems &lsquo;<samp>make install-strip</samp>&rsquo; will install a stripped shared
library.
</p>
<hr>
<a name="Windows-standalone"></a>
<div class="header">
<p>
Previous: <a href="#Unix_002dalike-standalone" accesskey="p" rel="prev">Unix-alike standalone</a>, Up: <a href="#The-standalone-Rmath-library" accesskey="u" rel="up">The standalone Rmath library</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Windows-1"></a>
<h3 class="section">9.2 Windows</h3>
<p>You need to set up<a name="DOCF29" href="#FOOT29"><sup>29</sup></a> almost all the
tools to make R and then run (in a Unix-like shell)
</p>
<div class="example">
<pre class="example">(cd ../../gnuwin32; make MkRules)
(cd ../../include; make -f Makefile.win config.h Rconfig.h Rmath.h)
make -f Makefile.win
</pre></div>
<p>Alternatively, in a <samp>cmd.exe</samp> shell use
</p>
<div class="example">
<pre class="example">cd ../../include
make -f Makefile.win config.h Rconfig.h Rmath.h
cd ../nmath/standalone
make -f Makefile.win
</pre></div>
<p>This creates a static library <samp>libRmath.a</samp> and a DLL
<samp>Rmath.dll</samp>. If you want an import library <samp>libRmath.dll.a</samp>
(you don&rsquo;t need one), use
</p>
<div class="example">
<pre class="example">make -f Makefile.win shared implib
</pre></div>
<p>To use the routines in your own C or C++ programs using MinGW, include
</p>
<div class="example">
<pre class="example">#define MATHLIB_STANDALONE
#include &lt;Rmath.h&gt;
</pre></div>
<p>and link against &lsquo;<samp>-lRmath</samp>&rsquo;. This will use the first found of
<samp>libRmath.dll.a</samp>, <samp>libRmath.a</samp> and <samp>Rmath.dll</samp> in that
order, so the result depends on which files are present. You should be
able to force static or dynamic linking <em>via</em>
</p>
<div class="example">
<pre class="example">-Wl,-Bstatic -lRmath -Wl,dynamic
-Wl,-Bdynamic -lRmath
</pre></div>
<p>or by linking to explicit files (as in the &lsquo;<samp>test</samp>&rsquo; target in
<samp>Makefile.win</samp>: this makes two executables, <samp>test.exe</samp> which
is dynamically linked, and <samp>test-static.exe</samp>, which is statically
linked).
</p>
<p>It is possible to link to <samp>Rmath.dll</samp> using other compilers, either
directly or via an import library: if you make a MinGW import library as
above, you will create a file <samp>Rmath.def</samp> which can be used
(possibly after editing) to create an import library for other systems
such as Visual C++.
</p>
<p>If you make use of dynamic linking you should use
</p>
<div class="example">
<pre class="example">#define MATHLIB_STANDALONE
#define RMATH_DLL
#include &lt;Rmath.h&gt;
</pre></div>
<p>to ensure that the constants like <code>NA_REAL</code> are linked correctly.
(Auto-import will probably work with MinGW, but it is better to be
sure. This is likely to also work with VC++, Borland and similar
compilers.)
</p>
<hr>
<a name="Essential-and-useful-other-programs-under-a-Unix_002dalike"></a>
<div class="header">
<p>
Next: <a href="#Configuration-on-a-Unix_002dalike" accesskey="n" rel="next">Configuration on a Unix-alike</a>, Previous: <a href="#The-standalone-Rmath-library" accesskey="p" rel="prev">The standalone Rmath library</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Essential-and-useful-other-programs-under-a-Unix_002dalike-1"></a>
<h2 class="appendix">Appendix A Essential and useful other programs under a Unix-alike</h2>
<p>This appendix gives details of programs you will need to build R on
Unix-like platforms, or which will be used by R if found by
<code>configure</code>.
</p>
<p>Remember that some package management systems (such as <acronym>RPM</acronym> and
Debian/Ubuntu&rsquo;s) make a distinction between the user version of a
package and the development version. The latter usually has the same
name but with the extension &lsquo;<samp>-devel</samp>&rsquo; or &lsquo;<samp>-dev</samp>&rsquo;: you need both
versions installed.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Essential-programs-and-libraries" accesskey="1">Essential programs and libraries</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Useful-libraries-and-programs" accesskey="2">Useful libraries and programs</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Linear-algebra" accesskey="3">Linear algebra</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Essential-programs-and-libraries"></a>
<div class="header">
<p>
Next: <a href="#Useful-libraries-and-programs" accesskey="n" rel="next">Useful libraries and programs</a>, Previous: <a href="#Essential-and-useful-other-programs-under-a-Unix_002dalike" accesskey="p" rel="prev">Essential and useful other programs under a Unix-alike</a>, Up: <a href="#Essential-and-useful-other-programs-under-a-Unix_002dalike" accesskey="u" rel="up">Essential and useful other programs under a Unix-alike</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Essential-programs-and-libraries-1"></a>
<h3 class="section">A.1 Essential programs and libraries</h3>
<p>You need a means of compiling C and FORTRAN 90 (see <a href="#Using-FORTRAN">Using FORTRAN</a>). Your C compiler should be
<acronym>ISO</acronym>/<acronym>IEC</acronym>&nbsp;60059<a name="DOCF30" href="#FOOT30"><sup>30</sup></a>, POSIX 1003.1 and C99-compliant.<a name="DOCF31" href="#FOOT31"><sup>31</sup></a> R tries to choose suitable flags for
the C compilers it knows about, but you may have to set <code>CC</code> or
<code>CFLAGS</code> suitably. For many versions of <code>gcc</code> with
<code>glibc</code> this means including
<samp>-std=gnu99</samp><a name="DOCF32" href="#FOOT32"><sup>32</sup></a>. If the compiler is detected as
<code>gcc</code>&nbsp;<code>4.x</code>, <samp>-std=gnu99</samp> will be appended to
<code>CC</code> unless it conflicts with a setting of <code>CFLAGS</code>. (Note
that options essential to run the compiler even for linking, such as
those to set the architecture, should be specified as part of <code>CC</code>
rather than in <code>CFLAGS</code>.)
</p>
<p>Unless you do not want to view graphs on-screen (or use OS X) you need
&lsquo;<samp>X11</samp>&rsquo; installed, including its headers and client libraries. For
recent Fedora distributions it means (at least) RPMs &lsquo;<samp>libX11</samp>&rsquo;,
&lsquo;<samp>libX11-devel</samp>&rsquo;, &lsquo;<samp>libXt</samp>&rsquo; and &lsquo;<samp>libXt-devel</samp>&rsquo;. On Debian we
recommend the meta-package &lsquo;<samp>xorg-dev</samp>&rsquo;. If you really do not want
these you will need to explicitly configure R without X11, using
<samp>--with-x=no</samp>.
</p>
<p>The command-line editing (and command completion) depends on the
<acronym>GNU</acronym> <code>readline</code> library: version 4.2 or later is needed
for all the features to be enabled. Otherwise you will need to
configure with <samp>--with-readline=no</samp> (or equivalent).
</p>
<p>A suitably comprehensive <code>iconv</code> function is essential. The R
usage requires <code>iconv</code> to be able to translate between
<code>&quot;latin1&quot;</code> and <code>&quot;UTF-8&quot;</code>, to recognize <code>&quot;&quot;</code> (as the
current encoding) and <code>&quot;ASCII&quot;</code>, and to translate to and from the
Unicode wide-character formats <code>&quot;UCS-[24][BL]E&quot;</code> &mdash; this is true
by default for <code>glibc</code><a name="DOCF33" href="#FOOT33"><sup>33</sup></a> but not of most commercial Unixes. However, you
can make use of <acronym>GNU</acronym> <code>libiconv</code> (as used on OS X: see
<a href="https://www.gnu.org/software/libiconv/">https://www.gnu.org/software/libiconv/</a>).
</p>
<p>The OS needs to have enough support<a name="DOCF34" href="#FOOT34"><sup>34</sup></a> for wide-character
types: this is checked at configuration. A small number of POSIX
functions<a name="DOCF35" href="#FOOT35"><sup>35</sup></a> are essential, and others<a name="DOCF36" href="#FOOT36"><sup>36</sup></a> will be used if available.
</p>
<p>A <code>tar</code> program is needed to unpack the sources and packages
(including the recommended packages). A version<a name="DOCF37" href="#FOOT37"><sup>37</sup></a> that can
automagically detect compressed archives is preferred for use with
<code>untar()</code>: the configure script looks for <code>gtar</code> and
<code>gnutar</code> before
<a name="index-TAR"></a>
<code>tar</code> &ndash; use environment variable <code>TAR</code> to override this.
</p>
<p>There need to be suitable versions of the tools <code>grep</code> and
<code>sed</code>: the problems are usually with old AT&amp;T and BSD variants.
<code>configure</code> will try to find suitable versions (including
looking in <samp>/usr/xpg4/bin</samp> which is used on some commercial
Unixes).
</p>
<p>You will not be able to build most of the manuals unless you have
<code>texi2any</code> version 5.1 or later installed, and if not most of
the <acronym>HTML</acronym> manuals will be linked to a version on <acronym>CRAN</acronym>. To
make PDF versions of the manuals you will also need file
<samp>texinfo.tex</samp> installed (which is part of the <acronym>GNU</acronym>
<strong>texinfo</strong> distribution but is often made part of the TeX package
in re-distributions) as well as
<code>texi2dvi</code>.<a name="DOCF38" href="#FOOT38"><sup>38</sup></a>
Further, the versions of <code>texi2dvi</code> and <samp>texinfo.tex</samp> need
to be compatible: we have seen problems with older TeX distributions.
</p>
<a name="index-Vignettes"></a>
<p>The PDF documentation (including <samp>doc/NEWS.pdf</samp>) and building
vignettes needs <code>pdftex</code> and <code>pdflatex</code>. We require
LaTeX version <code>2005/12/01</code> or later (for UTF-8 support).
Building PDF package manuals (including the R reference manual) and
vignettes is sensitive to the version of the LaTeX package
<strong>hyperref</strong> and we recommend that the TeX distribution used is
kept up-to-date. A number of standard LaTeX packages are required
(including <strong>url</strong> and some of the font packages such as <strong>times</strong>,
<strong>helvetic</strong>, <strong>ec</strong> and <strong>cm-super</strong>) and others such as
<strong>hyperref</strong> and <strong>inconsolata</strong> are desirable (and without them you
may need to change R&rsquo;s defaults: see <a href="#Making-the-manuals">Making the manuals</a>). Note
that package <strong>hyperref</strong> (currently) requires packages
<strong>kvoptions</strong>, <strong>ltxcmds</strong> and <strong>refcount</strong>. For distributions
based on TeXLive the simplest approach may be to install collections
<strong>collection-latex</strong>, <strong>collection-fontsrecommended</strong>,
<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>
<a name="index-Subversion-1"></a>
<p>If you want to build from the R Subversion repository then
<code>texi2any</code> is highly recommended as it is used to create files
in the tarball but not under Subversion.
</p>
<a name="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>
<a name="Useful-libraries-and-programs"></a>
<div class="header">
<p>
Next: <a href="#Linear-algebra" accesskey="n" rel="next">Linear algebra</a>, Previous: <a href="#Essential-programs-and-libraries" accesskey="p" rel="prev">Essential programs and libraries</a>, Up: <a href="#Essential-and-useful-other-programs-under-a-Unix_002dalike" accesskey="u" rel="up">Essential and useful other programs under a Unix-alike</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Useful-libraries-and-programs-1"></a>
<h3 class="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 &lsquo;modern&rsquo; 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
&lsquo;<samp>pangocairo</samp>&rsquo; package is installed (and if not, &lsquo;<samp>cairo</samp>&rsquo;) and if
additional flags are needed for the &lsquo;<samp>cairo-xlib</samp>&rsquo; package, then if
suitable code can be compiled. These tests will fail if
<code>pkg-config</code> is not installed<a name="DOCF39" href="#FOOT39"><sup>39</sup></a>, and are likely to fail if <code>cairo</code> was built
statically (unusual). Most systems with <code>Gtk+</code> 2.8 or later
installed will have suitable libraries
</p>
<p>For the best font experience with these devices you need suitable fonts
installed: Linux users will want the <code>urw-fonts</code> package. On
platforms which have it available, the <code>msttcorefonts</code>
package<a name="DOCF40" href="#FOOT40"><sup>40</sup></a> provides
TrueType versions of Monotype fonts such as Arial and Times New Roman.
Another useful set of fonts is the &lsquo;liberation&rsquo; TrueType fonts available
at
<a href="https://fedorahosted.org/liberation-fonts/">https://fedorahosted.org/liberation-fonts/</a>,<a name="DOCF41" href="#FOOT41"><sup>41</sup></a> which cover the Latin, Greek and Cyrillic alphabets
plus a fair range of signs. These share metrics with Arial, Times New
Roman and Courier New, and contain fonts rather similar to the first two
(<a href="https://en.wikipedia.org/wiki/Liberation_fonts">https://en.wikipedia.org/wiki/Liberation_fonts</a>). Then there
is the &lsquo;Free UCS Outline Fonts&rsquo; project
(<a href="https://www.gnu.org/software/freefont/">https://www.gnu.org/software/freefont/</a>) which are
OpenType/TrueType fonts based on the URW fonts but with extended Unicode
coverage. See the R help on <code>X11</code> on selecting such fonts.
</p>
<p>The bitmapped graphics devices <code>jpeg()</code>, <code>png()</code> and
<code>tiff()</code> need the appropriate headers and libraries installed:
<code>jpeg</code> (version 6b or later, or <code>libjpeg-turbo</code>) or
<code>libpng</code> (version 1.2.7 or later) and <code>zlib</code> or <code>libtiff</code>
(any recent version &ndash; 3.9.[4567] and 4.0.[23] have been tested)
respectively. They also need support for either <code>X11</code> or
<code>cairo</code> (see above). Should support for these devices <strong>not</strong>
be required or broken system libraries need to be avoided there are
<code>configure</code> options <samp>--without-libpng</samp>,
<samp>--without-jpeglib</samp> and <samp>--without-libtiff</samp>. For most
system installations the TIFF libraries will require JPEG libraries to
be present and perhaps linked explicitly, so <samp>--without-jpeglib</samp>
may also disable the <code>tiff()</code> device. The <code>tiff()</code> devices
only require a basic build of <code>libtiff</code> (not even JPEG support is
needed). Recent versions allow several other libraries to be linked
into <code>libtiff</code> such as <code>lzma</code>, <code>jbig</code> and <code>jpeg12</code>,
and these may need also to be present.
</p>
<p>If you have them installed (including the appropriate headers and of
suitable versions), system versions 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) and PCRE (version 8.10 or later, preferably
8.32 or later<a name="DOCF42" href="#FOOT42"><sup>42</sup></a>): will be used,
otherwise versions in the R sources will be compiled in. The
external versions can be avoided by configure options
<samp>--without-system-zlib</samp>, <samp>--without-system-bzlib</samp> and
<samp>--without-system-pcre</samp>.
</p>
<p>Option <samp>--with-system-tre</samp> is also available: it needs a recent
version of TRE. (The current sources are in the <code>git</code> repository
at <a href="https://github.com/laurikari/tre/">https://github.com/laurikari/tre/</a>, but at the time of writing
the resulting build will not pass its checks.).
</p>
<p>Library <code>liblzma</code> from <code>xz-utils</code> version 5.0.3 or later
(including 5.2.x) will be used if installed: the version in the R
sources can be selected instead by configuring with
<samp>--without-system-xz</samp>. Systems differ in what they call the
package including this: e.g. on Fedora the library is in
&lsquo;<samp>xz-libs</samp>&rsquo; and the headers in &lsquo;<samp>xz-devel</samp>&rsquo;.
</p>
<p>An implementation of <acronym>XDR</acronym> is required, and the R sources
contain one which is likely to suffice (although a system version may
have higher performance). <acronym>XDR</acronym> is part of <acronym>RPC</acronym> and
historically has been part of <samp>libc</samp> on a Unix-alike. However some
builds of <code>glibc</code> hide it with the intention that the
<acronym>TI-RPC</acronym> library be used instead, in which case <code>libtirpc</code>
(and its development version) needs to be installed, and its headers
need to be on the C include path or in <samp>/usr/include/tirpc</samp>.
</p>
<p>Use of the X11 clipboard selection requires the <code>Xmu</code> headers and
libraries. These are normally part of an X11 installation (e.g. the
Debian meta-package &lsquo;<samp>xorg-dev</samp>&rsquo;), but some distributions have split
this into smaller parts, so for example recent versions of Fedora
require the &lsquo;<samp>libXmu</samp>&rsquo; and &lsquo;<samp>libXmu-devel</samp>&rsquo; RPMs.
</p>
<p>Some systems (notably OS X and at least some FreeBSD systems) have
inadequate support for collation in multibyte locales. It is possible
to replace the OS&rsquo;s collation support by that from ICU (International
Components for Unicode, <a href="http://site.icu-project.org/">http://site.icu-project.org/</a>), and this
provides much more precise control over collation on all systems. ICU
is available as sources and as binary distributions for (at least) most
Linux distributions, Solaris, FreeBSD and AIX, usually as <code>libicu</code>
or <code>icu4c</code>. It will be used by default where available: should a
very old or broken version of ICU be found this can be suppressed by
<samp>--without-ICU</samp>.
</p>
<p>If <code>libcurl</code> version 7.28.0 or later is available (including its
development files), it will be linked in to support
<code>curlGetHeaders</code> and the <code>&quot;libcurl&quot;</code> methods of
<code>download.file</code> and <code>url</code>. This is recommended as it gives
access to &lsquo;<samp>https://</samp>&rsquo; and &lsquo;<samp>ftps://</samp>&rsquo; URLs. Information on
<code>libcurl</code> is found from the <code>curl-config</code> script: if that
is missing or needs to be overridden<a name="DOCF43" href="#FOOT43"><sup>43</sup></a>
there are macros described in file <samp>config.site</samp>.
</p>
<p>The <code>bitmap</code> and <code>dev2bitmap</code> devices and function
<code>embedFonts()</code> use ghostscript
(<a href="http://www.ghostscript.com/">http://www.ghostscript.com/</a>). This should either be in your
path when the command is run, or its full path specified by the
environment variable <code>R_GSCMD</code> at that time.
<a name="index-R_005fGSCMD"></a>
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Tcl_002fTk" accesskey="1">Tcl/Tk</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Java-support" accesskey="2">Java support</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Other-compiled-languages" accesskey="3">Other compiled languages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Tcl_002fTk"></a>
<div class="header">
<p>
Next: <a href="#Java-support" accesskey="n" rel="next">Java support</a>, Previous: <a href="#Useful-libraries-and-programs" accesskey="p" rel="prev">Useful libraries and programs</a>, Up: <a href="#Useful-libraries-and-programs" accesskey="u" rel="up">Useful libraries and programs</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Tcl_002fTk-1"></a>
<h4 class="subsection">A.2.1 Tcl/Tk</h4>
<p>The <strong>tcltk</strong> package needs Tcl/Tk &gt;= 8.4 installed: the sources are
available at <a href="https://www.tcl.tk/">https://www.tcl.tk/</a>. To specify the locations of the
Tcl/Tk files you may need the configuration options
</p>
<dl compact="compact">
<dt><samp>--with-tcltk</samp></dt>
<dd><p>use Tcl/Tk, or specify its library directory
</p></dd>
<dt><samp>--with-tcl-config=<var>TCL_CONFIG</var></samp></dt>
<dd><p>specify location of <samp>tclConfig.sh</samp>
</p></dd>
<dt><samp>--with-tk-config=<var>TK_CONFIG</var></samp></dt>
<dd><p>specify location of <samp>tkConfig.sh</samp>
</p></dd>
</dl>
<p>or use the configure variables <code>TCLTK_LIBS</code> and
<code>TCLTK_CPPFLAGS</code> to specify the flags needed for linking against
the Tcl and Tk libraries and for finding the <samp>tcl.h</samp> and
<samp>tk.h</samp> headers, respectively. If you have both 32- and 64-bit
versions of Tcl/Tk installed, specifying the paths to the correct config
files may be necessary to avoid confusion between them.
</p>
<p>Versions of Tcl/Tk up to 8.5.18 and 8.6.4 have been tested (including
most versions of 8.4.x, but not recently).
</p>
<p>Note that the <samp>tk.h</samp> header includes<a name="DOCF44" href="#FOOT44"><sup>44</sup></a> X11 headers, so you will need X11 and its
development files installed.
</p>
<hr>
<a name="Java-support"></a>
<div class="header">
<p>
Next: <a href="#Other-compiled-languages" accesskey="n" rel="next">Other compiled languages</a>, Previous: <a href="#Tcl_002fTk" accesskey="p" rel="prev">Tcl/Tk</a>, Up: <a href="#Useful-libraries-and-programs" accesskey="u" rel="up">Useful libraries and programs</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Java-support-1"></a>
<h4 class="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 <a href="https://CRAN.R-project.org/package=rJava"><strong>rJava</strong></a> and <a href="https://CRAN.R-project.org/package=JavaGD"><strong>JavaGD</strong></a>). This check can be
suppressed by configure option <samp>--disable-java</samp>.
<a name="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
<a name="index-R_005fJAVA_005fLD_005fLIBRARY_005fPATH"></a>
<code>R_JAVA_LD_LIBRARY_PATH</code> in file <samp><var>R_HOME</var>/etc/ldpaths</samp> (or
a sub-architecture-specific version). A typical setting for
&lsquo;<samp>x86_64</samp>&rsquo; Linux is
</p>
<div class="example">
<pre class="example">JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.51-4.b16.fc21.x86_64/jre
R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/amd64/server
</pre></div>
<p>Note that this unfortunately depends on the exact version of the JRE/JDK
installed, and so may need updating if the Java installation is updated.
This can be done by running <code>R CMD javareconf</code> which updates
settings in both <samp>etc/Makeconf</samp> and
<samp><var>R_HOME</var>/etc/ldpaths</samp>. See <code>R CMD javareconf --help</code> for
details.
</p>
<p>Another way of overriding those settings is to set the environment variable
<a name="index-R_005fJAVA_005fLD_005fLIBRARY_005fPATH-1"></a>
<code>R_JAVA_LD_LIBRARY_PATH</code> (before R is started, hence not in
<samp>~/.Renviron</samp>), which suffices to run already-installed
Java-using packages. For example
</p>
<div class="example">
<pre class="example">R_JAVA_LD_LIBRARY_PATH=/usr/lib/jvm/java-1.8.0/jre/lib/amd64/server
</pre></div>
<p>It may be possible to avoid this by specifying an invariant link as the
path. For example, on that system any of
</p>
<div class="example">
<pre class="example">JAVA_HOME=/usr/lib/jvm/java
JAVA_HOME=/usr/lib/jvm/java-1.8.0
JAVA_HOME=/usr/lib/jvm/java-1.8.0/jre
</pre></div>
<p>worked.
</p>
<hr>
<a name="Other-compiled-languages"></a>
<div class="header">
<p>
Previous: <a href="#Java-support" accesskey="p" rel="prev">Java support</a>, Up: <a href="#Useful-libraries-and-programs" accesskey="u" rel="up">Useful libraries and programs</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Other-compiled-languages-1"></a>
<h4 class="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>
<a name="Linear-algebra"></a>
<div class="header">
<p>
Previous: <a href="#Useful-libraries-and-programs" accesskey="p" rel="prev">Useful libraries and programs</a>, Up: <a href="#Essential-and-useful-other-programs-under-a-Unix_002dalike" accesskey="u" rel="up">Essential and useful other programs under a Unix-alike</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Linear-algebra-1"></a>
<h3 class="section">A.3 Linear algebra</h3>
<a name="index-BLAS-library"></a>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#BLAS" accesskey="1">BLAS</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#LAPACK" accesskey="2">LAPACK</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Caveats" accesskey="3">Caveats</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="BLAS"></a>
<div class="header">
<p>
Next: <a href="#LAPACK" accesskey="n" rel="next">LAPACK</a>, Previous: <a href="#Linear-algebra" accesskey="p" rel="prev">Linear algebra</a>, Up: <a href="#Linear-algebra" accesskey="u" rel="up">Linear algebra</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="BLAS-1"></a>
<h4 class="subsection">A.3.1 BLAS</h4>
<p>The linear algebra routines in R can make use of enhanced
<acronym>BLAS</acronym> (Basic Linear Algebra Subprograms,
<a href="http://www.netlib.org/blas/faq.html">http://www.netlib.org/blas/faq.html</a>) routines. However,
these have to be explicitly requested at configure time: R provides
an internal <acronym>BLAS</acronym> which is well-tested and will be adequate for
most uses of R.
</p>
<p>You can specify a particular <acronym>BLAS</acronym> library <em>via</em> a value
for the configuration option <samp>--with-blas</samp> and not to use an
external <acronym>BLAS</acronym> library by <samp>--without-blas</samp> (the
default). If <samp>--with-blas</samp> is given with no <code>=</code>, its value
is taken from the
<a name="index-BLAS_005fLIBS"></a>
environment variable <code>BLAS_LIBS</code>, set for example in
<samp>config.site</samp>. If neither the option nor the environment variable
supply a value, a search is made for a suitable <acronym>BLAS</acronym>. If the
value is not obviously a linker command (starting with a dash or giving
the path to a library), it is prefixed by &lsquo;<samp>-l</samp>&rsquo;, so
</p>
<div class="example">
<pre class="example">--with-blas=&quot;foo&quot;
</pre></div>
<p>is an instruction to link against &lsquo;<samp>-lfoo</samp>&rsquo; to find an external
<acronym>BLAS</acronym> (which needs to be found both at link time and run time).
</p>
<p>The configure code checks that the external <acronym>BLAS</acronym> is complete
(it must include all double precision and double complex routines, as
well as <code>LSAME</code>), and appears to be usable. However, an external
<acronym>BLAS</acronym> has to be usable from a shared object (so must contain
position-independent code), and that is not checked.
</p>
<p>Some enhanced <acronym>BLAS</acronym>es are compiler-system-specific
(<code>sunperf</code> on Solaris<a name="DOCF45" href="#FOOT45"><sup>45</sup></a>, <code>libessl</code> on IBM,
<code>Accelerate</code> on OS X). The correct incantation for
these is usually found <em>via</em> <samp>--with-blas</samp> with no value on
the appropriate platforms.
</p>
<p>Some of the external <acronym>BLAS</acronym>es are multi-threaded. One issue is
that R profiling (which uses the <code>SIGPROF</code> signal) may cause
problems, and you may want to disable profiling if you use a
multi-threaded <acronym>BLAS</acronym>. Note that using a multi-threaded
<acronym>BLAS</acronym> can result in taking more <acronym>CPU</acronym> time and even
more elapsed time (occasionally dramatically so) than using a similar
single-threaded <acronym>BLAS</acronym>. On a machine running other tasks, there
can be contention for CPU caches that reduces the effectiveness of the
optimization of cache use by a <acronym>BLAS</acronym> implementation.
</p>
<p>Note that under Unix (but not under Windows) if R is compiled against
a non-default <acronym>BLAS</acronym> and <samp>--enable-BLAS-shlib</samp> is
<strong>not</strong> used, then all <acronym>BLAS</acronym>-using packages must also be.
So if R is re-built to use an enhanced <acronym>BLAS</acronym> then packages
such as <a href="https://CRAN.R-project.org/package=quantreg"><strong>quantreg</strong></a> will need to be re-installed.
</p>
<p>R relies on <acronym>ISO</acronym>/<acronym>IEC</acronym>&nbsp;60559 compliance of an
external <acronym>BLAS</acronym>. This can be broken if for example the code
assumes that terms with a zero factor are always zero and do not need to
be computed&mdash;whereas <code>x*0</code> can be <code>NaN</code>. This is checked in
the test suite.
</p>
<p>External <acronym>BLAS</acronym> implementations often make less use of
extended-precision floating-point registers and will almost certainly
re-order computations. This can result in less accuracy than using the
internal <acronym>BLAS</acronym>, and may result in different solutions, e.g.
different signs in SVD and eigendecompositions.
</p>
<p>The URIs for several of these BLAS are subject to frequent gratuitous
changes, so you will need to search for their current locations.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#ATLAS" accesskey="1">ATLAS</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#ACML" accesskey="2">ACML</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Goto-and-OpenBLAS" accesskey="3">Goto and OpenBLAS</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#MKL" accesskey="4">MKL</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Shared-BLAS" accesskey="5">Shared BLAS</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="ATLAS"></a>
<div class="header">
<p>
Next: <a href="#ACML" accesskey="n" rel="next">ACML</a>, Previous: <a href="#BLAS" accesskey="p" rel="prev">BLAS</a>, Up: <a href="#BLAS" accesskey="u" rel="up">BLAS</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="ATLAS-1"></a>
<h4 class="subsubsection">A.3.1.1 ATLAS</h4>
<p>ATLAS (<a href="http://math-atlas.sourceforge.net/">http://math-atlas.sourceforge.net/</a>) is a &ldquo;tuned&rdquo;
<acronym>BLAS</acronym> that runs on a wide range of Unix-alike platforms.
Unfortunately it is built by default as a static library that on some
platforms cannot be used with shared objects such as are used in R
packages. Be careful when using pre-built versions of ATLAS (they seem
to work on &lsquo;<samp>ix86</samp>&rsquo; platforms, but not always on &lsquo;<samp>x86_64</samp>&rsquo;
ones).
</p>
<p>The usual way to specify ATLAS will be via
</p>
<div class="example">
<pre class="example">--with-blas=&quot;-lf77blas -latlas&quot;
</pre></div>
<p>if the libraries are in the library path, otherwise by
</p>
<div class="example">
<pre class="example">--with-blas=&quot;-L/path/to/ATLAS/libs -lf77blas -latlas&quot;
</pre></div>
<p>For example, &lsquo;<samp>x86_64</samp>&rsquo; Fedora needs
</p><div class="example">
<pre class="example">--with-blas=&quot;-L/usr/lib64/atlas -lf77blas -latlas&quot;
</pre></div>
<p>For systems with multiple CPU cores it is possible to use a
multi-threaded version of ATLAS, by specifying
</p>
<div class="example">
<pre class="example">--with-blas=&quot;-lptf77blas -lpthread -latlas&quot;
</pre></div>
<p>Consult its installation guide for how to build ATLAS with
position-independent code, and as a shared library.
</p>
<hr>
<a name="ACML"></a>
<div class="header">
<p>
Next: <a href="#Goto-and-OpenBLAS" accesskey="n" rel="next">Goto and OpenBLAS</a>, Previous: <a href="#ATLAS" accesskey="p" rel="prev">ATLAS</a>, Up: <a href="#BLAS" accesskey="u" rel="up">BLAS</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="ACML-1"></a>
<h4 class="subsubsection">A.3.1.2 ACML</h4>
<p>For &lsquo;<samp>x86_64</samp>&rsquo; processors<a name="DOCF46" href="#FOOT46"><sup>46</sup></a> under Linux there is the AMD Core Math Library (ACML).
For the <code>gcc</code> version we could use
</p>
<div class="example">
<pre class="example">--with-blas=&quot;-lacml&quot;
</pre></div>
<p>if the appropriate library directory (such as
<a name="index-LD_005fLIBRARY_005fPATH-1"></a>
<samp>/opt/acml5.1.0/gfortran64/lib</samp>) is in the <code>LD_LIBRARY_PATH</code>.
For other compilers, see the ACML documentation. There is a
multithreaded Linux version of ACML available for recent versions of
<code>gfortran</code>. To make use of this you will need something like
</p>
<div class="example">
<pre class="example">--with-blas=&quot;-L/opt/acml5.1.0/gfortran64_mp/lib -lacml_mp&quot;
</pre></div>
<p>(and you may need to arrange for the directory to be in <code>ld.so</code>
cache).
</p>
<p>See see <a href="#Shared-BLAS">Shared BLAS</a> for an alternative (and in many ways preferable)
way to use ACML.
</p>
<p>The version last tested (5.1.0) failed the <samp>reg-BLAS.R</samp> test in its
handling of <code>NA</code>s.
</p>
<hr>
<a name="Goto-and-OpenBLAS"></a>
<div class="header">
<p>
Next: <a href="#MKL" accesskey="n" rel="next">MKL</a>, Previous: <a href="#ACML" accesskey="p" rel="prev">ACML</a>, Up: <a href="#BLAS" accesskey="u" rel="up">BLAS</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Goto-and-OpenBLAS-1"></a>
<h4 class="subsubsection">A.3.1.3 Goto and OpenBLAS</h4>
<p>Dr Kazushige Goto wrote a tuned <acronym>BLAS</acronym> for several processors and
OSes, which was frozen in mid-2010. The final version is known as
GotoBLAS2, and was re-released under a much less restrictive licence.
Once it is built and installed, it can be used by configuring R with
</p>
<div class="example">
<pre class="example">--with-blas=&quot;-lgoto2&quot;
</pre></div>
<p>See see <a href="#Shared-BLAS">Shared BLAS</a> for an alternative (and in many ways preferable)
way to use it.
</p>
<p>OpenBLAS (<a href="http://www.openblas.net/">http://www.openblas.net/</a>) is a descendant
project with support for some later CPUs (e.g. Intel Sandy Bridge).
Once installed it can be used by something like
</p>
<div class="example">
<pre class="example">--with-blas=&quot;-lopenblas&quot;
</pre></div>
<p>or as a shared BLAS.
</p>
<hr>
<a name="MKL"></a>
<div class="header">
<p>
Next: <a href="#Shared-BLAS" accesskey="n" rel="next">Shared BLAS</a>, Previous: <a href="#Goto-and-OpenBLAS" accesskey="p" rel="prev">Goto and OpenBLAS</a>, Up: <a href="#BLAS" accesskey="u" rel="up">BLAS</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Intel-MKL"></a>
<h4 class="subsubsection">A.3.1.4 Intel MKL</h4>
<p>For Intel processors (and perhaps others) and some distributions of
Linux, there is Intel&rsquo;s Math Kernel Library. You are strongly
encouraged to read the MKL User&rsquo;s Guide, which is installed with the
library, before attempting to link to MKL. This includes a &lsquo;link line
advisor&rsquo; which will suggest appropriate incantations: its use is
recommended. Or see
<a href="https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor">https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor</a>.
</p>
<p>There are also versions of MKL for OS X and Windows, but at the time
these were tried they did not work with the standard compilers used for
R on those platforms.
</p>
<p>The MKL interface has changed several times and may change again: the
following examples have been used with versions 10.3 to 11.3, for GCC
compilers on &lsquo;<samp>x86_64</samp>&rsquo;.
</p>
<p>To a sequential version of MKL we used
</p>
<div class="example">
<pre class="example">MKL_LIB_PATH=/path/to/intel_mkl/lib/intel64
export LD_LIBRARY_PATH=$MKL_LIB_PATH
MKL=&quot;-L${MKL_LIB_PATH} -lmkl_gf_lp64 -lmkl_core -lmkl_sequential&quot;
./configure --with-blas=&quot;$MKL&quot; --with-lapack
</pre></div>
<p>The option <samp>--with-lapack</samp> is used since MKL contains a tuned
copy of LAPACK as well as <acronym>BLAS</acronym> (see <a href="#LAPACK">LAPACK</a>), although this
can be omitted.
</p>
<p>Threaded MKL may be used by replacing the line defining the variable
<code>MKL</code> by
</p>
<div class="example">
<pre class="example">MKL=&quot;-L${MKL_LIB_PATH} -lmkl_gf_lp64 -lmkl_core \
-lmkl_gnu_thread -dl -lpthread&quot;
</pre></div>
<p>The default number of threads will be chosen by the OpenMP software, but
can be controlled by setting <code>OMP_NUM_THREADS</code> or
<code>MKL_NUM_THREADS</code>, and in recent versions seems to default to a
sensible value for sole use of the machine.
</p>
<p>It has been reported that
</p>
<div class="example">
<pre class="example">--with-blas='-mkl=parallel' --with-lapack
</pre></div>
<p>worked with the Intel 2015.3 compilers on Centos 6.
</p>
<hr>
<a name="Shared-BLAS"></a>
<div class="header">
<p>
Previous: <a href="#MKL" accesskey="p" rel="prev">MKL</a>, Up: <a href="#BLAS" accesskey="u" rel="up">BLAS</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Shared-BLAS-1"></a>
<h4 class="subsubsection">A.3.1.5 Shared BLAS</h4>
<p>The <acronym>BLAS</acronym> library will be used for many of the add-on packages
as well as for R itself. This means that it is better to use a
shared/dynamic <acronym>BLAS</acronym> library, as most of a static library will
be compiled into the R executable and each <acronym>BLAS</acronym>-using
package.
</p>
<p>R offers the option of compiling the <acronym>BLAS</acronym> into a dynamic
library <code>libRblas</code> stored in <samp><var>R_HOME</var>/lib</samp> and linking
both R itself and all the add-on packages against that library.
</p>
<p>This is the default on all platforms except AIX unless an external
<acronym>BLAS</acronym> is specified and found: for the latter it can be used by
specifying the option <samp>--enable-BLAS-shlib</samp>, and it can always be
disabled via <samp>--disable-BLAS-shlib</samp>.
</p>
<p>This has both advantages and disadvantages.
</p>
<ul>
<li> It saves space by having only a single copy of the <acronym>BLAS</acronym>
routines, which is helpful if there is an external static <acronym>BLAS</acronym>
such as used to be standard for ATLAS.
</li><li> There may be performance disadvantages in using a shared <acronym>BLAS</acronym>.
Probably the most likely is when R&rsquo;s internal <acronym>BLAS</acronym> is used
and R is <em>not</em> built as a shared library, when it is possible to
build the <acronym>BLAS</acronym> into <samp>R.bin</samp> (and <samp>libR.a</samp>) without
using position-independent code. However, experiments showed that in
many cases using a shared <acronym>BLAS</acronym> was as fast, provided high
levels of compiler optimization are used.
</li><li> It is easy to change the <acronym>BLAS</acronym> without needing to re-install
R and all the add-on packages, since all references to the
<acronym>BLAS</acronym> go through <code>libRblas</code>, and that can be replaced.
Note though that any dynamic libraries the replacement links to will
need to be found by the linker: this may need the library path to be
changed in <samp><var>R_HOME</var>/etc/ldpaths</samp>.
</li></ul>
<p>Another option to change the <acronym>BLAS</acronym> in use is to symlink a
dynamic <acronym>BLAS</acronym> library (such as ACML or Goto&rsquo;s) to
<samp><var>R_HOME</var>/lib/libRblas.so</samp>. For example, just
</p>
<div class="example">
<pre class="example">mv <var>R_HOME</var>/lib/libRblas.so <var>R_HOME</var>/lib/libRblas.so.keep
ln -s /opt/acml5.1.0/gfortran64_mp/lib/libacml_mp.so <var>R_HOME</var>/lib/libRblas.so
</pre></div>
<p>will change the <acronym>BLAS</acronym> in use to multithreaded ACML. A similar
link works for some versions of Goto <acronym>BLAS</acronym>, OpenBLAS and MKL
(provided the appropriate <samp>lib</samp> directory is in the run-time
library path or <code>ld.so</code> cache).
</p>
<hr>
<a name="LAPACK"></a>
<div class="header">
<p>
Next: <a href="#Caveats" accesskey="n" rel="next">Caveats</a>, Previous: <a href="#BLAS" accesskey="p" rel="prev">BLAS</a>, Up: <a href="#Linear-algebra" accesskey="u" rel="up">Linear algebra</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="LAPACK-1"></a>
<h4 class="subsection">A.3.2 LAPACK</h4>
<a name="index-LAPACK-library"></a>
<p>Provision is made for using an external LAPACK library, principally to
cope with <acronym>BLAS</acronym> libraries which contain a copy of LAPACK (such
as <code>sunperf</code> on Solaris, <code>Accelerate</code> on OS X and ACML and MKL
on &lsquo;<samp>ix86</samp>&rsquo;/&lsquo;<samp>x86_64</samp>&rsquo; Linux). At least LAPACK version 3.2
is required. This can only be done if <samp>--with-blas</samp> has been used.
</p>
<p>However, the likely performance gains are thought to be small (and may
be negative), and the default is not to search for a suitable LAPACK
library, and this is definitely <strong>not</strong> recommended. You can
specify a specific LAPACK library or a search for a generic library by
the configuration option <samp>--with-lapack</samp>. The default for
<samp>--with-lapack</samp> is to check the <acronym>BLAS</acronym> library and then
look for an external library &lsquo;<samp>-llapack</samp>&rsquo;. Sites searching for the
fastest possible linear algebra may want to build a LAPACK library using
the ATLAS-optimized subset of LAPACK. To do so specify something like
</p>
<div class="example">
<pre class="example">--with-lapack=&quot;-L/path/to/ATLAS/libs -llapack -lcblas&quot;
</pre></div>
<p>since the ATLAS subset of LAPACK depends on <code>libcblas</code>. A value
for <samp>--with-lapack</samp> can be set <em>via</em> the environment
variable
<a name="index-LAPACK_005fLIBS"></a>
<code>LAPACK_LIBS</code>, but this will only be used if <samp>--with-lapack</samp>
is specified (as the default value is <code>no</code>) and the <acronym>BLAS</acronym> library
does not contain LAPACK.
</p>
<p>Since ACML contains a full LAPACK, if selected as the <acronym>BLAS</acronym> it
can be used as the LAPACK <em>via</em> <samp>--with-lapack</samp>.
</p>
<p>If you do use <samp>--with-lapack</samp>, be aware of potential problems
with bugs in the LAPACK sources (or in the posted corrections to those
sources). In particular, bugs in <code>DGEEV</code> and <code>DGESDD</code> have
resulted in error messages such as
</p>
<div class="example">
<pre class="example">DGEBRD gave error code -10
</pre></div>
<p>. Other potential problems are incomplete versions of the libraries,
seen several times in Linux distributions over the years.
</p>
<p>Please <strong>do</strong> bear in mind that using <samp>--with-lapack</samp> is
&lsquo;definitely <strong>not</strong> recommended&rsquo;: it is provided <strong>only</strong>
because it is necessary on some platforms and because some users want to
experiment with claimed performance improvements. Reporting problems
where it is used unnecessarily will simply irritate the R helpers.
</p>
<p>Note too the comments about <acronym>ISO</acronym>/<acronym>IEC</acronym>&nbsp;60559
compliance in the section of external <acronym>BLAS</acronym>: these apply
equally to an external LAPACK, and for example the Intel MKL
documentation says
</p><blockquote>
<p>LAPACK routines assume that input matrices do not contain IEEE 754
special values such as INF or NaN values. Using these special values may
cause LAPACK to return unexpected results or become unstable.
</p></blockquote>
<p>We rely on limited support in LAPACK for matrices with <em>2^{31}</em> or
more elements: it is quite possible that an external LAPACK will not
have that support.
</p>
<p>If you have a pure FORTRAN 77 compiler which cannot compile LAPACK it
may be possible to use CLAPACK from
<a href="http://www.netlib.org/clapack/">http://www.netlib.org/clapack/</a> by something like
</p><div class="example">
<pre class="example">-with-lapack=&quot;-lclapack -lf2c&quot;
</pre></div>
<p>provided these were built with position-independent code and the calling
conventions for double complex function return values match those in the
BLAS used, so it may be simpler to use CLAPACK built to use CBLAS and
</p><div class="example">
<pre class="example">-with-lapack=&quot;-lclapack -lcblas -lf2c&quot;
</pre></div>
<hr>
<a name="Caveats"></a>
<div class="header">
<p>
Previous: <a href="#LAPACK" accesskey="p" rel="prev">LAPACK</a>, Up: <a href="#Linear-algebra" accesskey="u" rel="up">Linear algebra</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Caveats-1"></a>
<h4 class="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>
<a name="Configuration-on-a-Unix_002dalike"></a>
<div class="header">
<p>
Next: <a href="#Platform-notes" accesskey="n" rel="next">Platform notes</a>, Previous: <a href="#Essential-and-useful-other-programs-under-a-Unix_002dalike" accesskey="p" rel="prev">Essential and useful other programs under a Unix-alike</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Configuration-on-a-Unix_002dalike-1"></a>
<h2 class="appendix">Appendix B Configuration on a Unix-alike</h2>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Configuration-options" accesskey="1">Configuration options</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Internationalization-support" accesskey="2">Internationalization support</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Configuration-variables" accesskey="3">Configuration variables</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Setting-the-shell" accesskey="4">Setting the shell</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Using-make" accesskey="5">Using make</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Using-FORTRAN" accesskey="6">Using FORTRAN</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Compile-and-load-flags" accesskey="7">Compile and load flags</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Maintainer-mode" accesskey="8">Maintainer mode</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Configuration-options"></a>
<div class="header">
<p>
Next: <a href="#Internationalization-support" accesskey="n" rel="next">Internationalization support</a>, Previous: <a href="#Configuration-on-a-Unix_002dalike" accesskey="p" rel="prev">Configuration on a Unix-alike</a>, Up: <a href="#Configuration-on-a-Unix_002dalike" accesskey="u" rel="up">Configuration on a Unix-alike</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Configuration-options-1"></a>
<h3 class="section">B.1 Configuration options</h3>
<p><code>configure</code> has many options: running
</p>
<div class="example">
<pre class="example">./configure --help
</pre></div>
<p>will give a list. Probably the most important ones not covered
elsewhere are (defaults in brackets)
</p>
<dl compact="compact">
<dt><samp>--with-x</samp></dt>
<dd><p>use the X Window System [yes]
</p></dd>
<dt><samp>--x-includes=<var>DIR</var></samp></dt>
<dd><p>X include files are in <var>DIR</var>
</p></dd>
<dt><samp>--x-libraries=<var>DIR</var></samp></dt>
<dd><p>X library files are in <var>DIR</var>
</p></dd>
<dt><samp>--with-readline</samp></dt>
<dd><p>use readline library (if available) [yes]
</p></dd>
<dt><samp>--enable-R-profiling</samp></dt>
<dd><p>attempt to compile support for <code>Rprof()</code> [yes]
</p></dd>
<dt><samp>--enable-memory-profiling</samp></dt>
<dd><p>attempt to compile support for <code>Rprofmem()</code> and <code>tracemem()</code> [no]
</p></dd>
<dt><samp>--enable-R-shlib</samp></dt>
<dd><p>build R as a shared/dynamic library [no]
</p></dd>
<dt><samp>--enable-BLAS-shlib</samp></dt>
<dd><p>build the <acronym>BLAS</acronym> as a shared/dynamic library [yes, except on AIX]
</p></dd>
</dl>
<p>You can use <samp>--without-foo</samp> or <samp>--disable-foo</samp> for the
negatives.
</p>
<p>You will want to use <samp>--disable-R-profiling</samp> if you are building
a profiled executable of R (e.g. with &lsquo;<samp>-pg)</samp>&rsquo;.
</p>
<p>Flag <samp>--enable-R-shlib</samp> causes the make process to build R as
a dynamic (shared) library, typically called <samp>libR.so</samp>, and link
the main R executable <samp>R.bin</samp> against that library. This can
only be done if all the code (including system libraries) can be
compiled into a dynamic library, and there may be a
performance<a name="DOCF47" href="#FOOT47"><sup>47</sup></a> penalty. So you probably
only want this if you will be using an application which embeds R.
Note that C code in packages installed on an R system linked with
<samp>--enable-R-shlib</samp> is linked against the dynamic library and so
such packages cannot be used from an R system built in the default
way. Also, because packages are linked against R they are on some
OSes also linked against the dynamic libraries R itself is linked
against, and this can lead to symbol conflicts.
</p>
<p>For maximally effective use of <code>valgrind</code>, R should be
compiled with valgrind instrumentation. The <code>configure</code> option
is <samp>--with-valgrind-instrumentation=<var>level</var></samp>, where
<var>level</var> is 0, 1 or 2. (Level 0 is the default and does not add
anything.) The system headers for <code>valgrind</code> can be requested
by option <samp>--with-system-valgrind-headers</samp>: they will be used if
present (on Linux they may be in a separate package such as
<strong>valgrind-devel</strong>). Note though that there is no guarantee that the
code in R will be compatible with future <code>valgrind</code> headers.
</p>
<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>
<a name="Internationalization-support"></a>
<div class="header">
<p>
Next: <a href="#Configuration-variables" accesskey="n" rel="next">Configuration variables</a>, Previous: <a href="#Configuration-options" accesskey="p" rel="prev">Configuration options</a>, Up: <a href="#Configuration-on-a-Unix_002dalike" accesskey="u" rel="up">Configuration on a Unix-alike</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Internationalization-support-1"></a>
<h3 class="section">B.2 Internationalization support</h3>
<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
&lsquo;Additional capabilities&rsquo; if support has been compiled in, and running
in an English locale (but not the <code>C</code> locale) will include
</p>
<div class="example">
<pre class="example"> Natural language support but running in an English locale
</pre></div>
<p>in the greeting on starting R.
</p>
<hr>
<a name="Configuration-variables"></a>
<div class="header">
<p>
Next: <a href="#Setting-the-shell" accesskey="n" rel="next">Setting the shell</a>, Previous: <a href="#Internationalization-support" accesskey="p" rel="prev">Internationalization support</a>, Up: <a href="#Configuration-on-a-Unix_002dalike" accesskey="u" rel="up">Configuration on a Unix-alike</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Configuration-variables-1"></a>
<h3 class="section">B.3 Configuration variables</h3>
<a name="index-configure-4"></a>
<p>If you need or want to set certain configure variables to something
other than their default, you can do that by either editing the file
<samp>config.site</samp> (which documents many of the variables you might want
to set: others can be seen in file <samp>etc/Renviron.in</samp>) or on the
command line as
</p>
<div class="example">
<pre class="example">./configure <var>VAR</var>=<var>value</var>
</pre></div>
<p>If you are building in a directory different from the sources, there can
be copies of <samp>config.site</samp> in the source and the build directories,
and both will be read (in that order). In addition, if there is a file
<samp>~/.R/config</samp>, it is read between the <samp>config.site</samp> files in
the source and the build directories.
</p>
<p>There is also a general <code>autoconf</code> mechanism for
<samp>config.site</samp> files, which are read before any of those mentioned
in the previous paragraph. This looks first at a file specified by the
<a name="index-CONFIG_005fSITE"></a>
environment variable <code>CONFIG_SITE</code>, and if not is set at files such
as <samp>/usr/local/share/config.site</samp> and
<samp>/usr/local/etc/config.site</samp> in the area (exemplified by
<samp>/usr/local</samp>) where R would be installed.
</p>
<p>These variables are <em>precious</em>, implying that they do not have to
be exported to the environment, are kept in the cache even if not
specified on the command line, checked for consistency between two
configure runs (provided that caching is used), and are kept during
automatic reconfiguration as if having been passed as command line
arguments, even if no cache is used.
</p>
<p>See the variable output section of <code>configure --help</code> for a list of
all these variables.
</p>
<p>If you find you need to alter configure variables, it is worth noting
that some settings may be cached in the file <samp>config.cache</samp>, and it
is a good idea to remove that file (if it exists) before re-configuring.
Note that caching is turned <em>off</em> by default: use the command line
option <samp>--config-cache</samp> (or <samp>-C</samp>) to enable caching.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Setting-paper-size" accesskey="1">Setting paper size</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Setting-the-browsers" accesskey="2">Setting the browsers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Compilation-flags" accesskey="3">Compilation flags</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Making-manuals" accesskey="4">Making manuals</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Setting-paper-size"></a>
<div class="header">
<p>
Next: <a href="#Setting-the-browsers" accesskey="n" rel="next">Setting the browsers</a>, Previous: <a href="#Configuration-variables" accesskey="p" rel="prev">Configuration variables</a>, Up: <a href="#Configuration-variables" accesskey="u" rel="up">Configuration variables</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Setting-paper-size-1"></a>
<h4 class="subsection">B.3.1 Setting paper size</h4>
<a name="index-R_005fPAPERSIZE-2"></a>
<p>One common variable to change is <code>R_PAPERSIZE</code>, which defaults to
&lsquo;<samp>a4</samp>&rsquo;, not &lsquo;<samp>letter</samp>&rsquo;. (Valid values are &lsquo;<samp>a4</samp>&rsquo;,
&lsquo;<samp>letter</samp>&rsquo;, &lsquo;<samp>legal</samp>&rsquo; and &lsquo;<samp>executive</samp>&rsquo;.)
</p>
<p>This is used both when configuring R to set the default, and when
running R to override the default. It is also used to set the
paper size when making PDF manuals.
</p>
<p>The configure default will most often be &lsquo;<samp>a4</samp>&rsquo; if <code>R_PAPERSIZE</code>
is unset. (If the (Debian Linux) program <code>paperconf</code> is found
<a name="index-PAPERSIZE"></a>
or the environment variable <code>PAPERSIZE</code> is set, these are used to
produce the default.)
</p>
<hr>
<a name="Setting-the-browsers"></a>
<div class="header">
<p>
Next: <a href="#Compilation-flags" accesskey="n" rel="next">Compilation flags</a>, Previous: <a href="#Setting-paper-size" accesskey="p" rel="prev">Setting paper size</a>, Up: <a href="#Configuration-variables" accesskey="u" rel="up">Configuration variables</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Setting-the-browsers-1"></a>
<h4 class="subsection">B.3.2 Setting the browsers</h4>
<a name="index-R_005fBROWSER"></a>
<p>Another precious variable is <code>R_BROWSER</code>, the default <acronym>HTML</acronym>
browser, which should take a value of an executable in the user&rsquo;s path
or specify a full path.
</p>
<a name="index-R_005fPDFVIEWER"></a>
<p>Its counterpart for PDF files is <code>R_PDFVIEWER</code>.
</p>
<hr>
<a name="Compilation-flags"></a>
<div class="header">
<p>
Next: <a href="#Making-manuals" accesskey="n" rel="next">Making manuals</a>, Previous: <a href="#Setting-the-browsers" accesskey="p" rel="prev">Setting the browsers</a>, Up: <a href="#Configuration-variables" accesskey="u" rel="up">Configuration variables</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Compilation-flags-1"></a>
<h4 class="subsection">B.3.3 Compilation flags</h4>
<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 &lsquo;<samp>-L</samp>&rsquo; flags to be passed to the linker) and
<code>CPPFLAGS</code> (for header files, using &lsquo;<samp>-I</samp>&rsquo; flags to be passed to
the C/C++ preprocessors), respectively, to specify these locations.
These default to &lsquo;<samp>-L/usr/local/lib</samp>&rsquo; (<code>LDFLAGS</code>,
&lsquo;<samp>-L/usr/local/lib64</samp>&rsquo; on most 64-bit Linux OSes) and
&lsquo;<samp>-I/usr/local/include</samp>&rsquo; (<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 &lsquo;<samp>-O3</samp>&rsquo; 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
&lsquo;<samp>-Wl,-O1</samp>&rsquo; in <code>LDFLAGS</code> is worthwhile, and
&lsquo;<samp>'-Bdirect,--hash-style=both,-Wl,-O1'</samp>&rsquo; is recommended at
<a href="https://lwn.net/Articles/192624/">https://lwn.net/Articles/192624/</a>. Tuning compilation to a
specific <acronym>CPU</acronym> family (e.g. &lsquo;<samp>-mtune=native</samp>&rsquo; for
<code>gcc</code>) can give worthwhile performance gains, especially on
older architectures such as &lsquo;<samp>ix86</samp>&rsquo;.
</p>
<hr>
<a name="Making-manuals"></a>
<div class="header">
<p>
Previous: <a href="#Compilation-flags" accesskey="p" rel="prev">Compilation flags</a>, Up: <a href="#Configuration-variables" accesskey="u" rel="up">Configuration variables</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Making-manuals-1"></a>
<h4 class="subsection">B.3.4 Making manuals</h4>
<a name="index-R_005fRD4PDF-1"></a>
<a name="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>
<a name="Setting-the-shell"></a>
<div class="header">
<p>
Next: <a href="#Using-make" accesskey="n" rel="next">Using make</a>, Previous: <a href="#Configuration-variables" accesskey="p" rel="prev">Configuration variables</a>, Up: <a href="#Configuration-on-a-Unix_002dalike" accesskey="u" rel="up">Configuration on a Unix-alike</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Setting-the-shell-1"></a>
<h3 class="section">B.4 Setting the shell</h3>
<p>By default the shell scripts such as <samp>R</samp> will be &lsquo;<samp>#!/bin/sh</samp>&rsquo;
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>
<a name="Using-make"></a>
<div class="header">
<p>
Next: <a href="#Using-FORTRAN" accesskey="n" rel="next">Using FORTRAN</a>, Previous: <a href="#Setting-the-shell" accesskey="p" rel="prev">Setting the shell</a>, Up: <a href="#Configuration-on-a-Unix_002dalike" accesskey="u" rel="up">Configuration on a Unix-alike</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Using-make-1"></a>
<h3 class="section">B.5 Using make</h3>
<a name="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 &lsquo;<samp>gmake</samp>&rsquo;, you need to set the
variable <code>MAKE</code> at configure time, for example
</p>
<a name="index-configure-5"></a>
<div class="example">
<pre class="example">./configure MAKE=gmake
</pre></div>
<hr>
<a name="Using-FORTRAN"></a>
<div class="header">
<p>
Next: <a href="#Compile-and-load-flags" accesskey="n" rel="next">Compile and load flags</a>, Previous: <a href="#Using-make" accesskey="p" rel="prev">Using make</a>, Up: <a href="#Configuration-on-a-Unix_002dalike" accesskey="u" rel="up">Configuration on a Unix-alike</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Using-FORTRAN-1"></a>
<h3 class="section">B.6 Using FORTRAN</h3>
<a name="index-FORTRAN"></a>
<p>To compile R, you need a FORTRAN compiler. The default
is to search for
<code>f95</code>, <code>fort</code>, <code>xlf95</code>,
<code>ifort</code>, <code>ifc</code>, <code>efc</code>, <code>pgf95</code>
<code>lf95</code>, <code>gfortran</code>, <code>ftn</code>, <code>g95</code>,
<code>f90</code>, <code>xlf90</code>, <code>pghpf</code>, <code>pgf90</code>,
<code>epcf90</code>,
<code>g77</code>, <code>f77</code>, <code>xlf</code>, <code>frt</code>,
<code>pgf77</code>, <code>cf77</code>, <code>fort77</code>, <code>fl32</code>,
<code>af77</code> (in that order)<a name="DOCF48" href="#FOOT48"><sup>48</sup></a>, and use whichever is found first; if none is found,
R cannot be compiled.
However, if <code>CC</code> is <code>gcc</code>, the matching FORTRAN compiler
(<code>g77</code> for <code>gcc</code>&nbsp;3 and <code>gfortran</code> for
<code>gcc</code>&nbsp;4) is used if available.
</p>
<p>The search mechanism can be changed using the configure variable
<code>F77</code> which specifies the command that runs the FORTRAN 77
compiler. If your FORTRAN compiler is in a non-standard location, you
<a name="index-PATH-1"></a>
should set the environment variable <code>PATH</code> accordingly before
running <code>configure</code>, or use the configure variable <code>F77</code> to
specify its full path.
</p>
<p>If your FORTRAN libraries are in slightly peculiar places, you should
<a name="index-LD_005fLIBRARY_005fPATH-2"></a>
also look at <code>LD_LIBRARY_PATH</code> or your system&rsquo;s equivalent to make
sure that all libraries are on this path.
</p>
<p>Note that only FORTRAN compilers which convert identifiers to lower case
are supported.
</p>
<p>You must set whatever compilation flags (if any) are needed to ensure
that FORTRAN <code>integer</code> is equivalent to a C <code>int</code> pointer and
FORTRAN <code>double precision</code> is equivalent to a C <code>double</code>
pointer. This is checked during the configuration process.
</p>
<p>Some of the FORTRAN code makes use of <code>COMPLEX*16</code> variables, which
is a Fortran 90 extension. This is checked for at configure
time<a name="DOCF49" href="#FOOT49"><sup>49</sup></a>, but you may need to avoid
compiler flags asserting FORTRAN 77 compliance.
</p>
<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
(<a href="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
<a name="index-F2C"></a>
<a name="index-F2CLIBS"></a>
<a name="index-CC"></a>
the environment variables <code>F2C</code>, <code>F2CLIBS</code>, <code>CC</code> and
<a name="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 &lsquo;<samp>typedef long int integer;</samp>&rsquo;, which will work
on a 32-bit platform but needs to be changed to &lsquo;<samp>typedef int
integer;</samp>&rsquo; on a 64-bit platform. If your compiler is not <code>gcc</code>
you will need to set
<a name="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 <a href="http://www.netlib.org/clapack/">http://www.netlib.org/clapack/</a>).
</p>
<hr>
<a name="Compile-and-load-flags"></a>
<div class="header">
<p>
Next: <a href="#Maintainer-mode" accesskey="n" rel="next">Maintainer mode</a>, Previous: <a href="#Using-FORTRAN" accesskey="p" rel="prev">Using FORTRAN</a>, Up: <a href="#Configuration-on-a-Unix_002dalike" accesskey="u" rel="up">Configuration on a Unix-alike</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Compile-and-load-flags-1"></a>
<h3 class="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>
<dl compact="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>
<dl compact="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
<a name="index-LD_005fLIBRARY_005fPATH-3"></a>
collected together and prepended to <code>LD_LIBRARY_PATH</code> (or your
system&rsquo;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 &lsquo;<samp>-fpic</samp>&rsquo; and &lsquo;<samp>-fPIC</samp>&rsquo;, 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 &lsquo;<samp>MAIN_CFLAGS=-pg</samp>&rsquo;, &lsquo;<samp>MAIN_FFLAGS=-pg</samp>&rsquo;,
&lsquo;<samp>MAIN_LDFLAGS=-pg</samp>&rsquo; on platforms where &lsquo;<samp>-pg</samp>&rsquo; 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>&nbsp;60559
compliance.
</p>
<hr>
<a name="Maintainer-mode"></a>
<div class="header">
<p>
Previous: <a href="#Compile-and-load-flags" accesskey="p" rel="prev">Compile and load flags</a>, Up: <a href="#Configuration-on-a-Unix_002dalike" accesskey="u" rel="up">Configuration on a Unix-alike</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Maintainer-mode-1"></a>
<h3 class="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 <a href="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
&lsquo;autoconf archive&rsquo; installed. This can be found at
<a href="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>
<a name="Platform-notes"></a>
<div class="header">
<p>
Next: <a href="#The-Windows-toolset" accesskey="n" rel="next">The Windows toolset</a>, Previous: <a href="#Configuration-on-a-Unix_002dalike" accesskey="p" rel="prev">Configuration on a Unix-alike</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Platform-notes-1"></a>
<h2 class="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 &lt; 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 <a href="http://sourceforge.net/p/predef/wiki/Home/">http://sourceforge.net/p/predef/wiki/Home/</a> can be
helpful. The R sources currently use
</p><div class="example">
<pre class="example">AIX: _AIX
Cygwin: __CYGWIN__
FreeBSD: __FreeBSD__
HP-UX: __hpux__, __hpux
IRIX: sgi, __sgi
Linux: __linux__
OS X: __APPLE__
NetBSD: __NetBSD__
OpenBSD: __OpenBSD__
Solaris: __sun, sun
Windows: _WIN32, _WIN64
</pre></div>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#X11-issues" accesskey="1">X11 issues</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Linux" accesskey="2">Linux</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#OS-X" accesskey="3">OS X</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Solaris" accesskey="4">Solaris</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#AIX" accesskey="5">AIX</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#FreeBSD" accesskey="6">FreeBSD</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Cygwin" accesskey="7">Cygwin</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#New-platforms" accesskey="8">New platforms</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="X11-issues"></a>
<div class="header">
<p>
Next: <a href="#Linux" accesskey="n" rel="next">Linux</a>, Previous: <a href="#Platform-notes" accesskey="p" rel="prev">Platform notes</a>, Up: <a href="#Platform-notes" accesskey="u" rel="up">Platform notes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="X11-issues-1"></a>
<h3 class="section">C.1 X11 issues</h3>
<p>The &lsquo;<samp>X11()</samp>&rsquo; graphics device is the one started automatically on
Unix-alikes when plotting. As its name implies, it displays on a (local
or remote) X server, and relies on the services provided by the X
server.
</p>
<p>The &lsquo;modern&rsquo; version of the &lsquo;<samp>X11()</samp>&rsquo; device is based on &lsquo;<samp>cairo</samp>&rsquo;
graphics and (in most implementations) uses &lsquo;<samp>fontconfig</samp>&rsquo; to pick and
render fonts. This is done on the server, and although there can be
selection issues, they are more amenable than the issues with
&lsquo;<samp>X11()</samp>&rsquo; discussed in the rest of this section.
</p>
<p>When X11 was designed, most displays were around 75dpi, whereas today
they are of the order of 100dpi or more. If you find that X11()
is reporting<a name="DOCF50" href="#FOOT50"><sup>50</sup></a> missing font sizes, especially larger ones, it is likely
that you are not using scalable fonts and have not installed the 100dpi
versions of the X11 fonts. The names and details differ by system, but
will likely have something like Fedora&rsquo;s
</p><div class="example">
<pre class="example">xorg-x11-fonts-75dpi
xorg-x11-fonts-100dpi
xorg-x11-fonts-ISO8859-2-75dpi
xorg-x11-fonts-Type1
xorg-x11-fonts-cyrillic
</pre></div>
<p>and you need to ensure that the &lsquo;<samp>-100dpi</samp>&rsquo; versions are installed
and on the X11 font path (check via <code>xset -q</code>). The
&lsquo;<samp>X11()</samp>&rsquo; device does try to set a pointsize and not a pixel size:
laptop users may find the default setting of 12 too large (although very
frequently laptop screens are set to a fictitious dpi to appear like a
scaled-down desktop screen).
</p>
<p>More complicated problems can occur in non-Western-European locales, so
if you are using one, the first thing to check is that things work in
the <code>C</code> locale. The likely issues are a failure to find any fonts
or glyphs being rendered incorrectly (often as a pair of <acronym>ASCII</acronym>
characters). X11 works by being asked for a font specification and
coming up with its idea of a close match. For text (as distinct from
the symbols used by plotmath), the specification is the first element of
the option <code>&quot;X11fonts&quot;</code> which defaults to
</p>
<div class="example">
<pre class="example">&quot;-adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*&quot;
</pre></div>
<p>If you are using a single-byte encoding, for example ISO 8859-2 in
Eastern Europe or KOI8-R in Russian, use <code>xlsfonts</code> to find an
appropriate family of fonts in your encoding (the last field in the
listing). If you find none, it is likely that you need to install
further font packages, such as &lsquo;<samp>xorg-x11-fonts-ISO8859-2-75dpi</samp>&rsquo; and
&lsquo;<samp>xorg-x11-fonts-cyrillic</samp>&rsquo; shown in the listing above.
</p>
<p>Multi-byte encodings (most commonly UTF-8) are even more complicated.
There are few fonts in &lsquo;<samp>iso10646-1</samp>&rsquo;, the Unicode encoding, and they
only contain a subset of the available glyphs (and are often fixed-width
designed for use in terminals). In such locales <em>fontsets</em> are
used, made up of fonts encoded in other encodings. If the locale you
are using has an entry in the &lsquo;<samp>XLC_LOCALE</samp>&rsquo; directory (typically
<samp>/usr/share/X11/locale</samp>, it is likely that all you need to do is to
pick a suitable font specification that has fonts in the encodings
specified there. If not, you may have to get hold of a suitable locale
entry for X11. This may mean that, for example, Japanese text can be
displayed when running in &lsquo;<samp>ja_JP.UTF-8</samp>&rsquo; but not when running in
&lsquo;<samp>en_GB.UTF-8</samp>&rsquo; on the same machine (although on some systems many
UTF-8 X11 locales are aliased to &lsquo;<samp>en_US.UTF-8</samp>&rsquo; which covers several
character sets, e.g. ISO 8859-1 (Western European), JISX0208 (Kanji),
KSC5601 (Korean), GB2312 (Chinese Han) and JISX0201 (Kana)).
</p>
<p>On some systems scalable fonts are available covering a wide range of
glyphs. One source is TrueType/OpenType fonts, and these can provide
high coverage. Another is Type 1 fonts: the URW set of Type 1 fonts
provides standard typefaces such as Helvetica with a larger coverage of
Unicode glyphs than the standard X11 bitmaps, including Cyrillic. These
are generally not part of the default install, and the X server may need
to be configured to use them. They might be under the X11 <samp>fonts</samp>
directory or elsewhere, for example,
</p>
<div class="example">
<pre class="example">/usr/share/fonts/default/Type1
/usr/share/fonts/ja/TrueType
</pre></div>
<hr>
<a name="Linux"></a>
<div class="header">
<p>
Next: <a href="#OS-X" accesskey="n" rel="next">OS X</a>, Previous: <a href="#X11-issues" accesskey="p" rel="prev">X11 issues</a>, Up: <a href="#Platform-notes" accesskey="u" rel="up">Platform notes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Linux-1"></a>
<h3 class="section">C.2 Linux</h3>
<a name="index-Linux-1"></a>
<p>Linux is the main development platform for R, so compilation from the
sources is normally straightforward with the standard compilers.
</p>
<p>Remember that some package management systems (such as <acronym>RPM</acronym> and
deb) make a distinction between the user version of a package and the
developer version. The latter usually has the same name but with the
extension &lsquo;<samp>-devel</samp>&rsquo; or &lsquo;<samp>-dev</samp>&rsquo;: you need both versions
installed. So please check the <code>configure</code> output to see if the
expected features are detected: if for example &lsquo;<samp>readline</samp>&rsquo; is
missing add the developer package. (On most systems you will also need
&lsquo;<samp>ncurses</samp>&rsquo; and its developer package, although these should be
dependencies of the &lsquo;<samp>readline</samp>&rsquo; package(s).) You should expect to
see in the <code>configure</code> summary
</p>
<div class="example">
<pre class="example"> Interfaces supported: X11, tcltk
External libraries: readline, zlib, bzlib, lzma, PCRE, curl
Additional capabilities: PNG, JPEG, TIFF, NLS, cairo, ICU
</pre></div>
<p>When R has been installed from a binary distribution there are
sometimes problems with missing components such as the FORTRAN
compiler. Searching the &lsquo;<samp>R-help</samp>&rsquo; archives will normally reveal
what is needed.
</p>
<p>It seems that &lsquo;<samp>ix86</samp>&rsquo; Linux accepts non-PIC code in shared
libraries, but this is not necessarily so on other platforms, in
particular on 64-bit <acronym>CPU</acronym>s such as &lsquo;<samp>x86_64</samp>&rsquo;. So care
can be needed with <acronym>BLAS</acronym> libraries and when building R as a
shared library to ensure that position-independent code is used in any
static libraries (such as the Tcl/Tk libraries, <code>libpng</code>,
<code>libjpeg</code> and <code>zlib</code>) which might be linked against.
Fortunately these are normally built as shared libraries with the
exception of the ATLAS <acronym>BLAS</acronym> libraries.
</p>
<p>The default optimization settings chosen for <code>CFLAGS</code> etc are
conservative. It is likely that using <samp>-mtune</samp> will result in
significant performance improvements on recent CPUs (especially for
&lsquo;<samp>ix86</samp>&rsquo;): one possibility is to add <samp>-mtune=native</samp> for
the best possible performance on the machine on which R is being
installed: if the compilation is for a site-wide installation, it may
still be desirable to use something like
<samp>-mtume=core2</samp>.<a name="DOCF51" href="#FOOT51"><sup>51</sup></a> It is also possible to increase the
optimization levels to <samp>-O3</samp>: however for many versions of the
compilers this has caused problems in at least one <acronym>CRAN</acronym>
package.
</p>
<p>For platforms with both 64- and 32-bit support, it is likely that
</p>
<div class="example">
<pre class="example">LDFLAGS=&quot;-L/usr/local/lib64 -L/usr/local/lib&quot;
</pre></div>
<p>is appropriate since most (but not all) software installs its 64-bit
libraries in <samp>/usr/local/lib64</samp>. To build a 32-bit version of R
on &lsquo;<samp>x86_64</samp>&rsquo; with Fedora 21 we used
</p>
<div class="example">
<pre class="example">CC=&quot;gcc -m32&quot;
CXX=&quot;g++ -m32&quot;
F77=&quot;gfortran -m32&quot;
FC=${F77}
OBJC=${CC}
LDFLAGS=&quot;-L/usr/local/lib&quot;
LIBnn=lib
</pre></div>
<p>Note the use of &lsquo;<samp>LIBnn</samp>&rsquo;: &lsquo;<samp>x86_64</samp>&rsquo; Fedora installs its
64-bit software in <samp>/usr/lib64</samp> and 32-bit software in
<samp>/usr/lib</samp>. Linking will skip over inappropriate binaries, but for
example the 32-bit Tcl/Tk configure scripts are in <samp>/usr/lib</samp>. It
may also be necessary to set the <code>pkg-config</code> path, e.g. by
</p>
<div class="example">
<pre class="example">export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
</pre></div>
<p>64-bit versions of Linux are built with support for files &gt; 2Gb, and
32-bit versions will be if possible unless <samp>--disable-largefile</samp>
is specified.
</p>
<p>To build a 64-bit version of R on &lsquo;<samp>ppc64</samp>&rsquo; (also known as
&lsquo;<samp>powerpc64</samp>&rsquo;) with <code>gcc</code>&nbsp;4.1.1, Ei-ji Nakama used
</p>
<div class="example">
<pre class="example">CC=&quot;gcc -m64&quot;
CXX=&quot;gxx -m64&quot;
F77=&quot;gfortran -m64&quot;
FC=&quot;gfortran -m64&quot;
CFLAGS=&quot;-mminimal-toc -fno-optimize-sibling-calls -g -O2&quot;
FFLAGS=&quot;-mminimal-toc -fno-optimize-sibling-calls -g -O2&quot;
</pre></div>
<p>the additional flags being needed to resolve problems linking against
<samp>libnmath.a</samp> and when linking R as a shared library.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Clang" accesskey="1">Clang</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Intel-compilers" accesskey="2">Intel compilers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Oracle-Solaris-Studio-compilers" accesskey="3">Oracle Solaris Studio compilers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Clang"></a>
<div class="header">
<p>
Next: <a href="#Intel-compilers" accesskey="n" rel="next">Intel compilers</a>, Previous: <a href="#Linux" accesskey="p" rel="prev">Linux</a>, Up: <a href="#Linux" accesskey="u" rel="up">Linux</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Clang-1"></a>
<h4 class="subsection">C.2.1 Clang</h4>
<p>R has been built with Linux &lsquo;<samp>ix86</samp>&rsquo; and &lsquo;<samp>x86_64</samp>&rsquo; C and
C++ compilers (<a href="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 (<a href="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
version 3.7.0 or later may.<a name="DOCF52" href="#FOOT52"><sup>52</sup></a>
</p>
<hr>
<a name="Intel-compilers"></a>
<div class="header">
<p>
Next: <a href="#Oracle-Solaris-Studio-compilers" accesskey="n" rel="next">Oracle Solaris Studio compilers</a>, Previous: <a href="#Clang" accesskey="p" rel="prev">Clang</a>, Up: <a href="#Linux" accesskey="u" rel="up">Linux</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Intel-compilers-1"></a>
<h4 class="subsection">C.2.2 Intel compilers</h4>
<p>Intel compilers have been used under &lsquo;<samp>ix86</samp>&rsquo; and &lsquo;<samp>x86_64</samp>&rsquo;
Linux. Brian Ripley used version 9.0 of the compilers for
&lsquo;<samp>x86_64</samp>&rsquo; on Fedora Core 5 with
</p>
<div class="example">
<pre class="example">CC=icc
CFLAGS=&quot;-g -O3 -wd188 -ip -mp&quot;
F77=ifort
FLAGS=&quot;-g -O3 -mp&quot;
CXX=icpc
CXXFLAGS=&quot;-g -O3 -mp&quot;
FC=ifort
FCFLAGS=&quot;-g -O3 -mp&quot;
ICC_LIBS=/opt/compilers/intel/cce/9.1.039/lib
IFC_LIBS=/opt/compilers/intel/fce/9.1.033/lib
LDFLAGS=&quot;-L$ICC_LIBS -L$IFC_LIBS -L/usr/local/lib64&quot;
SHLIB_CXXLD=icpc
</pre></div>
<p><code>configure</code> will add &lsquo;<samp>-c99</samp>&rsquo; to <code>CC</code> for
C99-compliance. This causes warnings with <code>icc</code> 10 and later, so
use <code>CC=&quot;icc -std=c99&quot;</code> there. The flag <samp>-wd188</samp> suppresses
a large number of warnings about the enumeration type &lsquo;<samp>Rboolean</samp>&rsquo;.
Because the Intel C compiler sets &lsquo;<samp>__GNUC__</samp>&rsquo; without complete
emulation of <code>gcc</code>, we suggest adding <code>CPPFLAGS=-no-gcc</code>.
</p>
<p>To maintain correct <acronym>IEC</acronym>&nbsp;60559 arithmetic you most likely
need add flags to <code>CFLAGS</code>, <code>FFLAGS</code> and <code>CXXFLAGS</code> such
as <samp>-mp</samp> (shown above) or <samp>-fp-model precise -fp-model
source</samp>, depending on the compiler version.
</p>
<p>Others have reported success with versions 10.x and 11.x.
% https://stat.ethz.ch/pipermail/r-devel/2015-September/071717.html
Bjørn-Helge Mevik reported success with version 2015.3 of the compilers,
using (for a SandyBridge CPU on Centos 6.x)
</p>
<div class="example">
<pre class="example">fast=&quot;-fp-model precise -ip -O3 -opt-mem-layout-trans=3 -xHost -mavx&quot;
CC=icc
CFLAGS=&quot;$fast -wd188&quot;
F77=ifort
FFLAGS=&quot;$fast&quot;
CXX=icpc
CXXFLAGS=&quot;$fast&quot;
FC=$F77
FCFLAGS=$F77FLAGS
</pre></div>
<hr>
<a name="Oracle-Solaris-Studio-compilers"></a>
<div class="header">
<p>
Previous: <a href="#Intel-compilers" accesskey="p" rel="prev">Intel compilers</a>, Up: <a href="#Linux" accesskey="u" rel="up">Linux</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Oracle-Solaris-Studio-compilers-1"></a>
<h4 class="subsection">C.2.3 Oracle Solaris Studio compilers</h4>
<p>Brian Ripley tested the Sun Studio 12 compilers, since renamed to Oracle
Solaris Studio. On &lsquo;<samp>x86_64</samp>&rsquo; Linux with
</p>
<div class="example">
<pre class="example">CC=suncc
CFLAGS=&quot;-xO5 -xc99 -xlibmil -nofstore&quot;
CPICFLAGS=-Kpic
F77=sunf95
FFLAGS=&quot;-O5 -libmil -nofstore&quot;
FPICFLAGS=-Kpic
CXX=&quot;sunCC -library=stlport4&quot;
CXXFLAGS=&quot;-xO5 -xlibmil -nofstore -features=tmplrefstatic&quot;
CXXPICFLAGS=-Kpic
FC=sunf95
FCFLAGS=$FFLAGS
FCPICFLAGS=-Kpic
LDFLAGS=-L/opt/sunstudio12.1/rtlibs/amd64
SHLIB_LDFLAGS=-shared
SHLIB_CXXLDFLAGS=-G
SHLIB_FCLDFLAGS=-G
SAFE_FFLAGS=&quot;-O5 -libmil&quot;
</pre></div>
<p><samp>-m64</samp> could be added, but was the default. Do not use
<samp>-fast</samp>: see the warnings under Solaris. (The C++ options are
also explained under Solaris.)
</p>
<p>Others have found on at least some versions of &lsquo;<samp>ix86</samp>&rsquo; Linux that
the configure flag <samp>--disable-largefile</samp> was needed (since
<samp>glob.h</samp> on that platform presumed <code>gcc</code> was being used).
</p>
<hr>
<a name="OS-X"></a>
<div class="header">
<p>
Next: <a href="#Solaris" accesskey="n" rel="next">Solaris</a>, Previous: <a href="#Linux" accesskey="p" rel="prev">Linux</a>, Up: <a href="#Platform-notes" accesskey="u" rel="up">Platform notes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="OS-X-2"></a>
<h3 class="section">C.3 OS X</h3>
<a name="index-OS-X-2"></a>
<p>To build R you need to have installed Apple&rsquo;s &lsquo;Command Line Tools&rsquo;
(on some versions installing Xcode suffices). You also need
<code>readline</code> (or to configure using <samp>--without-readline</samp>), and
a Fortran compiler. Those and other binary components are available
from <a href="https://r.research.att.com/libs">https://r.research.att.com/libs</a>.
</p>
<p>An X sub-system is required unless configuring using
<samp>--without-x</samp>: see <a href="https://xquartz.macosforge.org/">https://xquartz.macosforge.org/</a>. (Note
that XQuartz will likely need to be re-installed after an OS upgrade.)
To build R you need Apple&rsquo;s &lsquo;Command Line Tools&rsquo;: these can be
(re-)installed by <code>xcode-select --install</code>. (If you have a
fresh OS installation, running e.g. <code>make</code> in a terminal will
offer the installation of the command-line tools. If you have installed
Xcode, this provides the command-line tools. The tools will need to be
reinstalled when OS X is upgraded, as upgrading partially removes them.)
</p>
<p>The instructions here are for &lsquo;<samp>x86_64</samp>&rsquo; builds on 10.6 (Snow
Leopard) or later. In principle R can be built for 10.4.x, 10.5.x
and for PowerPC or 32-bit Intel Macs but these has not been tested
recently.
</p>
<p>To use the <code>quartz()</code> graphics device you need to configure with
<samp>--with-aqua</samp> (which is the default): <code>quartz()</code> then
becomes the default device when running R at the console and X11
would only be used for the command-line-R data editor/viewer and one
version of Tcl/Tk. (This needs an Objective-C compiler<a name="DOCF53" href="#FOOT53"><sup>53</sup></a> which can compile the source code of
<code>quartz()</code>.)
</p>
<p>Use <samp>--without-aqua</samp> if you want a standard Unix-alike build:
apart from disabling <code>quartz()</code> and the ability to use the build
with <small>R.APP</small>, it also changes the default location of the personal
library (see <code>?.libPaths</code>). Also use
<samp>--disable-R-framework</samp> to install in the standard layout.
</p>
<p>Various compilers can be used. The current <acronym>CRAN</acronym> &lsquo;Mavericks&rsquo;
distribution of R is built using
</p>
<div class="example">
<pre class="example">CC=clang
CXX=clang++
F77=gfortran-4.8
FC=$F77
OBJC=clang
CFLAGS=-Wall -mtune=core2 -g -O2
CXXFLAGS=-Wall -mtune=core2 -g -O2'
OBJCFLAGS=-Wall -mtune=core2 -g -O2
F77FLAGS=-Wall -g -O2
FCFLAGS=$F77FLAGS
</pre></div>
<p>with <code>clang</code> and <code>clang++</code> from the &lsquo;Command Line
Tools&rsquo; and the Fortran compiler from
<a href="https://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2">https://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2</a>.<a name="DOCF54" href="#FOOT54"><sup>54</sup></a> Apple&rsquo;s builds of <code>clang</code>
currently have no OpenMP support.
</p>
<p>The <acronym>CRAN</acronym> &lsquo;Snow Leopard&rsquo; distribution of R was built using
</p>
<ul>
<li> <code>gcc</code>
from an Xcode distribution prior to version 5. This is a version of gcc
4.2.1 with an LLVM backend.
</li><li> <code>gfortran</code>
from
<a href="http://cran.r-project.org/bin/macosx/tools/gfortran-4.2.3.pkg">http://cran.r-project.org/bin/macosx/tools/gfortran-4.2.3.pkg</a>.
Note that this installs into <samp>/usr/local/bin</samp>, so make sure that is
on your path. Other compilers from
<a href="http://r.research.att.com/tools/">http://r.research.att.com/tools/</a> can also be used.
</li><li> <code>clang</code>
from the Xcode distribution, to compile the Objective-C parts of the
<code>quartz()</code> device.
</li></ul>
<p>To use these, have in <samp>config.site</samp> something like
</p>
<div class="example">
<pre class="example">CC=&quot;llvm-gcc-4.2&quot;
CXX=&quot;llvm-g++-4.2&quot;
F77=&quot;gfortran-4.2 -arch x86_64&quot;
FC=$F77
OBJC=&quot;clang&quot;
</pre></div>
<p>Full names help to ensure that the intended compilers are used. In
particular <code>gcc</code> is a copy of <code>llvm-gcc-4.2</code> for Xcode &lt;
5 but of <code>clang</code> in Xcode 5. The recommended Fortran compiler
defaults to 32-bit, so <code>-arch x86_64</code> is needed. (For a 32-bit
build, use <code>-arch i386</code> for all compiler commands.)
</p>
<p>The OpenMP support in this version of <code>gcc</code> is problematic, so
the <acronym>CRAN</acronym> build is configured with <samp>--disable-openmp</samp>.
</p>
<p>Other builds of <code>gfortran</code> are available: see
<a href="https://gcc.gnu.org/wiki/GFortranBinaries">https://gcc.gnu.org/wiki/GFortranBinaries</a> and
<a href="http://coudert.name/software.html">http://coudert.name/software.html</a>. To use one of these with a
binary distribution of R you will probably need to specify the name
or path in a personal or site <samp>Makevars</samp> file (see <a href="#Customizing-package-compilation">Customizing package compilation</a>).
</p>
<p>More recent and complete distributions of <code>clang</code> are usually
available from <a href="http://llvm.org/releases/">http://llvm.org/releases/</a>. In particular, these
include support for the &lsquo;Address Sanitizer&rsquo; (not included by Apple until
Xcode 7) and for OpenMP<a name="DOCF55" href="#FOOT55"><sup>55</sup></a> in version 3.7.0 and later.
</p>
<p>Pre-compiled versions of many of the <a href="#Useful-libraries-and-programs">Useful libraries and programs</a>
are available from <a href="https://r.research.att.com/libs/">https://r.research.att.com/libs/</a>. You will
most likely want at least <code>pcre</code>, <code>xz</code>, <code>jpeg</code>
and <code>readline</code> (and perhaps <code>tiff</code>).
<code>pkg-config</code> is not provided by Apple and useful for many packages:
it will also be used if present when configuring the <code>X11()</code>
device.
</p>
<p>Recent versions of OS X ship with <code>zlib</code> version 1.2.8 and
<code>bzlib</code> version 1.0.6, sufficient for the default
<code>configure</code> checks. Mavericks has a recent enough version of
<code>libcurl</code>: Snow Leopard does not.
</p>
<p>Support for <code>cairo</code> (without <code>Pango</code>) can be enabled in two
ways: both need <code>pkg-config</code> available. XQuartz ships <code>cairo</code>
and its version will be selected if its <code>pkg-config</code> files are
first on the configuration path: for example by setting
</p><div class="example">
<pre class="example">export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
</pre></div>
<p>or appending that variable to the <code>configure</code> command.
Otherwise the binary libraries at
<a href="https://r.research.att.com/libs/">https://r.research.att.com/libs/</a> can be used: <code>cairo</code>,
<code>fontconfig</code>, <code>freetype</code>, <code>pixman</code> and
<samp>pkgconfig-system-stubs-darwin13.tar.gz</samp> are needed, plus
<code>libpng</code> for PNG support.
</p>
<a name="index-BLAS-library-1"></a>
<a name="index-LAPACK-library-1"></a>
<p>The <code>Accelerate</code> library can be used <em>via</em> the configuration options
</p>
<div class="example">
<pre class="example">--with-blas=&quot;-framework Accelerate&quot; --with-lapack
</pre></div>
<p>to provide potentially higher-performance versions of the <acronym>BLAS</acronym>
and LAPACK routines. (Use of <code>Accelerate</code> with
<samp>--with-lapack</samp> does not work on Snow Leopard: it may work there
without.)<a name="DOCF56" href="#FOOT56"><sup>56</sup></a>
</p>
<p>Looking at the top of
<samp>/Library/Frameworks/R.framework/Resources/etc/Makeconf</samp>
will show the compilers and configuration options used for the
<acronym>CRAN</acronym> binary package for R: at the time of writing
</p><div class="example">
<pre class="example">--enable-memory-profiling
</pre></div>
<p>was used for &lsquo;Mavericks&rsquo;.
</p>
<p>Configure option <samp>--with-internal-tzcode</samp> is the default on OS X,
as the system implementation of time zones does not work correctly for
times before 1902 or after 2037 (despite using a 64-bit <code>time_t</code>).
</p>
<p>The TeX implementation used by the developers is MacTeX
(<a href="https://www.tug.org/mactex/">https://www.tug.org/mactex/</a>): the full installation is about
4GB, but a smaller version is available at
<a href="https://www.tug.org/mactex/morepackages.html">https://www.tug.org/mactex/morepackages.html</a>: you will need to
add some packages, e.g. for the 2015 version we needed to add
<strong>cm-super</strong>, <strong>helvetic</strong>, <strong>inconsolata</strong> and <strong>texinfo</strong>
which brought this to about 410MB. &lsquo;<samp>TeX Live Utility</samp>&rsquo; (available
<em>via</em> the MacTeX front page) provides a graphical means to manage
TeX packages.
</p>
<p>One OS X quirk is that the default path has <samp>/usr/local/bin</samp> after
<samp>/usr/bin</samp>, contrary to common practice on Unix-alikes. This means
that if you install tools from the sources they will by default be
installed under <samp>/usr/local</samp> and not supersede the system
versions.
</p>
<p>If you upgrade your OS you should re-install the &lsquo;Command Line Tools&rsquo;
and may need to re-install XQuartz and Java (this has been needed for
some upgrades but not others).
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Mavericks-and-later" accesskey="1">Mavericks and later</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Lion-and-Mountain-Lion" accesskey="2">Lion and Mountain Lion</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Snow-Leopard" accesskey="3">Snow Leopard</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#El-Capitan" accesskey="4">El Capitan</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Tcl_002fTk-headers-and-libraries" accesskey="5">Tcl/Tk headers and libraries</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Java-_0028OS-X_0029" accesskey="6">Java (OS X)</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Frameworks" accesskey="7">Frameworks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Building-R_002eapp" accesskey="8">Building R.app</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Mavericks-and-later"></a>
<div class="header">
<p>
Next: <a href="#Lion-and-Mountain-Lion" accesskey="n" rel="next">Lion and Mountain Lion</a>, Previous: <a href="#OS-X" accesskey="p" rel="prev">OS X</a>, Up: <a href="#OS-X" accesskey="u" rel="up">OS X</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Mavericks-and-later-1"></a>
<h4 class="subsection">C.3.1 Mavericks and later</h4>
<p>For these versions Apple makes available compilers based on
<code>clang</code>, and C++ headers and runtime are from LLVM&rsquo;s
&lsquo;<samp>libc++</samp>&rsquo; project, as part of the &lsquo;Command Line Tools&rsquo; (sometimes
called &lsquo;Command Line Developer Tools&rsquo;) and of Xcode (you only need one
or the other).
</p>
<p>These tools can be (re-)installed by <code>xcode-select --install</code>.
(If you have a fresh installation of Mavericks or later, running e.g.
<code>make</code> in a terminal will offer the installation of the
command-line tools, or perhaps use the versions from Xcode. However,
after an OS update, you are advised to re-install them.)
</p>
<p>To use the compilers from the command-line tools with the recommended
Fortran compiler, have in <samp>config.site</samp> something like
</p>
<div class="example">
<pre class="example">CC=clang
CXX=clang++
F77=gfortran-4.8
FC=$F77
OBJC=clang
</pre></div>
<p>More recent and complete distributions of <code>clang</code> are usually
available from <a href="http://llvm.org/releases/">http://llvm.org/releases/</a>. In particular, these
include support for the &lsquo;Address Sanitizer&rsquo; (not included by Apple until
Xcode 7) and for OpenMP in versions 3.7.0 and later.
</p>
<p>See the comments under Mountain Lion about X11 and GTK.
</p>
<p>If you upgrade the OS you should re-install any of XQuartz, the &lsquo;Command
Line Tools&rsquo; and Java which you have installed. (Upgrading may partially
remove previous versions which can be confusing.)
</p>
<p>There are some warnings using the recommended <code>gfortran</code> build
under Yosemite.
</p>
<hr>
<a name="Lion-and-Mountain-Lion"></a>
<div class="header">
<p>
Next: <a href="#Snow-Leopard" accesskey="n" rel="next">Snow Leopard</a>, Previous: <a href="#Mavericks-and-later" accesskey="p" rel="prev">Mavericks and later</a>, Up: <a href="#OS-X" accesskey="u" rel="up">OS X</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Lion-and-Mountain-Lion-1"></a>
<h4 class="subsection">C.3.2 Lion and Mountain Lion</h4>
<p>&lsquo;Command-line Tools for Xcode&rsquo; used to be part of the Apple Developer
Tools (&lsquo;Xcode&rsquo;) but for these versions needs to be installed separately.
They can be downloaded from
<a href="http://developer.apple.com/devcenter/mac/">http://developer.apple.com/devcenter/mac/</a> (you will need to
register there: that allows you to download older versions available for
your OS) or from within some versions of Xcode you can install the
command-line tools from the &lsquo;<samp>Downloads</samp>&rsquo; pane in the
&lsquo;<samp>Preferences</samp>&rsquo;.
</p>
<p>The X11 system used with Mountain Lion is XQuartz (see above): Lion
included an X11 system.
</p>
<p>To build the graphics devices depending on cairographics, the XQuartz
path for <code>pkg-config</code> files needs to be known to
<code>pkg-config</code> when <code>configure</code> is run: this usually means
adding it to the <code>PKG_CONFIG_PATH</code> environment variable, e.g.
</p>
<div class="example">
<pre class="example">export PKG_CONFIG_PATH= \
/opt/X11/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
</pre></div>
<p>or putting
</p><div class="example">
<pre class="example">PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
</pre></div>
<p>in <samp>config.site</samp>.
</p>
<p>For some pre-compiled software, for example the GTK framework,
<samp>/opt/X11/include</samp> may need to be added to the include paths.
</p>
<p>If you install the command-line tools for Xcode 4.6.3 you will get the
compilers used for the CRAN binary distribution: those for Xcode 5 can
be installed afterwards.
</p>
<hr>
<a name="Snow-Leopard"></a>
<div class="header">
<p>
Next: <a href="#El-Capitan" accesskey="n" rel="next">El Capitan</a>, Previous: <a href="#Lion-and-Mountain-Lion" accesskey="p" rel="prev">Lion and Mountain Lion</a>, Up: <a href="#OS-X" accesskey="u" rel="up">OS X</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Snow-Leopard-1"></a>
<h4 class="subsection">C.3.3 Snow Leopard</h4>
<p>A quirk on Snow Leopard is that the X11 libraries are not in the default
linking path, so something like &lsquo;<samp>LIBS=-L/usr/X11/lib</samp>&rsquo; may be
required in <samp>config.site</samp>, or you can use the <code>configure</code>
options <samp>--x-includes=/usr/X11/include
--x-libraries=/usr/X11/lib</samp> .
</p>
<p>The <acronym>CRAN</acronym> binaries were built using Xcode 4.2, a version
available only to subscribing developers. It is believed that 3.2.6 (the
last public free version for Snow Leopard) will work.
</p>
<hr>
<a name="El-Capitan"></a>
<div class="header">
<p>
Next: <a href="#Tcl_002fTk-headers-and-libraries" accesskey="n" rel="next">Tcl/Tk headers and libraries</a>, Previous: <a href="#Snow-Leopard" accesskey="p" rel="prev">Snow Leopard</a>, Up: <a href="#OS-X" accesskey="u" rel="up">OS X</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="El-Capitan-1"></a>
<h4 class="subsection">C.3.4 El Capitan</h4>
<p>El Capitan was released at the end of September 2015, and experience to
date is with systems which have been updated from Yosemite or earlier.
Upgraded systems need the Command Line Tools reinstalled.
</p>
<p>There are problems resulting from the new-to-El-Capitan restriction that
only Apple is allowed to install software under <samp>/usr</samp>: this
affects <em>inter alia</em> <code>MacTeX</code> and <code>XQuartz</code>. For
<code>MacTeX</code> it is necessary to include <samp>/Library/TeX/texbin</samp> in
your path rather than <samp>/usr/texbin</samp>. Upgrading will move
disallowed files to under <samp>/Library/SystemMigration/usr</samp>: this
includes <samp>/usr/X11R6</samp>, <samp>/usr/texbin</samp>, <samp>/usr/bin/R</samp>,
<samp>/usr/bin/Rscript</samp> but not the link <samp>/usr/X11</samp>.
</p>
<p><code>configure</code> can be told to look for <code>X11</code> in
<code>XQuartz</code>&rsquo;s main location of <samp>/opt/X11</samp>, e.g. by
</p><div class="example">
<pre class="example">--x-includes=/opt/X11/include --x-libraries=/opt/X11/lib
</pre></div>
<p>although the linked versions under <samp>/usr/X11</samp> will be found (if the
link is present).
</p>
<hr>
<a name="Tcl_002fTk-headers-and-libraries"></a>
<div class="header">
<p>
Next: <a href="#Java-_0028OS-X_0029" accesskey="n" rel="next">Java (OS X)</a>, Previous: <a href="#El-Capitan" accesskey="p" rel="prev">El Capitan</a>, Up: <a href="#OS-X" accesskey="u" rel="up">OS X</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Tcl_002fTk-headers-and-libraries-1"></a>
<h4 class="subsection">C.3.5 Tcl/Tk headers and libraries</h4>
<p>If you plan to use the <code>tcltk</code> package for R, you need to
install a distribution of Tcl/Tk. There are two alternatives. If you
use <small>R.APP</small> you will want to use X11-based Tcl/Tk (as used on other
Unix-alikes), which is installed as part of the CRAN binary for R.
This may need
</p><div class="example">
<pre class="example">-with-tcltk=/usr/local/lib
</pre></div>
<p>or
</p><div class="example">
<pre class="example">--with-tcl-config=/usr/local/lib/tclConfig.sh
--with-tk-config=/usr/local/lib/tkConfig.sh
</pre></div>
<p>Note that this requires a fully-updated X11 installation (XQuartz for
Mountain Lion and later).
</p>
<p>There is also a native (&lsquo;Aqua&rsquo;) version of Tcl/Tk which produces widgets
in the native OS X style: this will not work with <small>R.APP</small> because of
conflicts over the OS X menu, but for those only using command-line R
this provides a much more intuitive interface to Tk for experienced Mac
users. Most versions of OS X come with Aqua Tcl/Tk libraries, but these
are not recent versions of Tcl/Tk (8.5.9 in Mountain Lion and later).
It is better to install Tcl/Tk 8.6.x from the sources or a binary
distribution from
<a href="https://www.activestate.com/activetcl/downloads">https://www.activestate.com/activetcl/downloads</a>. Configure R
with
</p><div class="example">
<pre class="example">--with-tcl-config=/Library/Frameworks/Tcl.framework/tclConfig.sh
--with-tk-config=/Library/Frameworks/Tk.framework/tkConfig.sh
</pre></div>
<p>(for the versions bundled with OS X, use paths starting with
<samp>/System/Library</samp>).
</p>
<p>If you need to find out which distribution of Tk is in use at run time,
use
</p><div class="example">
<pre class="example">library(tcltk)
tclvalue(.Tcl(&quot;tk windowingsystem&quot;)) # &quot;x11&quot; or &quot;aqua&quot;
</pre></div>
<hr>
<a name="Java-_0028OS-X_0029"></a>
<div class="header">
<p>
Next: <a href="#Frameworks" accesskey="n" rel="next">Frameworks</a>, Previous: <a href="#Tcl_002fTk-headers-and-libraries" accesskey="p" rel="prev">Tcl/Tk headers and libraries</a>, Up: <a href="#OS-X" accesskey="u" rel="up">OS X</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Java"></a>
<h4 class="subsection">C.3.6 Java</h4>
<p>The situation with Java support on OS X is messy.<a name="DOCF57" href="#FOOT57"><sup>57</sup></a>
</p>
<p>Snow Leopard and Lion shipped with a Java 6 runtime (JRE). Mountain
Lion and later do not come with an installed JRE, and an OS X upgrade
removes one if already installed: it is intended to be installed at
first use. Check if a JRE is installed by running <code>java
-version</code> in a <code>Terminal</code> window: if Java is not installed this
should prompt you to install it. You can also install directly the
latest Java from Oracle (currently from
<a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">http://www.oracle.com/technetwork/java/javase/downloads/index.html</a>).
</p>
<p>You may need to install what Apple calls &lsquo;legacy Java&rsquo;<a name="DOCF58" href="#FOOT58"><sup>58</sup></a> to suppress pop-up messages
even if you have a current version installed.
</p>
<p>To see what compatible versions of Java are currently installed, run
<code>/usr/libexec/java_home -V -a x86_64</code>. If needed, set the
environment variable <code>JAVA_HOME</code> to choose between these, both when
R is built from the sources and when <code>R CMD javareconf</code> is
run.
</p>
<p>Configuring and building R both looks for a JRE and for support for
compiling JNI programs (used by packages <a href="https://CRAN.R-project.org/package=rJava"><strong>rJava</strong></a> and
<a href="https://CRAN.R-project.org/package=JavaGD"><strong>JavaGD</strong></a>); the latter requires a JDK (Java SDK) and not just a
JRE.
</p>
<p>The build process tries to fathom out what JRE/JDK to use, but it may
need some help, e.g. by setting <code>JAVA_HOME</code>. An Apple JRE can be
specified explicitly by something like
</p><div class="example">
<pre class="example">JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
JAVA_CPPFLAGS=&quot;-I/System/Library/Frameworks/JavaVM.framework/Headers&quot;
JAVA_LD_LIBRARY_PATH=
JAVA_LIBS=&quot;-framework JavaVM&quot;
</pre></div>
<p>The Oracle JDK can be specified explicitly by something like
</p><div class="example">
<pre class="example">JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home
JAVA_CPPFLAGS=&quot;-I/${JAVA_HOME}/include -I/${JAVA_HOME}/include/darwin&quot;
JAVA_LD_LIBRARY_PATH=&quot;${JAVA_HOME}/jre/lib/server&quot;
JAVA_LIBS=&quot;-L/${JAVA_HOME}/jre/lib/server -ljvm&quot;
</pre></div>
<p>in <samp>config.site</samp>.
</p>
<p>Note that it is necessary to set the environment variable <code>NOAWT</code>
to <code>1</code> to install many of the Java-using packages.
</p>
<hr>
<a name="Frameworks"></a>
<div class="header">
<p>
Next: <a href="#Building-R_002eapp" accesskey="n" rel="next">Building R.app</a>, Previous: <a href="#Java-_0028OS-X_0029" accesskey="p" rel="prev">Java (OS X)</a>, Up: <a href="#OS-X" accesskey="u" rel="up">OS X</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Frameworks-1"></a>
<h4 class="subsection">C.3.7 Frameworks</h4>
<p>The <acronym>CRAN</acronym> build of R is installed as a framework, which is
selected by the default option
</p>
<div class="example">
<pre class="example">./configure --enable-R-framework
</pre></div>
<p>(This is intended to be used with an Apple toolchain: other compilers may
not support frameworks correctly.)
</p>
<p>It is only needed if you want to build R for use with the <small>R.APP</small>
console, and implies <samp>--enable-R-shlib</samp> to build R as a
dynamic library. This option configures R to be built and installed
as a framework called <samp>R.framework</samp>. The default installation path
for <samp>R.framework</samp> is <samp>/Library/Frameworks</samp> but this can be
changed at configure time by specifying the flag
<samp>--enable-R-framework[=<var>DIR</var>]</samp> or at install time as
</p>
<div class="example">
<pre class="example">make prefix=/where/you/want/R.framework/to/go install
</pre></div>
<p>Note that installation as a framework is non-standard (especially to a
non-standard location) and Unix utilities may not support it (e.g. the
<code>pkg-config</code> file <samp>libR.pc</samp> will be put somewhere unknown
to <code>pkg-config</code>).
</p>
<hr>
<a name="Building-R_002eapp"></a>
<div class="header">
<p>
Previous: <a href="#Frameworks" accesskey="p" rel="prev">Frameworks</a>, Up: <a href="#OS-X" accesskey="u" rel="up">OS X</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Building-R_002eapp-1"></a>
<h4 class="subsection">C.3.8 Building R.app</h4>
<p>Note that building the <small>R.APP</small> GUI console is a separate project, using
Xcode. Before compiling <small>R.APP</small> make sure the current version of R
is installed in <samp>/Library/Frameworks/R.framework</samp> and working at
the command-line (this can be a binary install).
</p>
<p>The current sources can be checked out by
</p><div class="example">
<pre class="example">svn co https://svn.r-project.org/R-packages/trunk/Mac-GUI
</pre></div>
<p>and built by loading the <code>R.xcodeproj</code> project (select the
<code>R</code> target and a suitable configuration), or from the command-line
by e.g.
</p><div class="example">
<pre class="example">xcodebuild -target R -configuration Release
</pre></div>
<p>See also the <samp>INSTALL</samp> file in the checkout or directly at
<a href="https://svn.r-project.org/R-packages/trunk/Mac-GUI/INSTALL">https://svn.r-project.org/R-packages/trunk/Mac-GUI/INSTALL</a>.
</p>
<p><small>R.APP</small> does not need to be installed in any specific way. Building
<small>R.APP</small> results in the <small>R.APP</small> bundle which appears as one R icon. This
application bundle can be run anywhere and it is customary to place it
in the <samp>/Applications</samp> folder.
</p>
<hr>
<a name="Solaris"></a>
<div class="header">
<p>
Next: <a href="#AIX" accesskey="n" rel="next">AIX</a>, Previous: <a href="#OS-X" accesskey="p" rel="prev">OS X</a>, Up: <a href="#Platform-notes" accesskey="u" rel="up">Platform notes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Solaris-1"></a>
<h3 class="section">C.4 Solaris</h3>
<a name="index-Solaris"></a>
<p>R has been built successfully on Solaris 10 (both Sparc and
&lsquo;<samp>x86</samp>&rsquo;) using the (zero cost) Oracle Solaris Studio compilers:
there has been some success with
<code>gcc</code>&nbsp;4/<code>gfortran</code>. (Recent Sun machines are AMD
Opterons or Intel Xeons (&lsquo;<samp>amd64</samp>&rsquo;) rather than &lsquo;<samp>x86</samp>&rsquo;, but
32-bit &lsquo;<samp>x86</samp>&rsquo; executables are the default.)
</p>
<p>There have been few reports on Solaris 11, with no known extra issues.
Solaris 9 and earlier are now so old that it is unlikely that R is
still used with them, and they will not be considered here.
</p>
<p>The Solaris versions of several of the tools needed to build R
(e.g. <code>make</code>, <code>ar</code> and <code>ld</code>) are in
<samp>/usr/ccs/bin</samp>, so if using those tools ensure this is in your
path. A version of the preferred <acronym>GNU</acronym> <code>tar</code> is (if
installed) in <samp>/usr/sfw/bin</samp>. It may be necessary to avoid the
tools in <samp>/usr/ucb</samp>: POSIX-compliant versions of some tools can be
found in <samp>/usr/xpg4/bin</samp> and <samp>/usr/xpg6/bin</samp>.
</p>
<p>A large selection of Open Source software can be installed from
<a href="https://www.opencsw.org">https://www.opencsw.org</a>, by default installed under
<samp>/opt/csw</samp>. Solaris 10 ships with <code>bzlib</code> version 1.0.6
(sufficient for the default <samp>--with-system-bzlib</samp>) but
<code>zlib</code> version 1.2.3 (too old for <samp>--with-system-zlib</samp>):
OpenCSW has 1.2.8.
</p>
<p>You will need <acronym>GNU</acronym> <code>libiconv</code> and <code>readline</code>: the
Solaris version of <code>iconv</code> is not sufficiently powerful.
</p>
<p>The native <code>make</code> suffices to build R but a small number of
packages require <acronym>GNU</acronym> <code>make</code> (some without good reason
and without declaring it as &lsquo;<samp>SystemRequirements</samp>&rsquo; in the
<samp>DESCRIPTION</samp> file).
</p>
<p>Some people have reported that the Solaris <code>libintl</code> needs to be
avoided, for example by using <samp>--disable-nls</samp> or
<samp>--with-included-gettext</samp> or using <code>libintl</code> from OpenCSW.
(On the other hand, there have been many successful installs which
automatically detected <code>libintl</code> from OpenCSW or selected the
included <code>gettext</code>.)
</p>
<p>The support for the C99 <code>long double</code> type on Sparc hardware uses
quad-precision arithmetic, and this is usually slow because it is done
by software emulation. On such systems the <code>configure</code> option
<samp>--disable-long-double</samp> can be used for faster but less accurate
computations.
</p>
<p>The Solaris time-zone conversion services seem to be unreliable pre-1916
in Europe (when daylight-savings time was first introduced): most often
reporting in the non-existent DST variant. Using <code>configure</code>
option <samp>--with-internal-tzcode</samp> is recommended, and required if
you find time-zone abbreviations being given odd values (as has been
seen on 64-bit builds without it).
</p>
<p>When using the Oracle compilers<a name="DOCF59" href="#FOOT59"><sup>59</sup></a> do <em>not</em> specify <samp>-fast</samp>, as this
disables <acronym>IEEE</acronym> arithmetic and <code>make check</code> will fail.
</p>
<p>It has been reported that some Solaris installations need
</p>
<div class="example">
<pre class="example">INTERNET_LIBS=&quot;-lsocket -lnsl&quot;
</pre></div>
<p>on the <code>configure</code> command line or in file <samp>config.site</samp>;
however, there have been many successful installs without this.
</p>
<p>A little juggling of paths was needed to ensure <acronym>GNU</acronym>
<code>libiconv</code> (in <samp>/usr/local</samp>) was used rather than the Solaris
<code>iconv</code>:
</p>
<div class="example">
<pre class="example">CC=&quot;cc -xc99&quot;
CFLAGS=&quot;-O -xlibmieee&quot;
F77=f95
FFLAGS=-O
CXX=&quot;CC -library=stlport4&quot;
CXXFLAGS=-O
FC=f95
FCFLAGS=$FFLAGS
FCLIBS=&quot;-lfai -lfsu&quot;
R_LD_LIBRARY_PATH=&quot;/usr/local/lib:/opt/csw/gcc4/lib:/opt/csw/lib&quot;
</pre></div>
<p>For a 64-bit target add <samp>-m64</samp> to the compiler macros
and use something like <code>LDFLAGS=-L/usr/local/lib/sparcv9</code> or
<code>LDFLAGS=-L/usr/local/lib/amd64</code> as appropriate.
It will also be necessary to point <code>pkg-config</code> at the 64-bit
directories, e.g. one of
</p>
<div class="example">
<pre class="example">PKG_CONFIG_PATH=/opt/csw/lib/amd64/pkgconfig:/usr/lib/amd64/pkgconfig
PKG_CONFIG_PATH=/opt/csw/lib/sparcv9/pkgconfig:/usr/lib/sparcv9/pkgconfig
</pre></div>
<p>and to specify a 64-bit Java VM by e.g.
</p>
<div class="example">
<pre class="example">JAVA_CPPFLAGS=&quot;-I${JAVA_HOME}/../include -I${JAVA_HOME}/../include/solaris&quot;
JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/amd64/server
JAVA_LIBS=&quot;-L${JAVA_HOME}/lib/amd64/server \
-R${JAVA_HOME}/lib/amd64/server -ljvm&quot;
</pre></div>
<p>With Solaris Studio 12.[23] on Sparc, <code>FCLIBS</code> needs to be
</p>
<div class="example">
<pre class="example">FCLIBS=&quot;-lfai -lfai2 -lfsu&quot;
</pre></div>
<p>(and possibly other Fortran libraries, but this suffices for the
packages currently on CRAN).
</p>
<p>Currently &lsquo;<samp>amd64</samp>&rsquo; and &lsquo;<samp>sparcv9</samp>&rsquo; builds work
out-of-the-box with Sun Studio 12u1 but not Solaris Studio 12.2 and
12.3: <samp>libRblas.so</samp> and <samp>lapack.so</samp> are generated with code
that causes relocation errors (which is being linked in from the Fortran
libraries). This means that building 64-bit R as a shared library
may be impossible with Solaris Studio &gt;= 12.2. For a standard build the
trick seems to be to manually set <code>FLIBS</code> to avoid the troublesome
libraries. For example, on &lsquo;<samp>amd64</samp>&rsquo; set in <samp>config.site</samp>
something like
</p>
<div class="example">
<pre class="example">FLIBS_IN_SO=&quot;-R/opt/solarisstudio12.3/lib/amd64
/opt/solarisstudio12.3/lib/amd64/libfui.so
/opt/solarisstudio12.3/lib/amd64/libfsu.so&quot;
</pre></div>
<p>For 64-bit Sparc, set in <samp>config.site</samp> something like
</p><div class="example">
<pre class="example">FLIBS=&quot;-R/opt/solarisstudio12.3/prod/lib/sparc/64
-lifai -lsunimath -lfai -lfai2 -lfsumai -lfprodai -lfminlai -lfmaxlai
-lfminvai -lfmaxvai -lfui -lsunmath -lmtsk
/opt/solarisstudio12.3/prod/lib/sparc/64/libfsu.so.1&quot;
</pre></div>
<p>By default the Solaris Studio compilers do not by default conform to the C99
standard (appendix F 8.9) on the return values of functions such as
<code>log</code>: use <samp>-xlibmieee</samp> to ensure this.
</p>
<p>You can target specific Sparc architectures for (slightly) higher
performance: <samp>-xtarget=native</samp> (in <code>CFLAGS</code> etc) tunes the
compilation to the current machine.
</p>
<p>Using <code>-xlibmil</code> in <code>CFLAGS</code> and <code>-xlibmil</code> in
<code>FFLAGS</code> allows more system mathematical functions to be inlined.
</p>
<p>On &lsquo;<samp>x86</samp>&rsquo; you will get marginally higher performance <em>via</em>
</p>
<div class="example">
<pre class="example">CFLAGS=&quot;-xO5 -xc99 -xlibmieee -xlibmil -nofstore -xtarget=native&quot;
FFLAGS=&quot;-O5 -libmil -nofstore -xtarget=native&quot;
CXXFLAGS=&quot;-xO5 -xlibmil -nofstore -xtarget=native&quot;
SAFE_FFLAGS=&quot;-libmil -fstore -xtarget=native&quot;
</pre></div>
<p>but the use of <code>-nofstore</code> can be less numerically stable, and some
packages (notably <a href="https://CRAN.R-project.org/package=mgcv"><strong>mgcv</strong></a> on &lsquo;<samp>x86</samp>&rsquo;) failed to compile at
higher optimization levels with version 12.3.
</p>
<p>The Solaris Studio compilers provide several implementations of the
C++98 standard which select both the set of headers and a C++ runtime
library. These are selected by the <samp>-library</samp> flag, which as it
is needed for both compiling and linking is best specified as part of
the compiler. The examples above use &lsquo;<samp>stlport4</samp>&rsquo;, currently the
most modern of the options: the default (but still needed to be
specified as it is needed for linking) is &lsquo;<samp>Cstd</samp>&rsquo;: see
<a href="http://www.oracle.com/technetwork/server-storage/solaris/cmp-stlport-libcstd-142559.html">http://www.oracle.com/technetwork/server-storage/solaris/cmp-stlport-libcstd-142559.html</a>.
Note though that most external Solaris C++ libraries will have been
built with &lsquo;<samp>Cstd</samp>&rsquo; and so an R package using such libraries also
needs to be. Occasionally the option <samp>-library=stlport4,Crun</samp>
has been needed.
</p>
<p>Several <acronym>CRAN</acronym> packages using C++ need the more liberal
interpretation given by adding
</p>
<div class="example">
<pre class="example">CXXFLAGS=&quot;-features=tmplrefstatic&quot;
</pre></div>
<a name="index-BLAS-library-2"></a>
<a name="index-LAPACK-library-2"></a>
<p>The performance library <code>sunperf</code> is available for use with the
Solaris Studio compilers. If selected as a <acronym>BLAS</acronym>, it must also
be selected as LAPACK <em>via</em> (for Solaris Studio 12.2 and later)
</p>
<div class="example">
<pre class="example">./configure --with-blas='-library=sunperf' --with-lapack
</pre></div>
<p>This has often given test failures in the past, in several different
places. At the time of writing it fails in <samp>tests/reg-BLAS.R</samp>, and on
some builds, including for &lsquo;<samp>amd64</samp>&rsquo;, it fails in
<code>example(eigen)</code>.
</p>
<p>Parsing very complex R expressions needs a lot of stack space when
the Oracle compilers are used: several packages require the stack
increased to at least 20MB.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Using-gcc" accesskey="1">Using gcc</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Using-gcc"></a>
<div class="header">
<p>
Previous: <a href="#Solaris" accesskey="p" rel="prev">Solaris</a>, Up: <a href="#Solaris" accesskey="u" rel="up">Solaris</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Using-gcc-1"></a>
<h4 class="subsection">C.4.1 Using gcc</h4>
<p>If using <code>gcc</code>, ensure that the compiler was compiled for the
version of Solaris in use. (This can be ascertained from <code>gcc
-v</code>.) <code>gcc</code> makes modified versions of some header files, and
several reports of problems were due to using <code>gcc</code> compiled on
one version of Solaris on a later version.
</p>
<p>The notes here are for <code>gcc</code> set up to use the Solaris linker:
it can also be set up to use GNU <code>ld</code>, but that has not been
tested.
</p>
<p>Compilation for a 32-bit Sparc target with <code>gcc</code>&nbsp;4.9.2
needed
</p>
<div class="example">
<pre class="example">CPPFLAGS=-I/opt/csw/include
LDFLAGS=&quot;-L/opt/csw/gcc4/lib -L/opt/csw/lib&quot;
</pre></div>
<p>and for a 64-bit Sparc target
</p><div class="example">
<pre class="example">CC=&quot;gcc -m64&quot;
F77=&quot;gfortran -m64&quot;
CXX=&quot;g++ -m64&quot;
FC=$F77
CPPFLAGS=-I/opt/csw/include
LDFLAGS=&quot;-L/opt/csw/gcc4/lib/sparcv9 -L/opt/csw/lib/sparcv9&quot;
</pre></div>
<p>Note that paths such as <samp>/opt/csw/gcc4/lib/sparcv9</samp> may need to
be in the
<a name="index-LD_005fLIBRARY_005fPATH-4"></a>
<code>LD_LIBRARY_PATH</code> during configuration.
</p>
<p>The compilation can be tuned to a particular cpu: the <acronym>CRAN</acronym>
check system uses <code>-mtune=niagara2</code>.
</p>
<p>Compilation for an &lsquo;<samp>x86</samp>&rsquo; target with <code>gcc</code>&nbsp;4.9.2
needed
</p>
<div class="example">
<pre class="example">CC=&quot;/opt/csw/gcc4/bin/gcc -m32&quot;
CPPFLAGS=&quot;-I/opt/csw/include -I/usr/local/include&quot;
F77=&quot;/opt/csw/gcc4/bin/gfortran -m32&quot;
CXX=&quot;/opt/csw/gcc4/bin/g++ -m32&quot;
FC=&quot;/opt/csw/gcc4/bin/gfortran -m32&quot;
LDFLAGS=&quot;-L/opt/csw/gcc4/lib -L/opt/csw/lib -L/usr/local/lib&quot;
</pre></div>
<p>(<code>-L/opt/csw/lib</code> is needed since TeXLive was built using
32-bit <code>gcc</code>, and we need <samp>/opt/csw/lib</samp> in
<code>R_LD_LIBRARY_PATH</code>.)
</p>
<p>For an &lsquo;<samp>amd64</samp>&rsquo; target with <code>gcc</code>&nbsp;4.9.2
we used
</p>
<div class="example">
<pre class="example">CC=&quot;/opt/csw/gcc4/bin/gcc -m64&quot;
CPPFLAGS=&quot;-I/opt/csw/include -I/usr/local/include&quot;
F77=&quot;/opt/csw/gcc4/bin/gfortran -m64&quot;
FPICFLAGS=-fPIC
CXX=&quot;/opt/csw/gcc4/bin/g++ -m64&quot;
FC=$F77
FCPICFLAGS=$FPICFLAGS
LDFLAGS=&quot;-L/opt/csw/gcc4/lib/amd64 -L/opt/csw/lib/amd64&quot;
</pre></div>
<hr>
<a name="AIX"></a>
<div class="header">
<p>
Next: <a href="#FreeBSD" accesskey="n" rel="next">FreeBSD</a>, Previous: <a href="#Solaris" accesskey="p" rel="prev">Solaris</a>, Up: <a href="#Platform-notes" accesskey="u" rel="up">Platform notes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="AIX-1"></a>
<h3 class="section">C.5 AIX</h3>
<a name="index-AIX"></a>
<p>We no longer support AIX prior to 4.2, and <code>configure</code> will
throw an error on such systems.
</p>
<p>Ei-ji Nakama was able to build under AIX 5.2 on &lsquo;<samp>powerpc</samp>&rsquo; with
GCC 4.0.3 in several configurations. 32-bit versions could be
configured with <samp>--without-iconv</samp> as well as
<samp>--enable-R-shlib</samp>. For 64-bit versions he used
</p>
<div class="example">
<pre class="example">OBJECT_MODE=64
CC=&quot;gcc -maix64&quot;
CXX=&quot;g++ -maix64&quot;
F77=&quot;gfortran -maix64&quot;
FC=&quot;gfortran -maix64&quot;
</pre></div>
<p>and was also able to build with the IBM <code>xlc</code> and Hitachi
<code>f90</code> compilers by
</p>
<div class="example">
<pre class="example">OBJECT_MODE=64
CC=&quot;xlc -q64&quot;
CXX=&quot;g++ -maix64&quot;
F77=&quot;f90 -cpu=pwr4 -hf77 -parallel=0 -i,L -O3 -64&quot;
FC=&quot;f90 -cpu=pwr4 -hf77 -parallel=0 -i,L -O3 -64&quot;
FLIBS=&quot;-L/opt/ofort90/lib -lhf90vecmath -lhf90math -lf90&quot;
</pre></div>
<p>Some systems have <code>f95</code> as an IBM compiler that does not by
default accept FORTRAN 77. It needs the flag <samp>-qfixed=72</samp>, or to
be invoked as <code>xlf_r</code>.
</p>
<p>The AIX native <code>iconv</code> does not support encodings &lsquo;<samp>latin1</samp>&rsquo; nor
&lsquo;<samp>&quot;&quot;</samp>&rsquo; and so cannot be used. (As far as we know <acronym>GNU</acronym>
<code>libiconv</code> could be installed.)
</p>
<p>Fan Long reported success on AIX 5.3 using
</p>
<div class="example">
<pre class="example">OBJECT_MODE=64
LIBICONV=<var>/where/libiconv/installed</var>
CC=&quot;xlc_r -q64&quot;
CFLAGS=&quot;-O -qstrict&quot;
CXX=&quot;xlC_r -q64&quot;
CXXFLAGS=&quot;-O -qstrict&quot;
F77=&quot;xlf_r -q64&quot;
AR=&quot;ar -X64&quot;
CPPFLAGS=&quot;-I$LIBICONV/include -I/usr/lpp/X11/include/X11&quot;
LDFLAGS=&quot;-L$LIBICONV/lib -L/usr/lib -L/usr/X11R6/lib&quot;
</pre></div>
<a name="index-R_005fSHELL"></a>
<p>On one AIX 6.x system it was necessary to use <code>R_SHELL</code> to set the
default shell to be Bash rather than Zsh.
</p>
<p>Kurt Hornik and Stefan Theussl at WU (Wirtschaftsuniversit&auml;t Wien)
successfully built R on a &lsquo;<samp>powerpc</samp>&rsquo; (8-<acronym>CPU</acronym> Power6
system) running AIX 6.1, configuring with or without
<samp>--enable-R-shlib</samp> (Ei-ji Nakama&rsquo;s support is gratefully
acknowledged).
</p>
<p>It helps to describe the WU build environment first. A small part of
the software needed to build R and/or install packages is available
directly from the AIX Installation DVDs, e.g., Java 6 and X11.
Additional open source software (OSS) is packaged for AIX in <samp>.rpm</samp>
files and available from both IBM&rsquo;s &ldquo;AIX Toolbox for Linux
Applications&rdquo;
(<a href="http://www-03.ibm.com/systems/power/software/aix/linux/">http://www-03.ibm.com/systems/power/software/aix/linux/</a>) and
<a href="http://www.oss4aix.org/download/">http://www.oss4aix.org/download/</a>. The latter website typically
offers more recent versions of the available OSS. All tools needed and
libraries downloaded from these repositories (e.g., GCC, Make,
<code>libreadline</code>, etc.) are typically installed to
<samp>/opt/freeware</samp>, hence corresponding executables are found in
<a name="index-PATH-2"></a>
<samp>/opt/freeware/bin</samp> which thus needs to be in <code>PATH</code> for using
these tools. As on other Unix systems one needs <acronym>GNU</acronym>
<code>libiconv</code> as the AIX version of iconv is not sufficiently
powerful. Additionally, for proper Unicode compatibility one should
install the corresponding package from the ICU project
(<a href="http://www.icu-project.org/download/">http://www.icu-project.org/download/</a>), which offers pre-compiled
binaries for various platforms which in case of AIX can be installed via
unpacking the tarball to the root file system. For full LaTeX
support one can install the TeX Live DVD distribution
(<a href="https://www.tug.org/texlive/">https://www.tug.org/texlive/</a>): it is recommended to update the
distribution using the <code>tlmgr</code> update manager. For 64-bit R builds
supporting Tcl/Tk this needs to installed from the sources as available
pre-compiled binaries supply only 32-bit shared objects.
</p>
<p>The recent WU testing was done using compilers from both the
<acronym>GNU</acronym> Compiler Collection (version 4.2.4) which is available
from one of the above OSS repositories, and the IBM C/C++ (XL C/C++
10.01) as well as FORTRAN (XL Fortran 12.01) compilers
(<a href="http://www14.software.ibm.com/webapp/download/byproduct.jsp#X">http://www14.software.ibm.com/webapp/download/byproduct.jsp#X</a>).
</p>
<p>To compile for a 64-bit &lsquo;<samp>powerpc</samp>&rsquo; (Power6 <acronym>CPU</acronym>) target
one can use
</p>
<div class="example">
<pre class="example">CC =&quot;gcc -maix64 -pthread&quot;
CXX=&quot;g++ -maix64 -pthread&quot;
FC=&quot;gfortran -maix64 -pthread&quot;
F77=&quot;gfortran -maix64 -pthread&quot;
CFLAGS=&quot;-O2 -g -mcpu=power6&quot;
FFLAGS=&quot;-O2 -g -mcpu=power6&quot;
FCFLAGS=&quot;-O2 -g -mcpu=power6&quot;
</pre></div>
<p>for the GCC and
</p>
<div class="example">
<pre class="example">CC=xlc
CXX=xlc++
FC=xlf
F77=xlf
CFLAGS=&quot;-qarch=auto -qcache=auto -qtune=auto -O3 -qstrict -ma&quot;
FFLAGS=&quot;-qarch=auto -qcache=auto -qtune=auto -O3 -qstrict&quot;
FCFLAGS=&quot;-qarch=auto -qcache=auto -qtune=auto -O3 -qstrict&quot;
CXXFLAGS=&quot;-qarch=auto -qcache=auto -qtune=auto -O3 -qstrict&quot;
</pre></div>
<p>for the IBM XL compilers. For the latter, it is important to note that
the decision for generating 32-bit or 64-bit code is done by setting the
<a name="index-OBJECT_005fMODE"></a>
<code>OBJECT_MODE</code> environment variable appropriately (recommended) or
using an additional compiler flag (<samp>-q32</samp> or <samp>-q64</samp>). By
default the IBM XL compilers produce 32 bit code. Thus, to build R with
64-bit support one needs to either export <code>OBJECT_MODE=64</code> in the
environment or, alternatively, use the <samp>-q64</samp> compiler options.
</p>
<p>It is strongly recommended to install Bash and use it as the configure
shell, e.g., via setting <code>CONFIG_SHELL=/usr/bin/bash</code> in the
environment, and to use <acronym>GNU</acronym> Make (e.g., via
(<code>MAKE=/opt/freeware/bin/make</code>).
</p>
<p>Further installation instructions to set up a proper R development
environment can be found in the &ldquo;R on AIX&rdquo; project on R-Forge
(<a href="https://R-Forge.R-project.org/projects/aix/">https://R-Forge.R-project.org/projects/aix/</a>).
</p>
<hr>
<a name="FreeBSD"></a>
<div class="header">
<p>
Next: <a href="#Cygwin" accesskey="n" rel="next">Cygwin</a>, Previous: <a href="#AIX" accesskey="p" rel="prev">AIX</a>, Up: <a href="#Platform-notes" accesskey="u" rel="up">Platform notes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="FreeBSD-1"></a>
<h3 class="section">C.6 FreeBSD</h3>
<a name="index-FreeBSD"></a>
<p>There have been few recent reports on FreeBSD.
</p>
<p>There is a &lsquo;port&rsquo; at <a href="https://www.freebsd.org/ports/math.html">https://www.freebsd.org/ports/math.html</a>, for
R 3.0.2 at the time of writing. Davor Cubranic reported some success
on x86_64 FreeBSD 10.2 for R 3.2.2.
</p>
<p>It appears that versions of FreeBSD using <code>clang</code> as the compiler
(the default as from 10.0) need
</p><div class="example">
<pre class="example">MAIN_LDFLAGS=-Wl,--export-dynamic
</pre></div>
<p>for R releases up to 3.2.2.
</p>
<p>Use of ICU for collation and the <code>configure</code> option
<samp>--with-internal-tzcode</samp> are desirable workarounds.
</p>
<a name="OpenBSD"></a>
<h3 class="section">C.7 OpenBSD</h3>
<a name="index-OpenBSD"></a>
<p>Ingo Feinerer installed R version 3.2.2 on OpenBSD 5.8 arch
&lsquo;<samp>amd64</samp>&rsquo; (their name for &lsquo;<samp>x86_64</samp>&rsquo;). Details of the build
(and patches applied) are at
<a href="http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/math/R/">http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/math/R/</a>.
</p>
<hr>
<a name="Cygwin"></a>
<div class="header">
<p>
Next: <a href="#New-platforms" accesskey="n" rel="next">New platforms</a>, Previous: <a href="#FreeBSD" accesskey="p" rel="prev">FreeBSD</a>, Up: <a href="#Platform-notes" accesskey="u" rel="up">Platform notes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Cygwin-1"></a>
<h3 class="section">C.8 Cygwin</h3>
<p>The Cygwin emulation layer on Windows can be treated as a Unix-alike OS.
This is unsupported, but experiments have been conducted and a few
workarounds added. Cygwin has not been tested for R 3.0.0 or later.
</p>
<p>The 64-bit version is completely unsupported. The 32-bit version has
never worked well enough to pass R&rsquo;s <code>make check</code>.
</p>
<p>R requires C99 complex type support, which is available as from
Cygwin 1.7.8 (March 2011). However, the (then) implementation of
<code>cacos</code> gave incorrect results, so we undefine <code>HAVE_CACOS</code>
in <samp>src/main/complex.c</samp> on that platform. It has been reported
that some C99 long double mathematical functions are missing, so
configuring with <samp>--disable-long-double</samp> was required.
</p>
<p>Only building as a shared library can possibly work,<a name="DOCF60" href="#FOOT60"><sup>60</sup></a> so use e.g.
</p>
<div class="example">
<pre class="example">./configure --disable-nls --enable-R-shlib FLIBS=-lgfortran
make
</pre></div>
<p>Enabling NLS does work if required, although adding
<samp>--with-included-gettext</samp> is preferable. You will see many
warnings about the use of auto-import. Setting &lsquo;<samp>FLIBS</samp>&rsquo; explicitly
seems needed currently as the auto-detection gives an incorrect value.
</p>
<p>You will need the <strong>tetex-extra</strong> Cygwin package to build
<samp>NEWS.pdf</samp> and the vignettes.
</p>
<p>Note that this gives you a command-line application using <code>readline</code>
for command editing. The &lsquo;<samp>X11</samp>&rsquo; graphics device will work if a
suitable X server is running, and the standard Unix-alike ways of
installing source packages work. There was a bug in the
<samp>/usr/lib/tkConfig.sh</samp> script in the version we looked at, which
needs to have
</p>
<div class="example">
<pre class="example">TK_LIB_SPEC='-ltk84'
</pre></div>
<p>The overhead of using shell scripts makes this noticeably slower than a
native build of R on Windows.
</p>
<p>Even when R could be built, not all the tests passed: there were
incorrect results from wide-character regular expressions code and from
sourcing CR-delimited files.
</p>
<p>Do not use Cygwin&rsquo;s BLAS library: it is known to give incorrect results.
</p>
<hr>
<a name="New-platforms"></a>
<div class="header">
<p>
Previous: <a href="#Cygwin" accesskey="p" rel="prev">Cygwin</a>, Up: <a href="#Platform-notes" accesskey="u" rel="up">Platform notes</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="New-platforms-1"></a>
<h3 class="section">C.9 New platforms</h3>
<p>There are a number of sources of problems when installing R on a new
hardware/OS platform. These include
</p>
<p><strong>Floating Point Arithmetic</strong>: R requires arithmetic compliant
with <acronym>IEC</acronym>&nbsp;60559, also known as <acronym>IEEE</acronym>&nbsp;754.
This mandates the use of plus and minus infinity and <code>NaN</code> (not a
number) as well as specific details of rounding. Although almost all
current FPUs can support this, selecting such support can be a pain.
The problem is that there is no agreement on how to set the signalling
behaviour; Sun/Sparc, SGI/IRIX and &lsquo;<samp>ix86</samp>&rsquo; Linux require no
special action, FreeBSD requires a call to (the macro)
<code>fpsetmask(0)</code> and OSF1 required that computation be done with a
<samp>-ieee_with_inexact</samp> flag etc. On a new platform you must find
out the magic recipe and add some code to make it work. This can often
be done via the file <samp>config.site</samp> which resides in the top level
directory.
</p>
<p>Beware of using high levels of optimization, at least initially. On
many compilers these reduce the degree of compliance to the
<acronym>IEEE</acronym> model. For example, using <samp>-fast</samp> on the Solaris
Studio compilers has caused R&rsquo;s <code>NaN</code> to be set incorrectly, and
<code>gcc</code>&rsquo;s <samp>-ffast-math</samp> and <code>clang</code>&rsquo;s
<samp>-Ofast</samp> have given incorrect results.
</p>
<p><strong>Shared Objects</strong>: There seems to be very little agreement
across platforms on what needs to be done to build shared objects.
there are many different combinations of flags for the compilers and
loaders. <acronym>GNU</acronym> libtool cannot be used (yet), as it currently
does not fully support FORTRAN: one would need a shell wrapper for
this). The technique we use is to first interrogate the X window system
about what it does (using <code>xmkmf</code>), and then override this in
situations where we know better (for tools from the <acronym>GNU</acronym>
Compiler Collection and/or platforms we know about). This typically
works, but you may have to manually override the results. Scanning the
manual entries for <code>cc</code> and <code>ld</code> usually reveals the
correct incantation. Once you know the recipe you can modify the file
<samp>config.site</samp> (following the instructions therein) so that the
build will use these options.
</p>
<p>It seems that <code>gcc</code>&nbsp;3.4.x and later on &lsquo;<samp>ix86</samp>&rsquo; Linux
defeat attempts by the LAPACK code to avoid computations entirely in
extended-precision registers, so file <samp>src/modules/lapack/dlamc.f</samp>
may need to be compiled without optimization. Set the configure
variable <code>SAFE_FFLAGS</code> to the flags to be used for this file. If
configure detects <acronym>GNU</acronym> FORTRAN it adds flag
<samp>-ffloat-store</samp> to <code>FFLAGS</code>. (Other settings are needed when
using <code>icc</code> on &lsquo;<samp>ix86</samp>&rsquo; Linux, for example. Using
<samp>-mpc64</samp> is preferable on more recent GCC compilers.)
</p>
<p>If you do manage to get R running on a new platform please let us
know about it so we can modify the configuration procedures to include
that platform.
</p>
<p>If you are having trouble getting R to work on your platform please
feel free to use the &lsquo;<samp>R-devel</samp>&rsquo; mailing list to ask questions. We
have had a fair amount of practice at porting R to new platforms
<small class="enddots">...</small>
</p>
<hr>
<a name="The-Windows-toolset"></a>
<div class="header">
<p>
Next: <a href="#Function-and-variable-index" accesskey="n" rel="next">Function and variable index</a>, Previous: <a href="#Platform-notes" accesskey="p" rel="prev">Platform notes</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="The-Windows-toolset-1"></a>
<h2 class="appendix">Appendix D The Windows toolset</h2>
<p>If you want to build R or add-on packages from source in Windows, you
will need to collect, install and test an extensive set of tools. See
<a href="https://CRAN.R-project.org/bin/windows/Rtools/">https://CRAN.R-project.org/bin/windows/Rtools/</a> for the current
locations and other updates to these instructions. (Most Windows users
will not need to build add-on packages from source; see <a href="#Add_002don-packages">Add-on packages</a> for details.)
</p>
<p>We have found that the build process for R is quite sensitive to
the choice of tools: please follow our instructions <strong>exactly</strong>,
even to the choice of particular versions of the tools.<a name="DOCF61" href="#FOOT61"><sup>61</sup></a> The build process for add-on packages is somewhat more
forgiving, but we recommend using the exact toolset at first, and only
substituting other tools once you are familiar with the process.
</p>
<p><em>This appendix contains a lot of prescriptive comments. They are
here as a result of bitter experience. Please do not report problems to
the R mailing lists unless you have followed all the prescriptions.</em>
</p>
<p>We have collected most of the necessary tools (unfortunately not all,
due to license or size limitations) into an executable installer
named<a name="DOCF62" href="#FOOT62"><sup>62</sup></a> <samp>Rtools31.exe</samp>,
available from <a href="https://CRAN.R-project.org/bin/windows/Rtools/">https://CRAN.R-project.org/bin/windows/Rtools/</a>. You
should download and run it, choosing the default &ldquo;Package authoring
installation&rdquo; to build add-on packages, or the &ldquo;full installation&rdquo; if
you intend to build R.
</p>
<p>You will need the following items to build R and packages.
See the subsections below for detailed descriptions.
</p><ul>
<li> The command line tools (in <samp>Rtools*.exe</samp>)
</li><li> The MinGW-w64 32/64-bit toolchain to compile C, Fortran and C++.
</li></ul>
<p>For installing simple source packages containing data or R source but
no compiled code, none of these are needed.
</p>
<p>A complete build of R including PDF manuals, and producing the
installer will also need the following:
</p><ul>
<li> LaTeX
</li><li> The Inno Setup installer
</li><li> (optional) <code>qpdf</code>
</li></ul>
<a name="index-PATH-3"></a>
<p>It is important to set your <code>PATH</code> properly. The installer
<samp>Rtools*.exe</samp> optionally sets the path to components that it
installs.
</p>
<p>Your <code>PATH</code> may include <samp>.</samp> first, then the <samp>bin</samp>
directories of the tools, the compiler toolchain and LaTeX. Do not
use filepaths containing spaces: you can always use the short forms
(found by <code>dir /x</code> at the Windows command line). Network shares
(with paths starting <code>\\</code>) are not supported.
</p>
<p>For example for a 32-bit build, all on one line,
</p>
<div class="example">
<pre class="example">PATH=c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;c:\MiKTeX\miktex\bin;
c:\R\R-3.2\bin\i386;c:\windows;c:\windows\system32
</pre></div>
<p>It is essential that the directory containing the command line tools
comes first or second in the path: there are typically like-named
tools<a name="DOCF63" href="#FOOT63"><sup>63</sup></a> in other directories, and they will <strong>not</strong>
work. The ordering of the other directories is less important, but if in
doubt, use the order above.
</p>
<p>Our toolset contains copies of Cygwin DLLs that may conflict with other
ones on your system if both are in the path at once. The normal
recommendation is to delete the older ones; however, at one time we
found our tools did not work with a newer version of the Cygwin DLLs, so
it may be safest not to have any other version of the Cygwin DLLs in your
path.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#LaTeX" accesskey="1">LaTeX</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#The-Inno-Setup-installer" accesskey="2">The Inno Setup installer</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#The-command-line-tools" accesskey="3">The command line tools</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#The-MinGW_002dw64-toolchain" accesskey="4">The MinGW-w64 toolchain</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Useful-additional-programs" accesskey="5">Useful additional programs</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="LaTeX"></a>
<div class="header">
<p>
Next: <a href="#The-Inno-Setup-installer" accesskey="n" rel="next">The Inno Setup installer</a>, Previous: <a href="#The-Windows-toolset" accesskey="p" rel="prev">The Windows toolset</a>, Up: <a href="#The-Windows-toolset" accesskey="u" rel="up">The Windows toolset</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="LaTeX-1"></a>
<h3 class="section">D.1 LaTeX</h3>
<p>The &lsquo;<samp>MiKTeX</samp>&rsquo; (<a href="http://www.miktex.org/">http://www.miktex.org/</a>) distribution of
LaTeX includes a suitable port of <code>pdftex</code>. This can be set up
to install extra packages &lsquo;on the fly&rsquo;, which is the simplest way to use
it (and the default). The &lsquo;basic&rsquo; version of &lsquo;<samp>MiKTeX</samp>&rsquo; almost
suffices: when last checked packages
</p>
<div class="example">
<pre class="example">epsf inconsolata mptopdf url
</pre></div>
<p>needed to be added (on the fly or <em>via</em> the &lsquo;<samp>MiKTeX</samp>&rsquo; Package
Manager) to install R. In any case ensure that the <strong>inconsolata</strong>
package is installed&mdash;you can check with the &lsquo;<samp>MiKTeX</samp>&rsquo; Package
Manager.
</p>
<p>The <samp>Rtools*.exe</samp> installer does <em>not</em> include any version of
LaTeX.
</p>
<p>It is also possible to use the TeXLive distribution from
<a href="https://www.tug.org/texlive/">https://www.tug.org/texlive/</a>.
</p>
<a name="index-R_005fRD4PDF-2"></a>
<p>Please read <a href="#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 &lsquo;<samp>MiKTeX</samp>&rsquo; is set up to
install LaTeX packages on first use.
</p>
<hr>
<a name="The-Inno-Setup-installer"></a>
<div class="header">
<p>
Next: <a href="#The-command-line-tools" accesskey="n" rel="next">The command line tools</a>, Previous: <a href="#LaTeX" accesskey="p" rel="prev">LaTeX</a>, Up: <a href="#The-Windows-toolset" accesskey="u" rel="up">The Windows toolset</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="The-Inno-Setup-installer-1"></a>
<h3 class="section">D.2 The Inno Setup installer</h3>
<p>To make the installer package (<samp>R-3.2.3-win.exe</samp>) we
currently require the Unicode version of Inno Setup 5.3.7 or later from
<a href="http://jrsoftware.org/">http://jrsoftware.org/</a>. This is <em>not</em> included in
<samp>Rtools*.exe</samp>.
</p>
<p>Copy file <samp>src/gnuwin32/MkRules.dist</samp> to
<samp>src/gnuwin32/MkRules.local</samp> and edit it to set <code>ISDIR</code> to the
location where Inno Setup was installed.
</p>
<hr>
<a name="The-command-line-tools"></a>
<div class="header">
<p>
Next: <a href="#The-MinGW_002dw64-toolchain" accesskey="n" rel="next">The MinGW-w64 toolchain</a>, Previous: <a href="#The-Inno-Setup-installer" accesskey="p" rel="prev">The Inno Setup installer</a>, Up: <a href="#The-Windows-toolset" accesskey="u" rel="up">The Windows toolset</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="The-command-line-tools-1"></a>
<h3 class="section">D.3 The command line tools</h3>
<p>This item is installed by the <samp>Rtools*.exe</samp> installer.
</p>
<p>If you choose to install these yourself, you will need suitable versions
of at least <code>basename</code>, <code>cat</code>, <code>cmp</code>, <code>comm</code>,
<code>cp</code>, <code>cut</code>, <code>date</code>, <code>diff</code>, <code>du</code>, <code>echo</code>,
<code>expr</code>, <code>gzip</code>, <code>ls</code>, <code>make</code>, <code>makeinfo</code>,
<code>mkdir</code>, <code>mv</code>, <code>rm</code>, <code>rsync</code>, <code>sed</code>, <code>sh</code>,
<code>sort</code>, <code>tar</code>, <code>texindex</code>, <code>touch</code> and <code>uniq</code>;
we use those from the Cygwin distribution
(<a href="https://www.cygwin.com/">https://www.cygwin.com/</a>) or compiled from the sources. You will
also need <code>zip</code> and <code>unzip</code> from the Info-ZIP project
(<a href="http://www.info-zip.org/">http://www.info-zip.org/</a>). All of these tools are in
<samp>Rtools*.exe</samp>.
</p>
<p><strong>Beware</strong>: &lsquo;Native&rsquo; ports of make are <strong>not</strong> suitable
(including those called &lsquo;MinGW make&rsquo; at the MinGW SourceForge site and
<code>mingw32-make</code> in some MinGW-w64 distributions). There were
also problems with other versions of the Cygwin tools and DLLs. To
avoid frustration, please use our tool set, and make sure it is at the
front of your path (including before the Windows system directories).
If you are using a Windows shell, type <code>PATH</code> at the prompt to find
out.
</p>
<a name="index-CYGWIN"></a>
<p>You may need to set the environment variable <code>CYGWIN</code> to a value
including &lsquo;<samp>nodosfilewarning</samp>&rsquo; to suppress messages about
Windows-style paths.
</p>
<hr>
<a name="The-MinGW_002dw64-toolchain"></a>
<div class="header">
<p>
Next: <a href="#Useful-additional-programs" accesskey="n" rel="next">Useful additional programs</a>, Previous: <a href="#The-command-line-tools" accesskey="p" rel="prev">The command line tools</a>, Up: <a href="#The-Windows-toolset" accesskey="u" rel="up">The Windows toolset</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="The-MinGW_002dw64-toolchain-1"></a>
<h3 class="section">D.4 The MinGW-w64 toolchain</h3>
<p>Technically you need more than just a compiler so the set of tools is
referred to as a &lsquo;toolchain&rsquo;.
</p>
<p>The preferred toolchain is part of <code>Rtools31.exe</code>: this uses a beta
version of <code>gcc 4.6.3</code> and version 2.0.1 of the MinGW-w64
project&rsquo;s runtime.
</p>
<p>This toolchain uses <em>multilib</em>: that is there is a single front-end
such as <code>gcc.exe</code> for each of the compilers and 32-bit (the
default) and 64-bit compilation are selected by the flags<a name="DOCF64" href="#FOOT64"><sup>64</sup></a> <samp>-m32</samp> and <samp>-m64</samp>
respectively. The tools are all 32-bit Windows executables and should
be able to run on any current version of Windows&mdash;however you do need a
64-bit version of Windows to build 64-bit R as the build process runs
R.
</p>
<p>To select a 32-bit or 64-bit build of R, set the options in
<samp>MkRules.local</samp> appropriately (following the comments in the file).
</p>
<p>Some external software libraries will need to be re-compiled under the
new toolchain: especially those providing a C++ interface. Many of
those used by <acronym>CRAN</acronym> packages are available from
<a href="https://www.stats.ox.ac.uk/pub/Rtools/multilib/">https://www.stats.ox.ac.uk/pub/Rtools/multilib/</a>. Users
developing packages with <a href="https://CRAN.R-project.org/package=Rcpp"><strong>Rcpp</strong></a> need to ensure that they use a
version built with exactly the same toolchain as their package: the
recommendation is to build <a href="https://CRAN.R-project.org/package=Rcpp"><strong>Rcpp</strong></a> from its sources yourself.
</p>
<p>There is support for OpenMP and pthreads in this toolchain. As the
performance of OpenMP on Windows is poor for small tasks, it is not used
for R itself.
</p>
<hr>
<a name="Useful-additional-programs"></a>
<div class="header">
<p>
Previous: <a href="#The-MinGW_002dw64-toolchain" accesskey="p" rel="prev">The MinGW-w64 toolchain</a>, Up: <a href="#The-Windows-toolset" accesskey="u" rel="up">The Windows toolset</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Useful-additional-programs-1"></a>
<h3 class="section">D.5 Useful additional programs</h3>
<p>The process of making the installer will make use of <code>qpdf</code> to
compact some of the package vignettes, if it is available. Windows
binaries of <code>qpdf</code> are available from
<a href="http://sourceforge.net/projects/qpdf/files/">http://sourceforge.net/projects/qpdf/files/</a>. Set the path
to the <code>qpdf</code> installation in file <samp>MkRules.local</samp>.
</p>
<p>Developers of packages will find some of the &lsquo;goodies&rsquo; at
<a href="https://www.stats.ox.ac.uk/pub/Rtools/goodies">https://www.stats.ox.ac.uk/pub/Rtools/goodies</a> useful.
</p>
<p>There is a version of the <code>file</code> command that identifies the
type of files, and is used by <code>Rcmd check</code> if available. The
binary distribution is included in <samp>Rtools31.exe</samp>.
</p>
<p>The file <samp>xzutils.zip</samp> contains the program <code>xz</code> which can
be used to (de)compress files with that form of compression.
</p>
<hr>
<a name="Function-and-variable-index"></a>
<div class="header">
<p>
Next: <a href="#Concept-index" accesskey="n" rel="next">Concept index</a>, Previous: <a href="#The-Windows-toolset" accesskey="p" rel="prev">The Windows toolset</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Function-and-variable-index-1"></a>
<h2 class="unnumbered">Function and variable index</h2>
<table summary=""><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Function-and-variable-index_vr_letter-C"><b>C</b></a>
&nbsp;
<a class="summary-letter" href="#Function-and-variable-index_vr_letter-I"><b>I</b></a>
&nbsp;
<a class="summary-letter" href="#Function-and-variable-index_vr_letter-M"><b>M</b></a>
&nbsp;
<a class="summary-letter" href="#Function-and-variable-index_vr_letter-R"><b>R</b></a>
&nbsp;
<a class="summary-letter" href="#Function-and-variable-index_vr_letter-U"><b>U</b></a>
&nbsp;
</td></tr></table>
<table summary="" class="index-vr" border="0">
<tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-and-variable-index_vr_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-configure"><code>configure</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Simple-compilation">Simple compilation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-configure-1"><code>configure</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Simple-compilation">Simple compilation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-configure-2"><code>configure</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installation">Installation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-configure-3"><code>configure</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installation">Installation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-configure-4"><code>configure</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Configuration-variables">Configuration variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-configure-5"><code>configure</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using-make">Using make</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-and-variable-index_vr_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-install_002epackages"><code>install.packages</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installing-packages">Installing packages</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-and-variable-index_vr_letter-M">M</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-make"><code>make</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using-make">Using make</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-and-variable-index_vr_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-remove_002epackages"><code>remove.packages</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Removing-packages">Removing packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fHOME"><code>R_HOME</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Simple-compilation">Simple compilation</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-and-variable-index_vr_letter-U">U</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-update_002epackages"><code>update.packages</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Updating-packages">Updating packages</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
<table summary=""><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Function-and-variable-index_vr_letter-C"><b>C</b></a>
&nbsp;
<a class="summary-letter" href="#Function-and-variable-index_vr_letter-I"><b>I</b></a>
&nbsp;
<a class="summary-letter" href="#Function-and-variable-index_vr_letter-M"><b>M</b></a>
&nbsp;
<a class="summary-letter" href="#Function-and-variable-index_vr_letter-R"><b>R</b></a>
&nbsp;
<a class="summary-letter" href="#Function-and-variable-index_vr_letter-U"><b>U</b></a>
&nbsp;
</td></tr></table>
<hr>
<a name="Concept-index"></a>
<div class="header">
<p>
Next: <a href="#Environment-variable-index" accesskey="n" rel="next">Environment variable index</a>, Previous: <a href="#Function-and-variable-index" accesskey="p" rel="prev">Function and variable index</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Concept-index-1"></a>
<h2 class="unnumbered">Concept index</h2>
<table summary=""><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Concept-index_cp_letter-A"><b>A</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-B"><b>B</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-F"><b>F</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-I"><b>I</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-L"><b>L</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-M"><b>M</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-O"><b>O</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-P"><b>P</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-R"><b>R</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-S"><b>S</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-U"><b>U</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-V"><b>V</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-W"><b>W</b></a>
&nbsp;
</td></tr></table>
<table summary="" class="index-cp" border="0">
<tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-A">A</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-AIX">AIX</a>:</td><td>&nbsp;</td><td valign="top"><a href="#AIX">AIX</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-B">B</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-BLAS-library">BLAS library</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Linear-algebra">Linear algebra</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-BLAS-library-1">BLAS library</a>:</td><td>&nbsp;</td><td valign="top"><a href="#OS-X">OS X</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-BLAS-library-2">BLAS library</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Solaris">Solaris</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-F">F</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-FORTRAN">FORTRAN</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using-FORTRAN">Using FORTRAN</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-FreeBSD">FreeBSD</a>:</td><td>&nbsp;</td><td valign="top"><a href="#FreeBSD">FreeBSD</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Installation">Installation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installation">Installation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Installing-under-Unix_002dalikes">Installing under Unix-alikes</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Installing-under-Windows">Installing under Windows</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installing-R-under-Windows">Installing R under Windows</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Internationalization">Internationalization</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Internationalization">Internationalization</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-LAPACK-library">LAPACK library</a>:</td><td>&nbsp;</td><td valign="top"><a href="#LAPACK">LAPACK</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LAPACK-library-1">LAPACK library</a>:</td><td>&nbsp;</td><td valign="top"><a href="#OS-X">OS X</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LAPACK-library-2">LAPACK library</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Solaris">Solaris</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Libraries">Libraries</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Add_002don-packages">Add-on packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Libraries_002c-managing">Libraries, managing</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Managing-libraries">Managing libraries</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Libraries_002c-site">Libraries, site</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Managing-libraries">Managing libraries</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Libraries_002c-user">Libraries, user</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Managing-libraries">Managing libraries</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Linux">Linux</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Linux-1">Linux</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Linux">Linux</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Locale">Locale</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Internationalization">Internationalization</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Locale-1">Locale</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Locales">Locales</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Localization">Localization</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Internationalization">Internationalization</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-M">M</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Manuals">Manuals</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Making-the-manuals">Making the manuals</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Manuals_002c-installing">Manuals, installing</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installation">Installation</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-O">O</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Obtaining-R">Obtaining R</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obtaining-R">Obtaining R</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-OpenBSD">OpenBSD</a>:</td><td>&nbsp;</td><td valign="top"><a href="#FreeBSD">FreeBSD</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-OS-X">OS X</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-OS-X-1">OS X</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installing-R-under-OS-X">Installing R under OS X</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-OS-X-2">OS X</a>:</td><td>&nbsp;</td><td valign="top"><a href="#OS-X">OS X</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Packages">Packages</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Add_002don-packages">Add-on packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Packages_002c-default">Packages, default</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Default-packages">Default packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Packages_002c-installing">Packages, installing</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installing-packages">Installing packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Packages_002c-removing">Packages, removing</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Removing-packages">Removing packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Packages_002c-updating">Packages, updating</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Updating-packages">Updating packages</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Repositories">Repositories</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Setting-up-a-package-repository">Setting up a package repository</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-S">S</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Site-libraries">Site libraries</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Managing-libraries">Managing libraries</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Solaris">Solaris</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Solaris">Solaris</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Sources-for-R">Sources for R</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Getting-and-unpacking-the-sources">Getting and unpacking the sources</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Subversion">Subversion</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using-Subversion-and-rsync">Using Subversion and rsync</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Subversion-1">Subversion</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Essential-programs-and-libraries">Essential programs and libraries</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-U">U</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-User-libraries">User libraries</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Managing-libraries">Managing libraries</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-V">V</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Vignettes">Vignettes</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Essential-programs-and-libraries">Essential programs and libraries</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-index_cp_letter-W">W</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-winCairo_002edll">winCairo.dll</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Building-the-cairo-devices-files">Building the cairo devices files</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
<table summary=""><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Concept-index_cp_letter-A"><b>A</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-B"><b>B</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-F"><b>F</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-I"><b>I</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-L"><b>L</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-M"><b>M</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-O"><b>O</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-P"><b>P</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-R"><b>R</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-S"><b>S</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-U"><b>U</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-V"><b>V</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-index_cp_letter-W"><b>W</b></a>
&nbsp;
</td></tr></table>
<hr>
<a name="Environment-variable-index"></a>
<div class="header">
<p>
Previous: <a href="#Concept-index" accesskey="p" rel="prev">Concept index</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-variable-index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Environment-variable-index-1"></a>
<h2 class="unnumbered">Environment variable index</h2>
<table summary=""><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Environment-variable-index_en_letter-B"><b>B</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-C"><b>C</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-D"><b>D</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-F"><b>F</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-J"><b>J</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-L"><b>L</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-O"><b>O</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-P"><b>P</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-R"><b>R</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-T"><b>T</b></a>
&nbsp;
</td></tr></table>
<table summary="" class="index-en" border="0">
<tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Environment-variable-index_en_letter-B">B</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-BLAS_005fLIBS"><code>BLAS_LIBS</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#BLAS">BLAS</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Environment-variable-index_en_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-CC"><code>CC</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using-FORTRAN">Using FORTRAN</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-CONFIG_005fSITE"><code>CONFIG_SITE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Configuration-variables">Configuration variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-CPP"><code>CPP</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using-FORTRAN">Using FORTRAN</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-CYGWIN"><code>CYGWIN</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-command-line-tools">The command line tools</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Environment-variable-index_en_letter-D">D</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-DESTDIR"><code>DESTDIR</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installation">Installation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-DESTDIR-1"><code>DESTDIR</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unix_002dalike-standalone">Unix-alike standalone</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Environment-variable-index_en_letter-F">F</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-F2C"><code>F2C</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using-FORTRAN">Using FORTRAN</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-F2CLIBS"><code>F2CLIBS</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using-FORTRAN">Using FORTRAN</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-FPICFLAGS"><code>FPICFLAGS</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using-FORTRAN">Using FORTRAN</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Environment-variable-index_en_letter-J">J</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-JAVA_005fHOME"><code>JAVA_HOME</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Java-support">Java support</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Environment-variable-index_en_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-LANG"><code>LANG</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Localization-of-messages">Localization of messages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LANGUAGE"><code>LANGUAGE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Localization-of-messages">Localization of messages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LANGUAGE-1"><code>LANGUAGE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Localization-of-messages">Localization of messages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LAPACK_005fLIBS"><code>LAPACK_LIBS</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#LAPACK">LAPACK</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LC_005fALL"><code>LC_ALL</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Localization-of-messages">Localization of messages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LC_005fCOLLATE"><code>LC_COLLATE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Testing-a-Unix_002dalike-Installation">Testing a Unix-alike Installation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LC_005fMESSAGES"><code>LC_MESSAGES</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Localization-of-messages">Localization of messages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LD_005fLIBRARY_005fPATH"><code>LD_LIBRARY_PATH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unix_002dalike-standalone">Unix-alike standalone</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LD_005fLIBRARY_005fPATH-1"><code>LD_LIBRARY_PATH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#ACML">ACML</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LD_005fLIBRARY_005fPATH-2"><code>LD_LIBRARY_PATH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using-FORTRAN">Using FORTRAN</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LD_005fLIBRARY_005fPATH-3"><code>LD_LIBRARY_PATH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Compile-and-load-flags">Compile and load flags</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LD_005fLIBRARY_005fPATH-4"><code>LD_LIBRARY_PATH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using-gcc">Using gcc</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LOCAL_005fSOFT"><code>LOCAL_SOFT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Windows-packages">Windows packages</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Environment-variable-index_en_letter-O">O</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-OBJECT_005fMODE"><code>OBJECT_MODE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#AIX">AIX</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Environment-variable-index_en_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-PAPERSIZE"><code>PAPERSIZE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Setting-paper-size">Setting paper size</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PATH"><code>PATH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Essential-programs-and-libraries">Essential programs and libraries</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PATH-1"><code>PATH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using-FORTRAN">Using FORTRAN</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PATH-2"><code>PATH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#AIX">AIX</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PATH-3"><code>PATH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-Windows-toolset">The Windows toolset</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Environment-variable-index_en_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fARCH"><code>R_ARCH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Sub_002darchitectures">Sub-architectures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fARCH-1"><code>R_ARCH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Sub_002darchitectures">Sub-architectures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fBROWSER"><code>R_BROWSER</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Setting-the-browsers">Setting the browsers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fDEFAULT_005fPACKAGES"><code>R_DEFAULT_PACKAGES</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Default-packages">Default packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fDISABLE_005fHTTPD"><code>R_DISABLE_HTTPD</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Help-options">Help options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fGSCMD"><code>R_GSCMD</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Useful-libraries-and-programs">Useful libraries and programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fINSTALL_005fTAR"><code>R_INSTALL_TAR</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Windows-packages">Windows packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fJAVA_005fLD_005fLIBRARY_005fPATH"><code>R_JAVA_LD_LIBRARY_PATH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Java-support">Java support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fJAVA_005fLD_005fLIBRARY_005fPATH-1"><code>R_JAVA_LD_LIBRARY_PATH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Java-support">Java support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fLIBS"><code>R_LIBS</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Add_002don-packages">Add-on packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fLIBS_005fSITE"><code>R_LIBS_SITE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Managing-libraries">Managing libraries</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fLIBS_005fUSER"><code>R_LIBS_USER</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Managing-libraries">Managing libraries</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fPAPERSIZE"><code>R_PAPERSIZE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Making-the-manuals">Making the manuals</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fPAPERSIZE-1"><code>R_PAPERSIZE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-R">Running R</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fPAPERSIZE-2"><code>R_PAPERSIZE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Setting-paper-size">Setting paper size</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fPAPERSIZE-3"><code>R_PAPERSIZE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Making-manuals">Making manuals</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fPDFVIEWER"><code>R_PDFVIEWER</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Setting-the-browsers">Setting the browsers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fRD4PDF"><code>R_RD4PDF</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Making-the-manuals">Making the manuals</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fRD4PDF-1"><code>R_RD4PDF</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Making-manuals">Making manuals</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fRD4PDF-2"><code>R_RD4PDF</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#LaTeX">LaTeX</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fSHELL"><code>R_SHELL</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#AIX">AIX</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-R_005fUSER"><code>R_USER</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-R">Running R</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Environment-variable-index_en_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-TAR"><code>TAR</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Essential-programs-and-libraries">Essential programs and libraries</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-TAR_005fOPTIONS"><code>TAR_OPTIONS</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Getting-and-unpacking-the-sources">Getting and unpacking the sources</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-TAR_005fOPTIONS-1"><code>TAR_OPTIONS</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Getting-the-source-files">Getting the source files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-TEMP"><code>TEMP</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-R">Running R</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-TMP"><code>TMP</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-R">Running R</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-TMPDIR"><code>TMPDIR</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Simple-compilation">Simple compilation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-TMPDIR-1"><code>TMPDIR</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Building-the-core-files">Building the core files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-TMPDIR-2"><code>TMPDIR</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-R">Running R</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-TMPDIR-3"><code>TMPDIR</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-R">Running R</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-TMPDIR-4"><code>TMPDIR</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Installing-packages">Installing packages</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
<table summary=""><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Environment-variable-index_en_letter-B"><b>B</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-C"><b>C</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-D"><b>D</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-F"><b>F</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-J"><b>J</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-L"><b>L</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-O"><b>O</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-P"><b>P</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-R"><b>R</b></a>
&nbsp;
<a class="summary-letter" href="#Environment-variable-index_en_letter-T"><b>T</b></a>
&nbsp;
</td></tr></table>
<div class="footnote">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>
<h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
<p>e.g. <acronym>GNU</acronym>
<code>tar</code> version 1.15 or later, or that from the &lsquo;<samp>libarchive</samp>&rsquo;
(as used on OS X versions 10.6 and later) or &lsquo;Heirloom Toolchest&rsquo;
distributions.</p>
<h3><a name="FOOT2" href="#DOCF2">(2)</a></h3>
<p>for some Subversion clients
&lsquo;<samp>http:</samp>&rsquo; may appear to work, but requires continual redirection.</p>
<h3><a name="FOOT3" href="#DOCF3">(3)</a></h3>
<p>Most aspects will work with
paths containing spaces, but external software used by R, e.g.
<code>texi2dvi</code> version <code>4.8</code>, may not.</p>
<h3><a name="FOOT4" href="#DOCF4">(4)</a></h3>
<p>which use <samp>lib</samp> rather than
<samp>lib64</samp> for their primary 64-bit library directories.</p>
<h3><a name="FOOT5" href="#DOCF5">(5)</a></h3>
<p>Instructions on how to install the latest
version are at
<a href="https://www.ctan.org/tex-archive/fonts/inconsolata/">https://www.ctan.org/tex-archive/fonts/inconsolata/</a>.</p>
<h3><a name="FOOT6" href="#DOCF6">(6)</a></h3>
<p>on a
Unix-alike, &lsquo;<samp>inconsolata</samp>&rsquo; is omitted if not found by
<code>configure</code>.</p>
<h3><a name="FOOT7" href="#DOCF7">(7)</a></h3>
<p>This will be needed if more than one
sub-architecture is to be installed.</p>
<h3><a name="FOOT8" href="#DOCF8">(8)</a></h3>
<p>with possible values
&lsquo;<samp>i386</samp>&rsquo;, &lsquo;<samp>x64</samp>&rsquo;, &lsquo;<samp>32</samp>&rsquo; and &lsquo;<samp>64</samp>&rsquo;.</p>
<h3><a name="FOOT9" href="#DOCF9">(9)</a></h3>
<p>mainly on RedHat and Fedora, whose layout is described
here.</p>
<h3><a name="FOOT10" href="#DOCF10">(10)</a></h3>
<p>How to prepare such a directory is described in file
<samp>src/extra/tzone/Notes</samp> in the R sources.</p>
<h3><a name="FOOT11" href="#DOCF11">(11)</a></h3>
<p>for example, <samp>-fopenmp</samp>, <samp>-xopenmp</samp> or
<samp>-qopenmp</samp>. This includes for 2015 versions of <code>clang</code>
and the Intel C compiler.</p>
<h3><a name="FOOT12" href="#DOCF12">(12)</a></h3>
<p>Suitable distributions include
Strawberry Perl, <a href="http://strawberryperl.com/">http://strawberryperl.com/</a> and ActivePerl,
<a href="https://www.activestate.com/activeperl">https://www.activestate.com/activeperl</a>.</p>
<h3><a name="FOOT13" href="#DOCF13">(13)</a></h3>
<p>for R 3.2.1 and earlier, the installer will
attempt unsuccessfully to install <code>R</code> and <code>Rscript</code> in
<samp>/usr/bin</samp>.</p>
<h3><a name="FOOT14" href="#DOCF14">(14)</a></h3>
<p>There was for R 3.2.1 but not for R 3.2.2.</p>
<h3><a name="FOOT15" href="#DOCF15">(15)</a></h3>
<p>The installer as
from R 3.2.2 puts links to <code>R</code> and <code>Rscript</code> in
<samp>/usr/bin</samp> (Mavericks, Yosemite) or <samp>/usr/local/bin</samp> (El
Capitan and later). If these are missing, you can run directly the
versions in <samp>/Library/Frameworks/R.framework/Resources/</samp>.</p>
<h3><a name="FOOT16" href="#DOCF16">(16)</a></h3>
<p>unless they were excluded in the build.</p>
<h3><a name="FOOT17" href="#DOCF17">(17)</a></h3>
<p>its binding is locked once the startup files have been
read, so users cannot easily change it.</p>
<h3><a name="FOOT18" href="#DOCF18">(18)</a></h3>
<p>If a proxy needs to be set, see
<code>?download.file</code>.</p>
<h3><a name="FOOT19" href="#DOCF19">(19)</a></h3>
<p>for a small number of
<acronym>CRAN</acronym> packages where this is known to be safe and is needed by
the autobuilder this is the default. Look at the source of
<samp>tools:::.install_packages</samp> for the list. It can also be specified
in the package&rsquo;s <samp>DESCRIPTION</samp> file.</p>
<h3><a name="FOOT20" href="#DOCF20">(20)</a></h3>
<p>or by adding it in
a file such as <samp>etc/i386/Makevars.site</samp>, which does not exist by
default.</p>
<h3><a name="FOOT21" href="#DOCF21">(21)</a></h3>
<p>&lsquo;X/Open Portability Guide&rsquo;, which has
had several versions.</p>
<h3><a name="FOOT22" href="#DOCF22">(22)</a></h3>
<p>On some systems setting
<code>LC_ALL</code> or <code>LC_MESSAGES</code> to &lsquo;<samp>C</samp>&rsquo; disables <code>LANGUAGE</code>.</p>
<h3><a name="FOOT23" href="#DOCF23">(23)</a></h3>
<p>If you try changing from French
to Russian except in a UTF-8 locale, you will most likely find messages
change to English.</p>
<h3><a name="FOOT24" href="#DOCF24">(24)</a></h3>
<p>the
language written in England: some people living in the USA appropriate
this name for their language.</p>
<h3><a name="FOOT25" href="#DOCF25">(25)</a></h3>
<p>with
Americanisms.</p>
<h3><a name="FOOT26" href="#DOCF26">(26)</a></h3>
<p>also known as
<acronym>IEEE</acronym>&nbsp;754</p>
<h3><a name="FOOT27" href="#DOCF27">(27)</a></h3>
<p>at least when storing quantities: the on-FPU
precision is allowed to vary</p>
<h3><a name="FOOT28" href="#DOCF28">(28)</a></h3>
<p>e.g. Bessel, beta and gamma functions</p>
<h3><a name="FOOT29" href="#DOCF29">(29)</a></h3>
<p>including copying <samp>MkRules.dist</samp> to
<samp>MkRule.local</samp> and selecting the architecture.</p>
<h3><a name="FOOT30" href="#DOCF30">(30)</a></h3>
<p>also known as
<acronym>IEEE</acronym>&nbsp;754</p>
<h3><a name="FOOT31" href="#DOCF31">(31)</a></h3>
<p>Note
that C11 compilers need not be C99-compliant: R requires support for
<code>double complex</code> and variable-length arrays which are optional in
C11 but is mandatory in C99.</p>
<h3><a name="FOOT32" href="#DOCF32">(32)</a></h3>
<p><samp>-std=c99</samp> excludes POSIX
functionality, but <samp>config.h</samp> will turn on all <acronym>GNU</acronym>
extensions to include the POSIX functionality. The default mode for GCC
5 is <samp>-std=gnu11</samp>.</p>
<h3><a name="FOOT33" href="#DOCF33">(33)</a></h3>
<p>However, it is possible to break
the default behaviour of <code>glibc</code> by re-specifying the <code>gconv</code>
modules to be loaded.</p>
<h3><a name="FOOT34" href="#DOCF34">(34)</a></h3>
<p>specifically, the C99
functionality of headers <samp>wchar.h</samp> and <samp>wctype.h</samp>, types
<code>wctans_t</code> and <code>mbstate_t</code> and functions <code>mbrtowc</code>,
<code>mbstowcs</code>, <code>wcrtomb</code>, <code>wcscoll</code>, <code>wcstombs</code>,
<code>wctrans</code>, <code>wctype</code>, and <code>iswctype</code>.</p>
<h3><a name="FOOT35" href="#DOCF35">(35)</a></h3>
<p>including the <code>opendir</code>, <code>readdir</code>,
<code>closedir</code>, <code>popen</code>, <code>stat</code>, <code>glob</code>, <code>access</code>,
<code>getcwd</code> and <code>chdir</code> system calls, and either <code>putenv</code> or
<code>setenv</code>.</p>
<h3><a name="FOOT36" href="#DOCF36">(36)</a></h3>
<p>such as
<code>realpath</code>, <code>symlink</code>.</p>
<h3><a name="FOOT37" href="#DOCF37">(37)</a></h3>
<p>Such as
<acronym>GNU</acronym> <code>tar</code> 1.15 or later, <code>bsdtar</code> (from
<a href="https://github.com/libarchive/libarchive/">https://github.com/libarchive/libarchive/</a>, as used by FreeBSD and OS
X 10.6 and later) or <code>tar</code> from the Heirloom Toolchest
(<a href="http://heirloom.sourceforge.net/tools.html">http://heirloom.sourceforge.net/tools.html</a>).</p>
<h3><a name="FOOT38" href="#DOCF38">(38)</a></h3>
<p><code>texi2dvi</code> is normally a shell
script. Some versions (including that from <strong>texinfo</strong> 5.2 and 6.0)
need to be run under <code>bash</code> rather than a Bourne shell.</p>
<h3><a name="FOOT39" href="#DOCF39">(39)</a></h3>
<p>If necessary the path to
<code>pkg-config</code> can be specified by setting <code>PKGCONF</code> in
<samp>config.site</samp>, on the <code>configure</code> command line or in the
environment.</p>
<h3><a name="FOOT40" href="#DOCF40">(40)</a></h3>
<p>also known as <code>ttf-mscorefonts-installer</code> in the
Debian/Ubuntu world: see also
<a href="https://en.wikipedia.org/wiki/Core_fonts_for_the_Web">https://en.wikipedia.org/wiki/Core_fonts_for_the_Web</a>.</p>
<h3><a name="FOOT41" href="#DOCF41">(41)</a></h3>
<p><code>ttf-liberation</code>
in Debian/Ubuntu.</p>
<h3><a name="FOOT42" href="#DOCF42">(42)</a></h3>
<p>sometimes known as PCRE1, and not PCRE2, which
started at version 10.0. 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>.</p>
<h3><a name="FOOT43" href="#DOCF43">(43)</a></h3>
<p>for example to specify
static linking with a build which has both shared and static libraries.</p>
<h3><a name="FOOT44" href="#DOCF44">(44)</a></h3>
<p>This is true even for
the &lsquo;Aqua&rsquo; version of Tk on OS X, but distributions of that include a
copy of the X11 files needed.</p>
<h3><a name="FOOT45" href="#DOCF45">(45)</a></h3>
<p>Using the Oracle Solaris Studio
<code>cc</code> and <code>f95</code> compilers</p>
<h3><a name="FOOT46" href="#DOCF46">(46)</a></h3>
<p>and &lsquo;<samp>i686</samp>&rsquo; for earlier
versions.</p>
<h3><a name="FOOT47" href="#DOCF47">(47)</a></h3>
<p>We have measured 15&ndash;20% on &lsquo;<samp>i686</samp>&rsquo; Linux
and around 10% on &lsquo;<samp>x86_64</samp>&rsquo; Linux.</p>
<h3><a name="FOOT48" href="#DOCF48">(48)</a></h3>
<p>On HP-UX <code>fort77</code> is the
<acronym>POSIX</acronym> compliant FORTRAN compiler, and comes after
<code>g77</code>.</p>
<h3><a name="FOOT49" href="#DOCF49">(49)</a></h3>
<p>as well as its equivalence to the <code>Rcomplex</code>
structure defined in <samp>R_ext/Complex.h</samp>.</p>
<h3><a name="FOOT50" href="#DOCF50">(50)</a></h3>
<p>for example, <code>X11 font at size 14 could not
be loaded</code>.</p>
<h3><a name="FOOT51" href="#DOCF51">(51)</a></h3>
<p>or <code>-mtune=corei7</code> for Intel Core
i3/15/17 with <code>gcc &gt;= 4.6.0</code>.</p>
<h3><a name="FOOT52" href="#DOCF52">(52)</a></h3>
<p>This also needs the OpenMP runtime,
which is usually distributed separately, e.g. at
<a href="http://llvm.org/releases">http://llvm.org/releases</a>.</p>
<h3><a name="FOOT53" href="#DOCF53">(53)</a></h3>
<p>These
days that is defined by Apple&rsquo;s implementation of <code>clang</code>, so it is
strongly recommended to use that.</p>
<h3><a name="FOOT54" href="#DOCF54">(54)</a></h3>
<p>This
is a tarball which needs to be unpacked in the Terminal by e.g.
<code>sudo tar -zxf gfortran-4.8.2-darwin13.tar.bz2 -C /</code>. It does
not run on Core 2 Duo Macs.</p>
<h3><a name="FOOT55" href="#DOCF55">(55)</a></h3>
<p>This also needs the OpenMP runtime,
which is distributed separately at that site.</p>
<h3><a name="FOOT56" href="#DOCF56">(56)</a></h3>
<p>It is reported that for some non-Apple toolchains
<code>CPPFLAGS</code> needed to contain <code>-D__ACCELERATE__</code>.</p>
<h3><a name="FOOT57" href="#DOCF57">(57)</a></h3>
<p>For more
details see <a href="http://www.macstrategy.com/article.php?3">http://www.macstrategy.com/article.php?3</a>.</p>
<h3><a name="FOOT58" href="#DOCF58">(58)</a></h3>
<p>e.g.
<code>Java For OS X 2015-001</code> from
<a href="https://support.apple.com/kb/DL1572">https://support.apple.com/kb/DL1572</a>.</p>
<h3><a name="FOOT59" href="#DOCF59">(59)</a></h3>
<p>including <code>gcc</code> for
Sparc from Oracle.</p>
<h3><a name="FOOT60" href="#DOCF60">(60)</a></h3>
<p>Windows
DLLs need to have all links resolved at build time and so cannot resolve
against <samp>R.bin</samp>.</p>
<h3><a name="FOOT61" href="#DOCF61">(61)</a></h3>
<p>For
example, the Cygwin version of <code>make 3.81</code> fails to work
correctly.</p>
<h3><a name="FOOT62" href="#DOCF62">(62)</a></h3>
<p>for R 3.0.0 and later.</p>
<h3><a name="FOOT63" href="#DOCF63">(63)</a></h3>
<p>such as <code>sort</code>, <code>find</code> and perhaps
<code>make</code>.</p>
<h3><a name="FOOT64" href="#DOCF64">(64)</a></h3>
<p>these
flags apply to the compilers: some of the tools use different flags.
32-bit builds are the default.</p>
</div>
<hr>
</body>
</html>