<html lang="en"> <head> <title>R Installation and Administration</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="description" content="R Installation and Administration"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="top" href="#Top"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This manual is for R, version 3.0.2 (2013-09-25). Copyright (C) 2001-2013 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. --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } 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> <h1 class="settitle">R Installation and Administration</h1> <div class="contents"> <h2>Table of Contents</h2> <ul> <li><a name="toc_Top" href="#Top">R Installation and Administration</a> <li><a name="toc_Obtaining-R" href="#Obtaining-R">1 Obtaining R</a> <ul> <li><a href="#Getting-and-unpacking-the-sources">1.1 Getting and unpacking the sources</a> <li><a href="#Getting-patched-and-development-versions">1.2 Getting patched and development versions</a> <ul> <li><a href="#Using-Subversion-and-rsync">1.2.1 Using Subversion and rsync</a> </li></ul> </li></ul> <li><a name="toc_Installing-R-under-Unix_002dalikes" href="#Installing-R-under-Unix_002dalikes">2 Installing R under Unix-alikes</a> <ul> <li><a href="#Simple-compilation">2.1 Simple compilation</a> <li><a href="#Help-options">2.2 Help options</a> <li><a href="#Making-the-manuals">2.3 Making the manuals</a> <li><a href="#Installation">2.4 Installation</a> <li><a href="#Uninstallation">2.5 Uninstallation</a> <li><a href="#Sub_002darchitectures">2.6 Sub-architectures</a> <ul> <li><a href="#Multilib">2.6.1 Multilib</a> </li></ul> <li><a href="#Other-Options">2.7 Other Options</a> <li><a href="#Testing-a-Unix_002dalike-Installation">2.8 Testing an Installation</a> </li></ul> <li><a name="toc_Installing-R-under-Windows" href="#Installing-R-under-Windows">3 Installing R under Windows</a> <ul> <li><a href="#Building-from-source">3.1 Building from source</a> <ul> <li><a href="#Getting-the-tools">3.1.1 Getting the tools</a> <li><a href="#Getting-the-source-files">3.1.2 Getting the source files</a> <li><a href="#Building-the-core-files">3.1.3 Building the core files</a> <li><a href="#Building-the-bitmap-files">3.1.4 Building the bitmap files</a> <li><a href="#Building-the-cairo-devices-files">3.1.5 Building the cairo devices</a> <li><a href="#Checking-the-build">3.1.6 Checking the build</a> <li><a href="#Building-the-manuals">3.1.7 Building the manuals</a> <li><a href="#Building-the-Inno-Setup-installer">3.1.8 Building the Inno Setup installer</a> <li><a href="#Building-the-MSI-installer">3.1.9 Building the MSI installer</a> <li><a href="#64_002dbit-Windows-builds">3.1.10 64-bit Windows builds</a> </li></ul> <li><a href="#Testing-a-Windows-Installation">3.2 Testing an Installation</a> </li></ul> <li><a name="toc_Installing-R-under-OS-X" href="#Installing-R-under-OS-X">4 Installing R under OS X</a> <ul> <li><a href="#Running-R-under-OS-X">4.1 Running R under OS X</a> <li><a href="#Uninstalling-under-OS-X">4.2 Uninstalling under OS X</a> <li><a href="#Multiple-versions">4.3 Multiple versions</a> </li></ul> <li><a name="toc_Running-R" href="#Running-R">5 Running R</a> <li><a name="toc_Add_002don-packages" href="#Add_002don-packages">6 Add-on packages</a> <ul> <li><a href="#Default-packages">6.1 Default packages</a> <li><a href="#Managing-libraries">6.2 Managing libraries</a> <li><a href="#Installing-packages">6.3 Installing packages</a> <ul> <li><a href="#Windows-packages">6.3.1 Windows</a> <li><a href="#OS-X-packages">6.3.2 OS X</a> <li><a href="#Customizing-package-compilation">6.3.3 Customizing package compilation</a> <li><a href="#Multiple-sub_002darchitectures">6.3.4 Multiple sub-architectures</a> <li><a href="#Byte_002dcompilation">6.3.5 Byte-compilation</a> </li></ul> <li><a href="#Updating-packages">6.4 Updating packages</a> <li><a href="#Removing-packages">6.5 Removing packages</a> <li><a href="#Setting-up-a-package-repository">6.6 Setting up a package repository</a> <li><a href="#Checking-installed-source-packages">6.7 Checking installed source packages</a> </li></ul> <li><a name="toc_Internationalization" href="#Internationalization">7 Internationalization and Localization</a> <ul> <li><a href="#Locales">7.1 Locales</a> <ul> <li><a href="#Locales-under-Unix_002dalikes">7.1.1 Locales under Unix-alikes</a> <li><a href="#Locales-under-Windows">7.1.2 Locales under Windows</a> <li><a href="#Locales-under-OS-X">7.1.3 Locales under OS X</a> </li></ul> <li><a href="#Localization-of-messages">7.2 Localization of messages</a> </li></ul> <li><a name="toc_Choosing-between-32_002d-and-64_002dbit-builds" href="#Choosing-between-32_002d-and-64_002dbit-builds">8 Choosing between 32- and 64-bit builds</a> <li><a name="toc_The-standalone-Rmath-library" href="#The-standalone-Rmath-library">9 The standalone Rmath library</a> <ul> <li><a href="#Unix_002dalike-standalone">9.1 Unix-alikes</a> <li><a href="#Windows-standalone">9.2 Windows</a> </li></ul> <li><a name="toc_Essential-and-useful-other-programs-under-a-Unix_002dalike" href="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Appendix A Essential and useful other programs under a Unix-alike</a> <ul> <li><a href="#Essential-programs-and-libraries">A.1 Essential programs and libraries</a> <li><a href="#Useful-libraries-and-programs">A.2 Useful libraries and programs</a> <ul> <li><a href="#Tcl_002fTk">A.2.1 Tcl/Tk</a> <li><a href="#Java-support">A.2.2 Java support</a> </li></ul> <li><a href="#Linear-algebra">A.3 Linear algebra</a> <ul> <li><a href="#BLAS">A.3.1 BLAS</a> <ul> <li><a href="#ATLAS">A.3.1.1 ATLAS</a> <li><a href="#ACML">A.3.1.2 ACML</a> <li><a href="#Goto-and-OpenBLAS">A.3.1.3 Goto and OpenBLAS</a> <li><a href="#MKL">A.3.1.4 Intel MKL</a> <li><a href="#Shared-BLAS">A.3.1.5 Shared BLAS</a> </li></ul> <li><a href="#LAPACK">A.3.2 LAPACK</a> <li><a href="#Caveats">A.3.3 Caveats</a> </li></ul> </li></ul> <li><a name="toc_Configuration-on-a-Unix_002dalike" href="#Configuration-on-a-Unix_002dalike">Appendix B Configuration on a Unix-alike</a> <ul> <li><a href="#Configuration-options">B.1 Configuration options</a> <li><a href="#Internationalization-support">B.2 Internationalization support</a> <li><a href="#Configuration-variables">B.3 Configuration variables</a> <ul> <li><a href="#Setting-paper-size">B.3.1 Setting paper size</a> <li><a href="#Setting-the-browsers">B.3.2 Setting the browsers</a> <li><a href="#Compilation-flags">B.3.3 Compilation flags</a> <li><a href="#Making-manuals">B.3.4 Making manuals</a> </li></ul> <li><a href="#Setting-the-shell">B.4 Setting the shell</a> <li><a href="#Using-make">B.5 Using make</a> <li><a href="#Using-FORTRAN">B.6 Using FORTRAN</a> <ul> <li><a href="#Using-gfortran">B.6.1 Using gfortran</a> </li></ul> <li><a href="#Compile-and-load-flags">B.7 Compile and load flags</a> </li></ul> <li><a name="toc_Platform-notes" href="#Platform-notes">Appendix C Platform notes</a> <ul> <li><a href="#X11-issues">C.1 X11 issues</a> <li><a href="#Linux">C.2 Linux</a> <ul> <li><a href="#Clang">C.2.1 Clang</a> <li><a href="#Intel-compilers">C.2.2 Intel compilers</a> <li><a href="#Oracle-Solaris-Studio-compilers">C.2.3 Oracle Solaris Studio compilers</a> </li></ul> <li><a href="#OS-X">C.3 OS X</a> <ul> <li><a href="#Snow-Leopard">C.3.1 Snow Leopard</a> <li><a href="#Lion">C.3.2 Lion</a> <li><a href="#Mountain-Lion">C.3.3 Mountain Lion</a> <li><a href="#Mavericks">C.3.4 Mavericks</a> <li><a href="#Tcl_002fTk-headers-and-libraries">C.3.5 Tcl/Tk headers and libraries</a> <li><a href="#Java-_0028OS-X_0029">C.3.6 Java</a> <li><a href="#Frameworks">C.3.7 Frameworks</a> <li><a href="#Building-R_002eapp">C.3.8 Building R.app</a> </li></ul> <li><a href="#Solaris">C.4 Solaris</a> <ul> <li><a href="#Using-gcc">C.4.1 Using gcc</a> </li></ul> <li><a href="#AIX">C.5 AIX</a> <li><a href="#FreeBSD">C.6 FreeBSD</a> <li><a href="#Cygwin">C.7 Cygwin</a> <li><a href="#New-platforms">C.8 New platforms</a> </li></ul> <li><a name="toc_The-Windows-toolset" href="#The-Windows-toolset">Appendix D The Windows toolset</a> <ul> <li><a href="#LaTeX">D.1 LaTeX</a> <li><a href="#The-Inno-Setup-installer">D.2 The Inno Setup installer</a> <li><a href="#The-command-line-tools">D.3 The command line tools</a> <li><a href="#The-MinGW_002dw64-toolchain">D.4 The MinGW-w64 toolchain</a> <li><a href="#Useful-additional-programs">D.5 Useful additional programs</a> </li></ul> <li><a name="toc_Function-and-variable-index" href="#Function-and-variable-index">Function and variable index</a> <li><a name="toc_Concept-index" href="#Concept-index">Concept index</a> <li><a name="toc_Environment-variable-index" href="#Environment-variable-index">Environment variable index</a> </li></ul> </div> <!-- @end ifnothtml --> <div class="node"> <a name="Top"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Obtaining-R">Obtaining R</a>, Previous: <a rel="previous" accesskey="p" href="#dir">(dir)</a>, Up: <a rel="up" accesskey="u" href="#dir">(dir)</a> </div> <h2 class="unnumbered">R Installation and Administration</h2> <p>This is a guide to installation and administration for R. <p>This manual is for R, version 3.0.2 (2013-09-25). <p>Copyright © 2001–2013 R Core Team <blockquote> 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>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>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. </blockquote> <ul class="menu"> <li><a accesskey="1" href="#Obtaining-R">Obtaining R</a> <li><a accesskey="2" href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a> <li><a accesskey="3" href="#Installing-R-under-Windows">Installing R under Windows</a> <li><a accesskey="4" href="#Installing-R-under-OS-X">Installing R under OS X</a> <li><a accesskey="5" href="#Running-R">Running R</a> <li><a accesskey="6" href="#Add_002don-packages">Add-on packages</a> <li><a accesskey="7" href="#Internationalization">Internationalization</a> <li><a accesskey="8" href="#Choosing-between-32_002d-and-64_002dbit-builds">Choosing between 32- and 64-bit builds</a> <li><a accesskey="9" href="#The-standalone-Rmath-library">The standalone Rmath library</a> <li><a href="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Essential and useful other programs under a Unix-alike</a> <li><a href="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a> <li><a href="#Platform-notes">Platform notes</a> <li><a href="#The-Windows-toolset">The Windows toolset</a> <li><a href="#Function-and-variable-index">Function and variable index</a> <li><a href="#Concept-index">Concept index</a> <li><a href="#Environment-variable-index">Environment variable index</a> </ul> <div class="node"> <a name="Obtaining-R"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a>, Previous: <a rel="previous" accesskey="p" href="#Top">Top</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <h2 class="chapter">1 Obtaining R</h2> <p><a name="index-Obtaining-R-1"></a> Sources, binaries and documentation for R can be obtained via <acronym>CRAN</acronym>, the “Comprehensive R Archive Network” whose current members are listed at <a href="http://CRAN.R-project.org/mirrors.html">http://CRAN.R-project.org/mirrors.html</a>. <ul class="menu"> <li><a accesskey="1" href="#Getting-and-unpacking-the-sources">Getting and unpacking the sources</a> <li><a accesskey="2" href="#Getting-patched-and-development-versions">Getting patched and development versions</a> </ul> <div class="node"> <a name="Getting-and-unpacking-the-sources"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Getting-patched-and-development-versions">Getting patched and development versions</a>, Previous: <a rel="previous" accesskey="p" href="#Obtaining-R">Obtaining R</a>, Up: <a rel="up" accesskey="u" href="#Obtaining-R">Obtaining R</a> </div> <h3 class="section">1.1 Getting and unpacking the sources</h3> <p><a name="index-Sources-for-R-2"></a> The simplest way is to download the most recent <samp><span class="file">R-</span><var>x</var><span class="file">.</span><var>y</var><span class="file">.</span><var>z</var><span class="file">.tar.gz</span></samp> file, and unpack it with <pre class="example"> tar -xf R-<var>x</var>.<var>y</var>.<var>z</var>.tar.gz </pre> <p class="noindent">on systems that have a suitable<a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a> <samp><span class="command">tar</span></samp> installed. On other systems you need to have the <samp><span class="command">gzip</span></samp> program installed, when you can use <pre class="example"> gzip -dc R-<var>x</var>.<var>y</var>.<var>z</var>.tar.gz | tar -xf - </pre> <p>The pathname of the directory into which the sources are unpacked should not contain spaces, as most <samp><span class="command">make</span></samp> programs (and specifically <acronym>GNU</acronym> <samp><span class="command">make</span></samp>) do not expect spaces. <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>If you use a recent GNU version of <samp><span class="command">tar</span></samp> 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 <pre class="example"> tar --no-same-owner -xf R-<var>x</var>.<var>y</var>.<var>z</var>.tar.gz </pre> <p class="noindent">and perhaps also include the option <samp><span class="option">--no-same-permissions</span></samp>. <a name="index-TAR_005fOPTIONS-3"></a>(These options can also be set in the <samp><span class="env">TAR_OPTIONS</span></samp> environment variable: if more than one option is included they should be separated by spaces.) <div class="node"> <a name="Getting-patched-and-development-versions"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Getting-and-unpacking-the-sources">Getting and unpacking the sources</a>, Up: <a rel="up" accesskey="u" href="#Obtaining-R">Obtaining R</a> </div> <h3 class="section">1.2 Getting patched and development versions</h3> <p>A patched version of the current release, ‘<samp><span class="samp">r-patched</span></samp>’, and the current development version, ‘<samp><span class="samp">r-devel</span></samp>’, 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, ‘<samp><span class="samp">r-patched</span></samp>’ tarballs may refer to beta/release candidates of the upcoming release, the patched version of the current release being available via Subversion.) <p>The tarballs are available from <a href="ftp://ftp.stat.math.ethz.ch/pub/Software/R/">ftp://ftp.stat.math.ethz.ch/pub/Software/R/</a>. Download <samp><span class="file">R-patched.tar.gz</span></samp> or <samp><span class="file">R-devel.tar.gz</span></samp> (or the <samp><span class="file">.tar.bz2</span></samp> versions) and unpack as described in the previous section. They are built in exactly the same way as distributions of R releases. <ul class="menu"> <li><a accesskey="1" href="#Using-Subversion-and-rsync">Using Subversion and rsync</a> </ul> <div class="node"> <a name="Using-Subversion-and-rsync"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Getting-patched-and-development-versions">Getting patched and development versions</a>, Up: <a rel="up" accesskey="u" href="#Getting-patched-and-development-versions">Getting patched and development versions</a> </div> <h4 class="subsection">1.2.1 Using Subversion and rsync</h4> <p><a name="index-Subversion-4"></a> 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="http://subversion.apache.org/">http://subversion.apache.org/</a>), you can check out and update the current ‘<samp><span class="samp">r-devel</span></samp>’ from <a href="https://svn.r-project.org/R/trunk/">https://svn.r-project.org/R/trunk/</a> and the current ‘<samp><span class="samp">r-patched</span></samp>’ from ‘<samp><span class="samp">https://svn.r-project.org/R/branches/R-</span><var>x</var><span class="samp">-</span><var>y</var><span class="samp">-branch/</span></samp>’ (where <var>x</var> and <var>y</var> are the major and minor number of the current released version of R). E.g., use <pre class="example"> svn checkout https://svn.r-project.org/R/trunk/ <var>path</var> </pre> <p class="noindent">to check out ‘<samp><span class="samp">r-devel</span></samp>’ 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 ‘<samp><span class="samp">https://svn.r-project.org/R/branches/R-</span><var>x</var><span class="samp">-</span><var>y</var><span class="samp">-branch/</span></samp>’ in the four-week period prior to the release. <p>Note that ‘<samp><span class="samp">https:</span></samp>’ is required<a rel="footnote" href="#fn-2" name="fnd-2"><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>Note that retrieving the sources by e.g. <samp><span class="command">wget -r</span></samp> or <samp><span class="command">svn export</span></samp> from that URL will not work (and will give a error early in the <samp><span class="command">make</span></samp> process): the Subversion information is needed to build R. <p>The Subversion repository does not contain the current sources for the recommended packages, which can be obtained by <samp><span class="command">rsync</span></samp> 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>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><span class="file">VERSION</span></samp> is ‘<samp><var>x</var><span class="samp">.</span><var>y</var><span class="samp">.</span><var>z</var></samp>’ you need to download the contents of ‘<samp><span class="samp">http://CRAN.R-project.org/src/contrib/</span><var>dir</var></samp>’, where <var>dir</var> is ‘<samp><var>x</var><span class="samp">.</span><var>y</var><span class="samp">.</span><var>z</var><span class="samp">/Recommended</span></samp>’ for r-devel or <samp><var>x</var><span class="file">.</span><var>y</var><span class="file">-patched/Recommended</span></samp> for r-patched, respectively, to directory <samp><span class="file">src/library/Recommended</span></samp> in the sources you have unpacked. After downloading manually you need to execute <samp><span class="command">tools/link-recommended</span></samp> from the top level of the sources to make the requisite links in <samp><span class="file">src/library/Recommended</span></samp>. A suitable incantation from the top level of the R sources using <samp><span class="command">wget</span></samp> might be (for the correct value of <samp><var>dir</var></samp>) <pre class="example"> wget -r -l1 --no-parent -A\*.gz -nd -P src/library/Recommended \ http://CRAN.R-project.org/src/contrib/<var>dir</var> ./tools/link-recommended </pre> <div class="node"> <a name="Installing-R-under-Unix-alikes"></a> <a name="Installing-R-under-Unix_002dalikes"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Installing-R-under-Windows">Installing R under Windows</a>, Previous: <a rel="previous" accesskey="p" href="#Obtaining-R">Obtaining R</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <h2 class="chapter">2 Installing R under Unix-alikes</h2> <p><a name="index-Installing-under-Unix_002dalikes-5"></a> R will configure and build under most common Unix and Unix-alike platforms including ‘<samp><var>cpu</var><span class="samp">-*-linux-gnu</span></samp>’ for the ‘<samp><span class="samp">alpha</span></samp>’, ‘<samp><span class="samp">arm</span></samp>’, ‘<samp><span class="samp">hppa</span></samp>’, ‘<samp><span class="samp">ix86</span></samp>’, ‘<samp><span class="samp">ia64</span></samp>’, ‘<samp><span class="samp">m68k</span></samp>’, ‘<samp><span class="samp">mips</span></samp>’, ‘<samp><span class="samp">mipsel</span></samp>’, ‘<samp><span class="samp">powerpc</span></samp>’, ‘<samp><span class="samp">s390</span></samp>’, ‘<samp><span class="samp">sparc</span></samp>’, and ‘<samp><span class="samp">x86_64</span></samp>’ <acronym>CPU</acronym>s, <!-- (see e.g.@: @uref{http://buildd.debian.org/build.php?&pkg=r-base}), --> <!-- Actually, see http://packages.debian.org/unstable/math/r-base-core as --> <!-- the build daemon is not used for all platforms; note also that Debian --> <!-- has x86_64 <=> amd, ix86 <=> i386. --> ‘<samp><span class="samp">x86_64-apple-darwin</span></samp>’, ‘<samp><span class="samp">i386-sun-solaris</span></samp>’ and ‘<samp><span class="samp">sparc-sun-solaris</span></samp>’ as well as perhaps (it is tested less frequently on these platforms) ‘<samp><span class="samp">i386-apple-darwin</span></samp>’, ‘<samp><span class="samp">i386-*-freebsd</span></samp>’, ‘<samp><span class="samp">x86_64-*-freebsd</span></samp>’, ‘<samp><span class="samp">i386-*-netbsd</span></samp>’, ‘<samp><span class="samp">i386-*-openbsd</span></samp>’ and ‘<samp><span class="samp">powerpc-ibm-aix6*</span></samp>’ <p><a name="index-Linux-6"></a><a name="index-OS-X-7"></a>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. <ul class="menu"> <li><a accesskey="1" href="#Simple-compilation">Simple compilation</a> <li><a accesskey="2" href="#Help-options">Help options</a> <li><a accesskey="3" href="#Making-the-manuals">Making the manuals</a> <li><a accesskey="4" href="#Installation">Installation</a> <li><a accesskey="5" href="#Uninstallation">Uninstallation</a> <li><a accesskey="6" href="#Sub_002darchitectures">Sub-architectures</a> <li><a accesskey="7" href="#Other-Options">Other Options</a> <li><a accesskey="8" href="#Testing-a-Unix_002dalike-Installation">Testing a Unix-alike Installation</a> </ul> <div class="node"> <a name="Simple-compilation"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Help-options">Help options</a>, Previous: <a rel="previous" accesskey="p" href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a> </div> <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-8"></a>want or need. Ensure that the environment variable <samp><span class="env">TMPDIR</span></samp> is either unset (and <samp><span class="file">/tmp</span></samp> exists and can be written in and scripts can be executed from) or points to a valid temporary directory (one from which execution of scripts is allowed) whose path does not contain spaces.<a rel="footnote" href="#fn-3" name="fnd-3"><sup>3</sup></a> <p><a name="index-R_005fHOME-9"></a>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><span class="file">src</span></samp>, <samp><span class="file">doc</span></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-10"></a> <pre class="example"> ./configure make </pre> <p class="noindent">(See <a href="#Using-make">Using make</a> if your make is not called ‘<samp><span class="samp">make</span></samp>’.) Users of Debian-based 64-bit systems<a rel="footnote" href="#fn-4" name="fnd-4"><sup>4</sup></a> may need <pre class="example"> ./configure LIBnn=lib make </pre> <p>Then check the built system works correctly by <pre class="example"> make check </pre> <p class="noindent">Failures are not necessarily problems as they might be caused by missing functionality,<a rel="footnote" href="#fn-5" name="fnd-5"><sup>5</sup></a> 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><span class="file">tests/ok-errors.R</span></samp> may indicate inadequate resource limits (see <a href="#Running-R">Running R</a>). <p>More comprehensive testing can be done by <pre class="example"> make check-devel </pre> <p class="noindent">or <pre class="example"> make check-all </pre> <p class="noindent">see file <samp><span class="file">tests/README</span></samp>. <p>If the command <samp><span class="command">configure</span></samp> and <samp><span class="command">make</span></samp> commands execute successfully, a shell-script front-end called <samp><span class="file">R</span></samp> will be created and copied to <samp><var>R_HOME</var><span class="file">/bin</span></samp>. You can link or copy this script to a place where users can invoke it, for example to <samp><span class="file">/usr/local/bin/R</span></samp>. You could also copy the man page <samp><span class="file">R.1</span></samp> to a place where your <samp><span class="command">man</span></samp> reader finds it, such as <samp><span class="file">/usr/local/man/man1</span></samp>. If you want to install the complete R tree to, e.g., <samp><span class="file">/usr/local/lib/R</span></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>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-11"></a> <pre class="example"> cd <var>BUILDDIR</var> <var>TOP_SRCDIR</var>/configure make </pre> <p class="noindent">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> <samp><span class="command">make</span></samp> to allow this, and you will need no spaces in the path to the build directory.) <!-- For those obtaining @R{} @emph{via} Subversion, one additional step is --> <!-- necessary: --> <!-- @cindex Vignettes --> <!-- @cindex Subversion --> <!-- @example --> <!-- make vignettes --> <!-- @end example --> <!-- @noindent --> <!-- which makes the @pkg{grid} vignettes (which are contained in the --> <!-- tarballs): it make take several minutes. --> <p>Now <code>rehash</code> if necessary, type <kbd>R</kbd>, and read the R manuals and the R <acronym>FAQ</acronym> (files <samp><span class="file">FAQ</span></samp> or <samp><span class="file">doc/manual/R-FAQ.html</span></samp>, or <a href="http://CRAN.R-project.org/doc/FAQ/R-FAQ.html">http://CRAN.R-project.org/doc/FAQ/R-FAQ.html</a> which always has the version for the latest release of R). <div class="node"> <a name="Help-options"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Making-the-manuals">Making the manuals</a>, Previous: <a rel="previous" accesskey="p" href="#Simple-compilation">Simple compilation</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a> </div> <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>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 <samp><span class="command">configure</span></samp> option <samp><span class="option">--enable-prebuilt-html</span></samp>. Whether <samp><span class="command">R CMD INSTALL</span></samp> (and hence <code>install.packages</code>) pre-builds <acronym>HTML</acronym> pages is determined by looking at the R installation and is reported by <samp><span class="command">R CMD INSTALL --help</span></samp>: it can be overridden by specifying one of the <samp><span class="command">INSTALL</span></samp> options <samp><span class="option">--html</span></samp> or <samp><span class="option">--no-html</span></samp>. <p>The server is disabled by setting the environment variable <a name="index-R_005fDISABLE_005fHTTPD-12"></a><samp><span class="env">R_DISABLE_HTTPD</span></samp> 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. <div class="node"> <a name="Making-the-manuals"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Installation">Installation</a>, Previous: <a rel="previous" accesskey="p" href="#Help-options">Help options</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a> </div> <h3 class="section">2.3 Making the manuals</h3> <p><a name="index-Manuals-13"></a> There is a set of manuals that can be built from the sources, <dl> <dt>‘<samp><span class="samp">fullrefman</span></samp>’<dd>Printed versions of all the help pages for base and recommended packages (over 3300 pages). <br><dt>‘<samp><span class="samp">refman</span></samp>’<dd>Printed versions of the help pages for selected base packages (over 1900 pages) <br><dt>‘<samp><span class="samp">R-FAQ</span></samp>’<dd>R <acronym>FAQ</acronym> <br><dt>‘<samp><span class="samp">R-intro</span></samp>’<dd>“An Introduction to R”. <br><dt>‘<samp><span class="samp">R-data</span></samp>’<dd>“R Data Import/Export”. <br><dt>‘<samp><span class="samp">R-admin</span></samp>’<dd>“R Installation and Administration”, this manual. <br><dt>‘<samp><span class="samp">R-exts</span></samp>’<dd>“Writing R Extensions”. <br><dt>‘<samp><span class="samp">R-lang</span></samp>’<dd>“The R Language Definition”. </dl> <p class="noindent">To make these (with ‘<samp><span class="samp">fullrefman</span></samp>’ rather than ‘<samp><span class="samp">refman</span></samp>’), use <pre class="example"> make pdf <span class="roman">to create PDF versions</span> make info <span class="roman">to create info files (not ‘</span><samp><span class="samp">refman</span></samp><span class="roman">’ nor ‘</span><samp><span class="samp">fullrefman</span></samp><span class="roman">’).</span> </pre> <p>You will not be able to build any of these unless you have <samp><span class="command">makeinfo</span></samp> version 4.7 or later installed, and for PDF you must have <samp><span class="command">texi2dvi</span></samp> and <samp><span class="file">texinfo.tex</span></samp> installed (which are part of the <acronym>GNU</acronym> <strong>texinfo</strong> distribution but are, especially <samp><span class="file">texinfo.tex</span></samp>, often made part of the TeX package in re-distributions). <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> <samp><span class="command">info</span></samp> program. The PDF versions will be created using the paper size selected at configuration (default ISO a4): this can be overridden by setting <samp><span class="env">R_PAPERSIZE</span></samp> <a name="index-R_005fPAPERSIZE-14"></a>on the <samp><span class="command">make</span></samp> command line, or setting <samp><span class="env">R_PAPERSIZE</span></samp> in the environment and using <samp><span class="command">make -e</span></samp>. (If re-making the manuals for a different paper size, you should first delete the file <samp><span class="file">doc/manual/version.texi</span></samp>. The usual value for North America would be ‘<samp><span class="samp">letter</span></samp>’.) <p>There are some issues with making the PDF reference manual, <samp><span class="file">fullrefman.pdf</span></samp> or <samp><span class="file">refman.pdf</span></samp>. The help files contain both ISO Latin1 characters (e.g. in <samp><span class="file">text.Rd</span></samp>) and upright quotes, neither of which are contained in the standard LaTeX Computer Modern fonts. We have provided four alternatives: <dl> <dt><code>times</code><dd>(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 <samp><span class="command">configure</span></samp>) 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> or <strong>bera</strong> installed.) <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. <br><dt><code>lm</code><dd>Using the <em>Latin Modern</em> fonts. These are not often installed as part of a TeX distribution, but can obtained from <a href="http://www.ctan.org/tex-archive/fonts/ps-type1/lm/">http://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>. <br><dt><code>cm-super</code><dd>Using type-1 versions of the Computer Modern fonts by Vladimir Volovich. This is a large installation, obtainable from <a href="http://www.ctan.org/tex-archive/fonts/ps-type1/cm-super/">http://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. <br><dt><code>ae</code><dd>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><span class="file">tctt0900.600pk</span></samp>, <samp><span class="file">tctt1000.600pk</span></samp> and <samp><span class="file">tcrm1000.600pk</span></samp>. Unfortunately, if those files are not available, Acrobat Reader will substitute completely incorrect glyphs so you need to examine the logs carefully. </dl> <p>The default can be overridden by setting the environment variable <a name="index-R_005fRD4PDF-15"></a><samp><span class="env">R_RD4PDF</span></samp>. (On Unix-alikes, this will be picked up at install time and stored in <samp><span class="file">etc/Renviron</span></samp>, but can still be overridden when the manuals are built, using <samp><span class="command">make -e</span></samp>.) The usual <a rel="footnote" href="#fn-6" name="fnd-6"><sup>6</sup></a> default value for <samp><span class="env">R_RD4PDF</span></samp> is ‘<samp><span class="samp">times,inconsolata,hyper</span></samp>’: omit ‘<samp><span class="samp">hyper</span></samp>’ if you do not want hyperlinks (e.g. for printing the manual) or do not have LaTeX package <strong>hyperref</strong>, and omit ‘<samp><span class="samp">inconsolata</span></samp>’ if you do not have LaTeX package <strong>inconsolata</strong> installed. <div class="node"> <a name="Installation"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Uninstallation">Uninstallation</a>, Previous: <a rel="previous" accesskey="p" href="#Making-the-manuals">Making the manuals</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a> </div> <h3 class="section">2.4 Installation</h3> <p><a name="index-Installation-16"></a> To ensure that the installed tree is usable by the right group of users, set <code>umask</code> appropriately (perhaps to ‘<samp><span class="samp">022</span></samp>’) before unpacking the sources and throughout the build process. <p>After <p><a name="index-configure-17"></a> <pre class="example"> ./configure make make check </pre> <p class="noindent">(or, when building outside the source, <var>TOP_SRCDIR</var><code>/configure</code>, etc) have been completed successfully, you can install the complete R tree to your system by typing <pre class="example"> make install </pre> <p class="noindent">A parallel make can be used (but run <samp><span class="command">make</span></samp> before <samp><span class="command">make install</span></samp>): however it is not recommended for <samp><span class="command">make check</span></samp> as the output from different checks will interleaved and hard to decipher. <p>This will install to the following directories: <dl> <dt><samp><var>prefix</var><span class="file">/bin</span></samp> or <samp><var>bindir</var></samp><dd>the front-end shell script and other scripts and executables <br><dt><samp><var>prefix</var><span class="file">/man/man1</span></samp> or <samp><var>mandir</var><span class="file">/man1</span></samp><dd>the man page <br><dt><samp><var>prefix</var><span class="file">/</span><var>LIBnn</var><span class="file">/R</span></samp> or <samp><var>libdir</var><span class="file">/R</span></samp><dd>all the rest (libraries, on-line help system, <small class="dots">...</small>). Here <var>LIBnn</var> is usually ‘<samp><span class="samp">lib</span></samp>’, but may be ‘<samp><span class="samp">lib64</span></samp>’ on some 64-bit Linux systems. This is known as the R home directory. </dl> <p class="noindent">where <var>prefix</var> is determined during configuration (typically <samp><span class="file">/usr/local</span></samp>) and can be set by running <samp><span class="command">configure</span></samp> with the option <samp><span class="option">--prefix</span></samp>, as in <p><a name="index-configure-18"></a> <pre class="example"> ./configure --prefix=/where/you/want/R/to/go </pre> <p class="noindent">This causes <samp><span class="command">make install</span></samp> to install the R script to <samp><span class="file">/where/you/want/R/to/go/bin</span></samp>, and so on. The prefix of the installation directories can be seen in the status message that is displayed at the end of <samp><span class="command">configure</span></samp>. You can install into another directory tree by using <pre class="example"> make prefix=/path/to/here install </pre> <p class="noindent">at least with <acronym>GNU</acronym> <samp><span class="command">make</span></samp> (and current Solaris and FreeBSD <samp><span class="command">make</span></samp>, but not some older Unix makes). <p>More precise control is available at configure time via options: see <samp><span class="command">configure --help</span></samp> for details. (However, most of the `Fine tuning of the installation directories' options are not used by R.) <p>Configure options <samp><span class="option">--bindir</span></samp> and <samp><span class="option">--mandir</span></samp> are supported and govern where a copy of the <samp><span class="command">R</span></samp> script and the <samp><span class="command">man</span></samp> page are installed. <p>The configure option <samp><span class="option">--libdir</span></samp> controls where the main R files are installed: the default is ‘<samp><var>eprefix</var><span class="samp">/</span><var>LIBnn</var></samp>’, 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><span class="option">--exec-prefix</span></samp>. <p>Each of <code>bindir</code>, <code>mandir</code> and <code>libdir</code> can also be specified on the <samp><span class="command">make install</span></samp> command line (at least for <acronym>GNU</acronym> <samp><span class="command">make</span></samp>). <p>The <samp><span class="command">configure</span></samp> or <samp><span class="command">make</span></samp> variables <code>rdocdir</code> and <code>rsharedir</code> can be used to install the system-independent <samp><span class="file">doc</span></samp> and <samp><span class="file">share</span></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.0.2</code>. <p>If you want the R home to be something other than <samp><var>libdir</var><span class="file">/R</span></samp>, use <samp><span class="option">rhome</span></samp>: for example <pre class="example"> make install rhome=/usr/local/lib64/R-3.0.2 </pre> <p class="noindent">will use a version-specific R home on a non-Debian Linux 64-bit system. <p>If you have made R as a shared/dynamic library you can install it in your system's library directory by <pre class="example"> make prefix=/path/to/here install-libR </pre> <p class="noindent">where <code>prefix</code> is optional, and <code>libdir</code> will give more precise control. <pre class="example"> make install-strip </pre> <p class="noindent">will install stripped executables, and on platforms where this is supported, stripped libraries in directories <samp><span class="file">lib</span></samp> and <samp><span class="file">modules</span></samp> and in the standard packages. <p>Note that installing R into a directory whose path contains spaces is not supported, and at least some aspects (such as installing source packages) will not work. <!-- The main problem is the Makefile include in etc/Makeconf --> <p><a name="index-Manuals_002c-installing-19"></a> To install info and PDF versions of the manuals, use one or both of <pre class="example"> make install-info make install-pdf </pre> <p class="noindent">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). (<samp><span class="command">make install-info</span></samp> needs Perl installed if there is no command <samp><span class="command">install-info</span></samp> on the system.) <p>More precise control is possible. For info, the setting used is that of <code>infodir</code> (default <samp><var>prefix</var><span class="file">/info</span></samp>, set by configure option <samp><span class="option">--infodir</span></samp>). The PDF files are installed into the R <samp><span class="file">doc</span></samp> tree, set by the <samp><span class="command">make</span></samp> variable <code>rdocdir</code>. <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-20"></a>final destination, and <samp><span class="env">DESTDIR</span></samp> should be used: see <a href="http://www.gnu.org/prep/standards/html_node/DESTDIR.html">http://www.gnu.org/prep/standards/html_node/DESTDIR.html</a>. <p>You can optionally install the run-time tests that are part of <samp><span class="command">make check-all</span></samp> by <pre class="example"> make install-tests </pre> <p class="noindent">which populates a <samp><span class="file">tests</span></samp> directory in the installation. <div class="node"> <a name="Uninstallation"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Sub_002darchitectures">Sub-architectures</a>, Previous: <a rel="previous" accesskey="p" href="#Installation">Installation</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a> </div> <h3 class="section">2.5 Uninstallation</h3> <p>You can uninstall R by <pre class="example"> make uninstall </pre> <p class="noindent">optionally specifying <code>prefix</code> etc in the same way as specified for installation. <p>This will also uninstall any installed manuals. There are specific targets to uninstall info and PDF manuals in file <samp><span class="file">doc/manual/Makefile</span></samp>. <p>Target <code>uninstall-tests</code> will uninstall any installed tests, as well as removing the directory <samp><span class="file">tests</span></samp> containing the test results. <div class="node"> <a name="Sub-architectures"></a> <a name="Sub_002darchitectures"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Other-Options">Other Options</a>, Previous: <a rel="previous" accesskey="p" href="#Uninstallation">Uninstallation</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a> </div> <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>R supports the idea of architecture-specific builds, specified by adding ‘<samp><span class="samp">r_arch=</span><var>name</var></samp>’ to the <samp><span class="command">configure</span></samp> line. Here <var>name</var> can be anything non-empty, and is used to name subdirectories of <samp><span class="file">lib</span></samp>, <samp><span class="file">etc</span></samp>, <samp><span class="file">include</span></samp> and the package <samp><span class="file">libs</span></samp> subdirectories. Example names from other software are the use of <samp><span class="file">sparcv9</span></samp> on Sparc Solaris and <samp><span class="file">32</span></samp> by <samp><span class="command">gcc</span></samp> on ‘<samp><span class="samp">x86_64</span></samp>’ Linux. <p>If you have two or more such builds you can install them over each other (and for 32/64-bit builds on one architecture, one build can be done without ‘<samp><span class="samp">r_arch</span></samp>’). The space savings can be considerable: on ‘<samp><span class="samp">x86_64</span></samp>’ Linux a basic install (without debugging symbols) took 63Mb, and adding a 32-bit build added 6Mb. If you have installed multiple builds you can select which build to run by <pre class="example"> R --arch=<var>name</var> </pre> <p class="noindent">and just running ‘<samp><span class="samp">R</span></samp>’ will run the last build that was installed. <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><span class="file">src/Makefile</span></samp> file. In such cases you can install for extra builds by <pre class="example"> R --arch=<var>name</var> CMD INSTALL --libs-only <var>pkg1</var> <var>pkg2</var> ... </pre> <p>If you want to mix sub-architectures compiled on different platforms (for example ‘<samp><span class="samp">x86_64</span></samp>’ Linux and ‘<samp><span class="samp">i686</span></samp>’ Linux), it is wise to use explicit names for each, and you may also need to set <samp><span class="option">libdir</span></samp> to ensure that they install into the same place. <p>When sub-architectures are used the version of <samp><span class="command">Rscript</span></samp> in e.g. <samp><span class="file">/usr/bin</span></samp> will be the last installed, but architecture-specific versions will be available in e.g. <samp><span class="file">/usr/lib64/R/bin/exec${</span><var>R_ARCH</var><span class="file">}</span></samp>. Normally all installed architectures will run on the platform so the architecture of <samp><span class="command">Rscript</span></samp> itself does not matter. The executable <samp><span class="command">Rscript</span></samp> will run the <samp><span class="command">R</span></samp> script, and at that time the <a name="index-R_005fARCH-21"></a>setting of the <samp><span class="env">R_ARCH</span></samp> environment variable determines the architecture which is run. <p>When running post-install tests with sub-architectures, use <pre class="example"> R --arch=<var>name</var> CMD make check[-devel|all] </pre> <p class="noindent">to select a sub-architecture to check. <p>Sub-architectures are also used on Windows, but by selecting executables within the appropriate <samp><span class="file">bin</span></samp> directory, <samp><var>R_HOME</var><span class="file">/bin/i386</span></samp> or <samp><var>R_HOME</var><span class="file">/bin/x64</span></samp>. For backwards compatibility with R < 2.12.0, there are executables <samp><var>R_HOME</var><span class="file">/bin/R.exe</span></samp> or <samp><var>R_HOME</var><span class="file">/bin/Rscript.exe</span></samp>: these will run an executable from one of the subdirectories, which one being taken first from the <a name="index-R_005fARCH-22"></a><samp><span class="env">R_ARCH</span></samp> environment variable, then from the <samp><span class="option">--arch</span></samp> command-line option<a rel="footnote" href="#fn-7" name="fnd-7"><sup>7</sup></a> and finally from the installation default (which is 32-bit for a combined 32/64 bit R installation). <ul class="menu"> <li><a accesskey="1" href="#Multilib">Multilib</a> </ul> <div class="node"> <a name="Multilib"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Sub_002darchitectures">Sub-architectures</a>, Up: <a rel="up" accesskey="u" href="#Sub_002darchitectures">Sub-architectures</a> </div> <h4 class="subsection">2.6.1 Multilib</h4> <p>On Linux<a rel="footnote" href="#fn-8" name="fnd-8"><sup>8</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><span class="file">lib</span></samp> (32-bit) and <samp><span class="file">lib64</span></samp> (64-bit). The build to be run may then be selected using the <samp><span class="command">setarch</span></samp> command. For example, a 32-bit build may be run by <pre class="example"> setarch i686 R </pre> <p>The <samp><span class="command">setarch</span></samp> 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 <samp><span class="command">setarch</span></samp> command. <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>At present there is a potential problem with packages using Java, as the post-install for a ‘<samp><span class="samp">i386</span></samp>’ RPM on ‘<samp><span class="samp">x86_64</span></samp>’ Linux reconfigures Java and will find the ‘<samp><span class="samp">x86_64</span></samp>’ Java. If you know where a 32-bit Java is installed you may be able to run (as root) <pre class="example"> export JAVA_HOME=<path to jre directory of 32-bit Java> setarch i686 R CMD javareconf </pre> <p class="noindent">to get a suitable setting. <p>When this mechanism is used, the version of <samp><span class="command">Rscript</span></samp> in e.g. <samp><span class="file">/usr/bin</span></samp> will be the last installed, but an architecture-specific version will be available in e.g. <samp><span class="file">/usr/lib64/R/bin</span></samp>. Normally all installed architectures will run on the platform so the architecture of <samp><span class="command">Rscript</span></samp> does not matter. <div class="node"> <a name="Other-Options"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Testing-a-Unix_002dalike-Installation">Testing a Unix-alike Installation</a>, Previous: <a rel="previous" accesskey="p" href="#Sub_002darchitectures">Sub-architectures</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a> </div> <h3 class="section">2.7 Other Options</h3> <p>There are many other installation options, most of which are listed by <samp><span class="command">configure --help</span></samp>. Almost all of those not listed elsewhere in this manual are either standard <samp><span class="command">autoconf</span></samp> options not relevant to R or intended for specialist uses by the R developers. <p>One that may be useful when working on R itself is the option <samp><span class="option">--disable-byte-compiled-packages</span></samp>, which ensures that the base and recommended packages are lazyloaded but not byte-compiled. (Alternatively the (make or environment) variable <samp><span class="env">R_NO_BASE_COMPILE</span></samp> can be set to a non-empty value for the duration of the build.) <div class="node"> <a name="Testing-a-Unix-alike-Installation"></a> <a name="Testing-a-Unix_002dalike-Installation"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Other-Options">Other Options</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a> </div> <h3 class="section">2.8 Testing an Installation</h3> <p>Full testing is possible only if the test files have been installed with <pre class="example"> make install-tests </pre> <p class="noindent">which populates a <samp><span class="file">tests</span></samp> directory in the installation. <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 <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> <p class="noindent">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>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>Alternatively, the installed R can be run, preferably with <samp><span class="option">--vanilla</span></samp>. Then <a name="index-LC_005fCOLLATE-23"></a> <pre class="example"> Sys.setenv(LC_COLLATE = "C", LANGUAGE = "en") library("tools") testInstalledBasic("both") testInstalledPackages(scope = "base") testInstalledPackages(scope = "recommended") </pre> <p class="noindent">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><span class="file">tests</span></samp> folder of the R home directory and run slightly fewer tests than the first approach: in particular they do not test Internet access. <p>These tests work best if <samp><span class="command">diff</span></samp> (in <samp><span class="file">Rtools*.exe</span></samp> for Windows users) is in the path. <p>It is possible to test the installed packages (but not the package-specific tests) by <code>testInstalledPackages</code> even if <samp><span class="command">make install-tests</span></samp> was not run. <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 <pre class="example"> LANGUAGE=en LC_TIME=C LC_COLLATE=C </pre> <p class="noindent">but use a UTF-8 or Latin-1 locale. <div class="node"> <a name="Installing-R-under-Windows"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Installing-R-under-OS-X">Installing R under OS X</a>, Previous: <a rel="previous" accesskey="p" href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <h2 class="chapter">3 Installing R under Windows</h2> <p><a name="index-Installing-under-Windows-24"></a> The <samp><span class="file">bin/windows</span></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 Windows XP or later on ix86 <acronym>CPU</acronym>s (including AMD64/Intel64 cpus and Windows x64). <p>Your file system must allow long file names (as is likely except perhaps for some network-mounted systems). <p>Installation is <em>via</em> the installer <samp><span class="file">R-3.0.2-win.exe</span></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>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>See the <a href="http://CRAN.R-project.org/bin/windows/base/rw-FAQ.html">R Windows <acronym>FAQ</acronym></a> for more details on the binary installer. <ul class="menu"> <li><a accesskey="1" href="#Building-from-source">Building from source</a> <li><a accesskey="2" href="#Testing-a-Windows-Installation">Testing a Windows Installation</a> </ul> <div class="node"> <a name="Building-from-source"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Testing-a-Windows-Installation">Testing a Windows Installation</a>, Previous: <a rel="previous" accesskey="p" href="#Installing-R-under-Windows">Installing R under Windows</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-Windows">Installing R under Windows</a> </div> <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>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><span class="file">.exe</span></samp> and <samp><span class="file">.dll</span></samp> files and some configuration files in the <samp><span class="file">etc</span></samp> directory. <ul class="menu"> <li><a accesskey="1" href="#Getting-the-tools">Getting the tools</a> <li><a accesskey="2" href="#Getting-the-source-files">Getting the source files</a> <li><a accesskey="3" href="#Building-the-core-files">Building the core files</a> <li><a accesskey="4" href="#Building-the-bitmap-files">Building the bitmap files</a> <li><a accesskey="5" href="#Building-the-cairo-devices-files">Building the cairo devices files</a> <li><a accesskey="6" href="#Checking-the-build">Checking the build</a> <li><a accesskey="7" href="#Building-the-manuals">Building the manuals</a> <li><a accesskey="8" href="#Building-the-Inno-Setup-installer">Building the Inno Setup installer</a> <li><a accesskey="9" href="#Building-the-MSI-installer">Building the MSI installer</a> <li><a href="#g_t64_002dbit-Windows-builds">64-bit Windows builds</a> </ul> <div class="node"> <a name="Getting-the-tools"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Getting-the-source-files">Getting the source files</a>, Previous: <a rel="previous" accesskey="p" href="#Building-from-source">Building from source</a>, Up: <a rel="up" accesskey="u" href="#Building-from-source">Building from source</a> </div> <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="http://CRAN.R-project.org/bin/windows/Rtools/">http://CRAN.R-project.org/bin/windows/Rtools/</a>) for details. <p>The <samp><span class="file">Rtools*.exe</span></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 “Full installation”, and install the extra files into your intended R source directory, e.g. <samp><span class="file">C:/R</span></samp>. The directory name <em>should not contain spaces</em>. We will call this directory <samp><var>R_HOME</var></samp> below. <div class="node"> <a name="Getting-the-source-files"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Building-the-core-files">Building the core files</a>, Previous: <a rel="previous" accesskey="p" href="#Getting-the-tools">Getting the tools</a>, Up: <a rel="up" accesskey="u" href="#Building-from-source">Building from source</a> </div> <h4 class="subsection">3.1.2 Getting the source files</h4> <p>You need to collect the following sets of files: <ul> <li>Get the R source code tarball <samp><span class="file">R-3.0.2.tar.gz</span></samp> from <acronym>CRAN</acronym>. Open a command window (or another shell) at directory <var>R_HOME</var>, and run <pre class="example"> tar -xf R-3.0.2.tar.gz </pre> <p class="noindent">to create the source tree in <var>R_HOME</var>. <strong>Beware</strong>: do use <samp><span class="command">tar</span></samp> 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 <pre class="example"> tar --no-same-owner -xf R-3.0.2.tar.gz </pre> <p class="noindent"><a name="index-TAR_005fOPTIONS-25"></a>or perhaps better, set the environment variable <samp><span class="env">TAR_OPTIONS</span></samp> to the value ‘<samp><span class="samp">--no-same-owner --no-same-permissions</span></samp>’. <p>It is also possible to obtain the source code using Subversion; see <a href="#Obtaining-R">Obtaining R</a> for details. <li>If you are not using a tarball you need to obtain copies of the recommended packages from <acronym>CRAN</acronym>. Put the <samp><span class="file">.tar.gz</span></samp> files in <samp><var>R_HOME</var><span class="file">/src/library/Recommended</span></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><span class="file">/src/gnuwin32</span></samp> <pre class="example"> make rsync-recommended </pre> </ul> <p>The following additional items are normally installed by <samp><span class="file">Rtools30.exe</span></samp>. If instead you choose to do a completely manual build you will also need <ul> <li>The Tcl/Tk support files are contained in <samp><span class="file">Rtools30.exe</span></samp> and available as <samp><span class="file">.zip</span></samp> files from <a href="http://www.stats.ox.ac.uk/pub/Rtools">http://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><span class="file">Tcl</span></samp> there. <li>You need <code>libpng</code>, <code>jpeg</code> and <code>libtiff</code> sources (available, e.g., from <a href="http://www.libpng.org/">http://www.libpng.org/</a>, <a href="http://www.ijg.org">http://www.ijg.org</a> and <a href="http://download.osgeo.org/libtiff/">http://download.osgeo.org/libtiff/</a>); current versions are recommended and 7 or later is required. It is also possible to use ‘<samp><span class="samp">libjpeg-turbo</span></samp>’ from <a href="http://sourceforge.net/projects/libjpeg-turbo/files/">http://sourceforge.net/projects/libjpeg-turbo/files/</a>. <p>Working in the directory <samp><var>R_HOME</var><span class="file">/src/gnuwin32/bitmap</span></samp>, install the <code>libpng</code> and <code>jpeg</code> sources in sub-directories. The <code>jpeg</code> sub-directory for version 9 is named <samp><span class="file">jpeg-9</span></samp>; if you use a different version (e.g. <samp><span class="file">jpeg-8d</span></samp> or <samp><span class="file">libjpeg-turbo</span></samp>), copy file <samp><span class="file">src/gnuwin32/MkRules.dist</span></samp> to <samp><span class="file">src/gnuwin32/MkRules.local</span></samp> and edit the definition of <code>JPEGDIR</code>: the names of the <samp><span class="file">libpng</span></samp> and <samp><span class="file">libtiff</span></samp> directories can also be set there. <p>Example: <pre class="example"> > tar -zxf libpng-1.6.2.tar.gz > mv libpng-1.6.2 libpng > tar -zxf jpegsrc.v9.tar.gz > tar -zxf tiff-4.0.3.tar.gz > mv tiff-4.0.3/libtiff . > rm -rf tiff-4.0.3 </pre> <p class="noindent">(and see the comment above about <samp><span class="option">--no-same-owner</span></samp>). </ul> <div class="node"> <a name="Building-the-core-files"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Building-the-bitmap-files">Building the bitmap files</a>, Previous: <a rel="previous" accesskey="p" href="#Getting-the-source-files">Getting the source files</a>, Up: <a rel="up" accesskey="u" href="#Building-from-source">Building from source</a> </div> <h4 class="subsection">3.1.3 Building the core files</h4> <p><a name="index-TMPDIR-26"></a>Set the environment variable <samp><span class="env">TMPDIR</span></samp> to point to a writable directory, with a path specified with forward slashes and no spaces. (The default is <samp><span class="file">/tmp</span></samp>, which may not be useful on Windows.) <p>You may need to compile under a case-honouring file system: we found that a <samp><span class="command">samba</span></samp>-mounted file system (which maps all file names to lower case) did not work. <p>Open a command window at <samp><var>R_HOME</var><span class="file">/src/gnuwin32</span></samp>. Look at <samp><span class="file">MkRules.dist</span></samp> and if settings need to be altered, copy it to <samp><span class="file">MkRules.local</span></samp> and edit the settings there. In particular, this is where a 64-bit build is selected. Then run <pre class="example"> make all recommended </pre> <p class="noindent">and sit back and wait while the basic compile takes place. <p>Notes: <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>By default Doug Lea's <code>malloc</code> in the file <samp><var>R_HOME</var><span class="file">/src/gnuwin32/malloc.c</span></samp> is used for R's internal memory allocations. You can opt out of this by setting <code>LEA_MALLOC=NO</code> in <samp><span class="file">MkRules.dist</span></samp>, in which case the <code>malloc</code> in <samp><span class="file">msvcrt.dll</span></samp> is used. This does impose a considerable performance penalty and has not been tested recently. <li>You can run a parallel make by e.g. <pre class="example"> make -j4 all make -j4 recommended </pre> <p class="noindent">but this is only likely to be worthwhile on a multi-core machine with ample memory, and is not 100% reliable. <li>It is possible (mainly for those working on R itself) to set the (make or environment) variable <samp><span class="env">R_NO_BASE_COMPILE</span></samp> to a non-empty value, which inhibits the byte-compilation of the base and recommended packages. </ul> <div class="node"> <a name="Building-the-bitmap-files"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Building-the-cairo-devices-files">Building the cairo devices files</a>, Previous: <a rel="previous" accesskey="p" href="#Building-the-core-files">Building the core files</a>, Up: <a rel="up" accesskey="u" href="#Building-from-source">Building from source</a> </div> <h4 class="subsection">3.1.4 Building the bitmap files</h4> <p><a name="index-Rbitmap_002edll-27"></a> The file <samp><var>R_HOME</var><span class="file">/library/grDevices/libs/{i386,x64}Rbitmap.dll</span></samp> is not built automatically. <p>Running <code>make</code> in <samp><var>R_HOME</var><span class="file">/src/gnuwin32/bitmap</span></samp> or <code>make bitmapdll</code> in <samp><var>R_HOME</var><span class="file">/src/gnuwin32</span></samp> should build <samp><span class="file">Rbitmap.dll</span></samp> and install it under <samp><var>R_HOME</var><span class="file">/library/grDevices/libs</span></samp>. <div class="node"> <a name="Building-the-cairo-devices-files"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Checking-the-build">Checking the build</a>, Previous: <a rel="previous" accesskey="p" href="#Building-the-bitmap-files">Building the bitmap files</a>, Up: <a rel="up" accesskey="u" href="#Building-from-source">Building from source</a> </div> <h4 class="subsection">3.1.5 Building the cairo devices</h4> <p><a name="index-winCairo_002edll-28"></a> The devices based on cairographics (<code>svg</code>, <code>cairo_pdf</code>, <code>cairo_ps</code> and the <code>type = "cairo"</code> versions of <code>png</code>, <code>jpeg</code>, <code>tiff</code> and <code>bmp</code>) are implemented in a separate DLL <samp><span class="file">winCairo.dll</span></samp> which is loaded when one of these devices is first used. It is not built by default, and needs to be built after <samp><span class="file">Rbitmap.dll</span></samp>, by <samp><span class="command">make cairodevices</span></samp>. <p>To enable the building of these devices you need to install the static cairographics libraries built by Simon Urbanek at <a href="http://www.rforge.net/Cairo/files/cairo-current-win.tar.gz">http://www.rforge.net/Cairo/files/cairo-current-win.tar.gz</a>. Set the macro ‘<samp><span class="samp">CAIRO_HOME</span></samp>’ in <samp><span class="file">MkRules.local</span></samp>. (Note that this tarball unpacks with a top-level directory <samp><span class="file">src/</span></samp>: ‘<samp><span class="samp">CAIRO_HOME</span></samp>’ needs to include that directory in its path.) <div class="node"> <a name="Checking-the-build"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Building-the-manuals">Building the manuals</a>, Previous: <a rel="previous" accesskey="p" href="#Building-the-cairo-devices-files">Building the cairo devices files</a>, Up: <a rel="up" accesskey="u" href="#Building-from-source">Building from source</a> </div> <h4 class="subsection">3.1.6 Checking the build</h4> <p>You can test a build by running <pre class="example"> make check </pre> <p class="noindent">The recommended packages can be checked by <pre class="example"> make check-recommended </pre> <p class="noindent">Other levels of checking are <pre class="example"> make check-devel </pre> <p class="noindent">for a more thorough check of the R functionality, and <pre class="example"> make check-all </pre> <p class="noindent">for <code>check-devel</code> and <code>check-recommended</code>. <p>If a test fails, there will almost always be a <samp><span class="file">.Rout.fail</span></samp> file in the directory being checked (often <samp><span class="file">tests/Examples</span></samp> or <samp><span class="file">tests</span></samp>): examine the file to help pinpoint the problem. <div class="node"> <a name="Building-the-manuals"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Building-the-Inno-Setup-installer">Building the Inno Setup installer</a>, Previous: <a rel="previous" accesskey="p" href="#Checking-the-build">Checking the build</a>, Up: <a rel="up" accesskey="u" href="#Building-from-source">Building from source</a> </div> <h4 class="subsection">3.1.7 Building the manuals</h4> <p>The PDF manuals can be made by <pre class="example"> make manuals </pre> <p class="noindent">If you want to make the info versions (not including the Reference Manual), use <pre class="example"> cd ../../doc/manual make -f Makefile.win info </pre> <p class="noindent">(all assuming you have <samp><span class="command">pdftex</span></samp>/<samp><span class="command">pdflatex</span></samp> installed and in your path). <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. <div class="node"> <a name="Building-the-Inno-Setup-installer"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Building-the-MSI-installer">Building the MSI installer</a>, Previous: <a rel="previous" accesskey="p" href="#Building-the-manuals">Building the manuals</a>, Up: <a rel="up" accesskey="u" href="#Building-from-source">Building from source</a> </div> <h4 class="subsection">3.1.8 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, as well as the recommended packages and Inno Setup (see <a href="#The-Inno-Setup-installer">The Inno Setup installer</a>). <p>Once everything is set up <pre class="example"> make distribution make check-all </pre> <p class="noindent">will make all the pieces and the installers and put them in the <samp><span class="file">gnuwin32/cran</span></samp> subdirectory, then check the build. This works by building all the parts in the sequence: <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> bitmapdll <span class="roman">(the bitmap support files)</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 svn 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> <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><span class="file">Makefile</span></samp> doesn't enforce this dependency—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 <samp><span class="command">make</span></samp> (or <samp><span class="command">make all</span></samp>) is run. <p>Parallel make is not supported and likely to fail. <p>If you want to customize the installation by adding extra packages, replace <code>make rinstaller</code> by something like <pre class="example"> make rinstaller EXTRA_PKGS='pkg1 pkg2 pkg3' </pre> <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><span class="file">MkRules</span></samp>, possibly <em>via</em> <samp><span class="file">MkRules.local</span></samp>, and having made R in the source tree) in <samp><span class="file">src/gnuwin32/installer</span></samp> run <pre class="example"> make myR IMAGEDIR=rootdir </pre> <p class="noindent">where <samp><span class="file">rootdir</span></samp> is the path to the root of the customized installation (in double quotes if it contains spaces or backslashes). <p>Both methods create an executable with a standard name such as <samp><span class="file">R-3.0.2-win.exe</span></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 – note that the installer will state that the contents are distributed under GPL-2 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>The defaults for the startup parameters may also be customized. For example <pre class="example"> make myR IMAGEDIR=rootdir MDISDI=1 </pre> <p class="noindent">will create an installer that defaults to installing R to run in SDI mode. See <samp><span class="file">src/gnuwin32/installer/Makefile</span></samp> for the names and values that can be set. <p>The standard <acronym>CRAN</acronym> distribution of a 32/64-bit installer is made by first building 32-bit R (just <pre class="example"> make 32-bit </pre> <p class="noindent">is needed), and then building 64-bit R with the macro <code>HOME32</code> set in file <samp><span class="file">MkRules.local</span></samp> to the top-level directory of the 32-bit build. Then the <samp><span class="command">make rinstaller</span></samp> step copies the files that differ between architectures from the 32-bit build as it builds the installer image. <div class="node"> <a name="Building-the-MSI-installer"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#g_t64_002dbit-Windows-builds">64-bit Windows builds</a>, Previous: <a rel="previous" accesskey="p" href="#Building-the-Inno-Setup-installer">Building the Inno Setup installer</a>, Up: <a rel="up" accesskey="u" href="#Building-from-source">Building from source</a> </div> <h4 class="subsection">3.1.9 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>It makes use of the Windows Installer XML (WiX) toolkit <em>version 3.5</em> (or perhaps later, untested) available from <a href="http://wix.sourceforge.net/">http://wix.sourceforge.net/</a> or <a href="http://wixtoolset.org/">http://wixtoolset.org/</a>. Once WiX is installed, set the path to its home directory in <samp><span class="file">MkRules.local</span></samp>. <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><span class="file">etc/Rconsole</span></samp> and <samp><span class="file">etc/Rprofile.site</span></samp> to set these as required. Then <pre class="example"> cd installer make msi </pre> <p class="noindent">which will result in a file with a name like <samp><span class="file">R-3.0.2-win32.msi</span></samp>. This can be double-clicked to be installed, but those who need it will know what to do with it (usually by running <samp><span class="command">msiexec /i</span></samp> with additional options). Properties that users might want to set from the <samp><span class="command">msiexec</span></samp> command line include ‘<samp><span class="samp">ALLUSERS</span></samp>’, ‘<samp><span class="samp">INSTALLDIR</span></samp>’ (something like <samp><span class="file">c:\Program Files\R\R-3.0.2</span></samp>) and ‘<samp><span class="samp">RMENU</span></samp>’ (the path to the ‘<samp><span class="samp">R</span></samp>’ folder on the start menu) and ‘<samp><span class="samp">STARTDIR</span></samp>’ (the starting directory for R shortcuts, defaulting to something like <samp><span class="file">c:\Users\name\Documents\R</span></samp>). <p>The MSI installer can be built both from a 32-bit build of R (<samp><span class="file">R-3.0.2-win32.msi</span></samp>) and from a 64-bit build of R (<samp><span class="file">R-3.0.2-win64.msi</span></samp>, optionally including 32-bit files by setting the macro <code>HOME32</code>, when the name is <samp><span class="file">R-3.0.2-win.msi</span></samp>). Unlike the main installer, a 64-bit MSI installer can only be run on 64-bit Windows. <p>Thanks to David del Campo (Dept of Statistics, University of Oxford) for suggesting WiX and building a prototype installer. <div class="node"> <a name="64-bit-Windows-builds"></a> <a name="g_t64_002dbit-Windows-builds"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Building-the-MSI-installer">Building the MSI installer</a>, Up: <a rel="up" accesskey="u" href="#Building-from-source">Building from source</a> </div> <h4 class="subsection">3.1.10 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>Support for MinGW-w64 was developed in the R sources over the period 2008–10 and was first released as part of R 2.11.0. The assistance of Yu Gong at a crucial step in porting R to MinGW-w64 is gratefully acknowledged, as well as help from Kai Tietz, the lead developer of the MinGW-w64 project. <p>Windows 64-bit is now completely integrated into the R and package build systems. <div class="node"> <a name="Testing-a-Windows-Installation"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Building-from-source">Building from source</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-Windows">Installing R under Windows</a> </div> <h3 class="section">3.2 Testing an Installation</h3> <p>The Windows installer contains a set of test files used when building R. <p>The <code>Rtools</code> are not needed to run these tests. but more comprehensive analysis of errors will be given if <samp><span class="command">diff</span></samp> is in the path (and <code>errorsAreFatal = FALSE</code> is then not needed below). <p>Launch either <code>Rgui</code> or <code>Rterm</code>, preferably with <samp><span class="option">--vanilla</span></samp>. Then run <pre class="example"> Sys.setenv(LC_COLLATE = "C", LANGUAGE = "en") library("tools") testInstalledBasic("both") testInstalledPackages(scope = "base", errorsAreFatal = FALSE) testInstalledPackages(scope = "recommended", errorsAreFatal = FALSE) </pre> <p class="noindent">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><span class="file">tests</span></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>The results of <code>example(md5sums)</code> when testing <strong>tools</strong> will differ from the reference output as some files are installed with Windows' CRLF line endings. <div class="node"> <a name="Installing-R-under-OS-X"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Running-R">Running R</a>, Previous: <a rel="previous" accesskey="p" href="#Installing-R-under-Windows">Installing R under Windows</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <h2 class="chapter">4 Installing R under OS X</h2> <p><a name="index-OS-X-29"></a> <p>The front page of a <acronym>CRAN</acronym> site has a link `Download R for OS X'. Click on that, then download the file <samp><span class="file">R-3.0.2.pkg</span></samp> and install it. This runs on OS X 10.6 and later (Snow Leopard, Lion, Mountain Lion, Mavericks, <small class="dots">...</small>); it is a 64-bit (‘<samp><span class="samp">x86_64</span></samp>’) build which should run on all Macs from mid-2008 on. For older Intel Macs and some older versions of the OS you can install R from the sources. <p>It is important that is you use the binary package that your OS is fully updated: run ‘Software Update’ from the Apple menu to be sure. <p>To install, just double-click on the icon of the file you downloaded. At the ‘Installation Type’ stage, note the option to ‘Customize’. This currently shows three components (‘Package Name’). Everyone will need the ‘R Framework’ component: the ‘R GUI’ and ‘Tcl/Tk’ components are optional (the latter being needed to use package <strong>tcltk</strong>). <p>This is an Apple Installer package. If you encounter any problem during the installation, please check the Installer log by clicking on the “Window” menu and item “Installer Log”. The full output (select “Show All Log”) is useful for tracking down problems. <p>On Mountain Lion and later with ‘GateKeeper’ active you will need to right/control-click on any unsigned packages and select ‘<samp><span class="samp">Open</span></samp>’: recent <acronym>CRAN</acronym> packages are signed. <p>For building R from source, see <a href="#OS-X">OS X</a>. <ul class="menu"> <li><a accesskey="1" href="#Running-R-under-OS-X">Running R under OS X</a> <li><a accesskey="2" href="#Uninstalling-under-OS-X">Uninstalling under OS X</a> <li><a accesskey="3" href="#Multiple-versions">Multiple versions</a> </ul> <div class="node"> <a name="Running-R-under-OS-X"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Uninstalling-under-OS-X">Uninstalling under OS X</a>, Previous: <a rel="previous" accesskey="p" href="#Installing-R-under-OS-X">Installing R under OS X</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-OS-X">Installing R under OS X</a> </div> <h3 class="section">4.1 Running R under OS X</h3> <p>There are two ways to run R on OS X from the <acronym>CRAN</acronym> binary distribution. <p>There is a GUI console normally installed with the R icon in <samp><span class="file">/Applications</span></samp> which you can run by double-clicking (e.g. from Launchpad or Finder). This is usually referred to as <span class="sc">R.app</span> to distinguish it from command-line R: its user manual is currently part of the OS X FAQ at <a href="http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html">http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html</a> <p>You can run command-line R from a Terminal 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 personal library directory (under <samp><span class="file">~/Library/R</span></samp>, e.g. <samp><span class="file">~/Library/R/3.0/library</span></samp>), and that warnings, messages and other output to <samp><span class="file">stderr</span></samp> are highlighted in bold. <div class="node"> <a name="Uninstalling-under-OS-X"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Multiple-versions">Multiple versions</a>, Previous: <a rel="previous" accesskey="p" href="#Running-R-under-OS-X">Running R under OS X</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-OS-X">Installing R under OS X</a> </div> <h3 class="section">4.2 Uninstalling under OS X</h3> <p>R for OS X consists of two parts: the GUI (<span class="sc">R.app</span>) 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><span class="file">/Applications/R.app</span></samp> folder and the R framework into the <samp><span class="file">/Library/Frameworks/R.frameweork</span></samp> folder. This does leave some links in <samp><span class="file">/usr/bin</span></samp>. <p>If you want to get rid of R more completely using a Terminal, simply run (prepend <code>sudo</code> if needed): <pre class="example"> rm -rf /Library/Frameworks/R.framework /Applications/R.app \ /usr/bin/R /usr/bin/Rscript </pre> <p>The installation consisted of three Apple packages: <code>org.r-project.R.Leopard.fw.pkg</code>, <code>org.r-project.R.Leopard.GUI.pkg</code> and <code>org.r-project.x86_64.tcltk.x11</code> (not all of which need be installed). You can use <code>pkgutil --unlink</code> (not supported by Lion or later) to remove their files or <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>Uninstalling the Tcl/Tk component (which is installed under <samp><span class="file">/usr/local</span></samp>) is not simple. You can list the files it installed in a Terminal by <pre class="example"> pkgutil --files org.r-project.x86_64.tcltk.x11 </pre> <p class="noindent">Note that some but not all of these files replace those in the Tcl/Tk 8.5.5 installation used for R 2.x, so care is needed if removing either. <div class="node"> <a name="Multiple-versions"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Uninstalling-under-OS-X">Uninstalling under OS X</a>, Up: <a rel="up" accesskey="u" href="#Installing-R-under-OS-X">Installing R under OS X</a> </div> <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 <samp><span class="command">pkgutil --forget</span></samp> (see the previous section). However, note that different versions are installed under <samp><span class="file">/Library/Frameworks/R.framework/Versions</span></samp> as <samp><span class="file">2.15</span></samp>, <samp><span class="file">3.0</span></samp> and so on, so it is not possible to have different ‘<samp><span class="samp">3.x.y</span></samp>’ versions installed for the same ‘<samp><span class="samp">x</span></samp>’. <p>A version of R can be run directly from the command-line as e.g. <pre class="example"> /Library/Frameworks/R.framework/Versions/3.0/Resources/bin/R </pre> <p class="noindent">However, <span class="sc">R.app</span> will always run the ‘current’ version, that is the last installed version. A small utility, <samp><span class="command">Rswitch.app</span></samp> (available at <a href="http://r.research.att.com/#other">http://r.research.att.com/#other</a>), can be used to change the ‘current’ version. However, this is of limited use as <span class="sc">R.app</span> 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 <span class="sc">R.app</span>) and then switch back to the release version. <div class="node"> <a name="Running-R"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Add_002don-packages">Add-on packages</a>, Previous: <a rel="previous" accesskey="p" href="#Installing-R-under-OS-X">Installing R under OS X</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <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>. <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 will have default limits at least as large as these, but apparently NetBSD does not. Use the shell command <samp><span class="command">ulimit</span></samp> (<samp><span class="command">sh</span></samp>/<samp><span class="command">bash</span></samp>) or <samp><span class="command">limit</span></samp> (<samp><span class="command">csh</span></samp>/<samp><span class="command">tcsh</span></samp>) to check.) <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><span class="file">/etc/Renviron</span></samp> (there are none set by default on Windows and hence no such file). These are set at <samp><span class="command">configure</span></samp> time, and you would not normally want to <a name="index-R_005fPAPERSIZE-30"></a>change them – a possible exception is <samp><span class="env">R_PAPERSIZE</span></samp> (see <a href="#Setting-paper-size">Setting paper size</a>). The paper size will be deduced from the ‘<samp><span class="samp">LC_PAPER</span></samp>’ locale category if it exists and <samp><span class="env">R_PAPERSIZE</span></samp> is unset, and this will normally produce the right choice from ‘<samp><span class="samp">a4</span></samp>’ and ‘<samp><span class="samp">letter</span></samp>’ on modern Unix-alikes (but can always be overridden by setting <samp><span class="env">R_PAPERSIZE</span></samp>). <p>Various environment variables can be set to determine where R creates its per-session temporary directory. The environment variables <a name="index-TMPDIR-31"></a><a name="index-TMP-32"></a><a name="index-TEMP-33"></a><samp><span class="env">TMPDIR</span></samp>, <samp><span class="env">TMP</span></samp> and <samp><span class="env">TEMP</span></samp> 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><span class="file">/tmp</span></samp> on Unix-alikes and the value of <a name="index-R_005fUSER-34"></a><samp><span class="env">R_USER</span></samp> on Windows. The path should not contain spaces. <p>Some Unix-alike systems are set up to remove files and directories periodically from <samp><span class="file">/tmp</span></samp>, for example by a <samp><span class="command">cron</span></samp> job <a name="index-TMPDIR-35"></a>running <samp><span class="command">tmpwatch</span></samp>. Set <samp><span class="env">TMPDIR</span></samp> to another directory before starting long-running jobs on such a system. <p>Note that <samp><span class="env">TMPDIR</span></samp> will be used to execute <samp><span class="command">configure</span></samp> scripts when installing packages, so if <samp><span class="file">/tmp</span></samp> has been mounted as ‘<samp><span class="samp">noexec</span></samp>’, <samp><span class="env">TMPDIR</span></samp> needs to be set to a directory from which execution is allowed. <div class="node"> <a name="Add-on-packages"></a> <a name="Add_002don-packages"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Internationalization">Internationalization</a>, Previous: <a rel="previous" accesskey="p" href="#Running-R">Running R</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <h2 class="chapter">6 Add-on packages</h2> <p><a name="index-Packages-36"></a><a name="index-Libraries-37"></a> <ul class="menu"> <li><a accesskey="1" href="#Default-packages">Default packages</a> <li><a accesskey="2" href="#Managing-libraries">Managing libraries</a> <li><a accesskey="3" href="#Installing-packages">Installing packages</a> <li><a accesskey="4" href="#Updating-packages">Updating packages</a> <li><a accesskey="5" href="#Removing-packages">Removing packages</a> <li><a accesskey="6" href="#Setting-up-a-package-repository">Setting up a package repository</a> <li><a accesskey="7" href="#Checking-installed-source-packages">Checking installed source packages</a> </ul> <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><span class="file">/library</span></samp>, but others can be used, for example by <a name="index-R_005fLIBS-38"></a>setting the environment variable <samp><span class="env">R_LIBS</span></samp> or using the R function <code>.libPaths()</code>. <div class="node"> <a name="Default-packages"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Managing-libraries">Managing libraries</a>, Previous: <a rel="previous" accesskey="p" href="#Add_002don-packages">Add-on packages</a>, Up: <a rel="up" accesskey="u" href="#Add_002don-packages">Add-on packages</a> </div> <h3 class="section">6.1 Default packages</h3> <p><a name="index-Packages_002c-default-39"></a> The set of packages loaded on startup is by default <pre class="example"> > getOption("defaultPackages") [1] "datasets" "utils" "grDevices" "graphics" "stats" "methods" </pre> <p class="noindent">(plus, of course, <strong>base</strong>) and this can be changed by setting the option in startup code (e.g. in <samp><span class="file">~/.Rprofile</span></samp>). It is initially <a name="index-R_005fDEFAULT_005fPACKAGES-40"></a>set to the value of the environment variable <samp><span class="env">R_DEFAULT_PACKAGES</span></samp> if set (as a comma-separated list). Setting <samp><span class="env">R_DEFAULT_PACKAGES=NULL</span></samp> ensures that only package <strong>base</strong> is loaded. <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 <samp><span class="command">Rscript</span></samp>). But it can also be used to customize R, e.g. for class use. <div class="node"> <a name="Managing-libraries"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Installing-packages">Installing packages</a>, Previous: <a rel="previous" accesskey="p" href="#Default-packages">Default packages</a>, Up: <a rel="up" accesskey="u" href="#Add_002don-packages">Add-on packages</a> </div> <h3 class="section">6.2 Managing libraries</h3> <p><a name="index-Libraries_002c-managing-41"></a> R packages are installed into <em>libraries</em>, which are directories in the file system containing a subdirectory for each package installed there. <p>R comes with a single library, <samp><var>R_HOME</var><span class="file">/library</span></samp> which is the value of the R object ‘<samp><span class="samp">.Library</span></samp>’ containing the standard and recommended<a rel="footnote" href="#fn-9" name="fnd-9"><sup>9</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 ‘<samp><span class="samp">.libPaths()</span></samp>’ can be used to add paths to the collection of libraries or to report the current collection. <p><a name="index-Libraries_002c-site-42"></a><a name="index-Site-libraries-43"></a>R will automatically make use of a site-specific library <samp><var>R_HOME</var><span class="file">/site-library</span></samp> if this exists (it does not in a vanilla R installation). This location can be overridden by setting<a rel="footnote" href="#fn-10" name="fnd-10"><sup>10</sup></a> ‘<samp><span class="samp">.Library.site</span></samp>’ in <samp><var>R_HOME</var><span class="file">/etc/Rprofile.site</span></samp>, or (not recommended) by setting the <a name="index-R_005fLIBS_005fSITE-44"></a>environment variable <samp><span class="env">R_LIBS_SITE</span></samp>. Like ‘<samp><span class="samp">.Library</span></samp>’, the site libraries are always included by ‘<samp><span class="samp">.libPaths()</span></samp>’. <p><a name="index-Libraries_002c-user-45"></a><a name="index-User-libraries-46"></a><a name="index-R_005fLIBS_005fUSER-47"></a>Users can have one or more libraries, normally specified by the environment variable <samp><span class="env">R_LIBS_USER</span></samp>. This has a default value (to see it, use ‘<samp><span class="samp">Sys.getenv("R_LIBS_USER")</span></samp>’ within an R session), but that is only used if the corresponding directory actually exists (which by default it will not). <p>Both <samp><span class="env">R_LIBS_USER</span></samp> and <samp><span class="env">R_LIBS_SITE</span></samp> can specify multiple library paths, separated by colons (semicolons on Windows). <div class="node"> <a name="Installing-packages"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Updating-packages">Updating packages</a>, Previous: <a rel="previous" accesskey="p" href="#Managing-libraries">Managing libraries</a>, Up: <a rel="up" accesskey="u" href="#Add_002don-packages">Add-on packages</a> </div> <h3 class="section">6.3 Installing packages</h3> <p><a name="index-Packages_002c-installing-48"></a> <ul class="menu"> <li><a accesskey="1" href="#Windows-packages">Windows packages</a> <li><a accesskey="2" href="#OS-X-packages">OS X packages</a> <li><a accesskey="3" href="#Customizing-package-compilation">Customizing package compilation</a> <li><a accesskey="4" href="#Multiple-sub_002darchitectures">Multiple sub-architectures</a> <li><a accesskey="5" href="#Byte_002dcompilation">Byte-compilation</a> </ul> <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>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. <!-- If installing packages on a Unix-alike to be used by other users, ensure --> <!-- that the system @code{umask} is set to give sufficient permissions (see --> <!-- also @code{Sys.umask} in @R{}). (To a large extent this is unnecessary --> <!-- in recent versions of @R{}, which install packages as if @code{umask = 022}.) --> <p><a name="index-TMPDIR-49"></a>Ensure that the environment variable <samp><span class="env">TMPDIR</span></samp> is either unset (and <samp><span class="file">/tmp</span></samp> exists and can be written in and executed from) or points to a valid temporary directory with a path not containing spaces. <p>For most users it suffices to call ‘<samp><span class="samp">install.packages(</span><var>pkgname</var><span class="samp">)</span></samp>’ or its GUI equivalent if the intention is to install a <acronym>CRAN</acronym> package and internet access is available.<a rel="footnote" href="#fn-11" name="fnd-11"><sup>11</sup></a> On most systems ‘<samp><span class="samp">install.packages()</span></samp>’ will allow packages to be selected from a list box (typically with several thousand items). <p>To install packages from source on a Unix-alike use <pre class="example"> R CMD INSTALL -l /path/to/library <var>pkg1</var> <var>pkg2</var> ... </pre> <p class="noindent">The part ‘<samp><span class="samp">-l /path/to/library</span></samp>’ can be omitted, in which case the first library of a normal R session is used (that shown by <code>.libPaths()[1]</code>). <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-50"></a>Alternatively, packages can be downloaded and installed from within R. First set the option <code>CRAN</code> to your nearest <acronym>CRAN</acronym> mirror using <samp><span class="command">chooseCRANmirror()</span></samp>. Then download and install packages <strong>pkg1</strong> and <strong>pkg2</strong> by <pre class="example"> > install.packages(c("pkg1", "pkg2")) </pre> <p class="noindent">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>If you want to fetch a package and all those it depends on (in any way) that are not already installed, use e.g. <pre class="example"> > install.packages("Rcmdr", dependencies = TRUE) </pre> <p><code>install.packages</code> can install a source package from a local <samp><span class="file">.tar.gz</span></samp> file by setting argument <code>repos</code> to <code>NULL</code>: this will be selected automatically if the name given is a single <samp><span class="file">.tar.gz</span></samp> file. <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, <small class="dots">...</small>). Function <code>setRepositories()</code> can select amongst those repositories that the R installation is aware of. <p>Naive users sometimes forget that as well as installing a package, they have to use <code>library</code> to make its functionality available. <div class="node"> <a name="Windows-packages"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#OS-X-packages">OS X packages</a>, Previous: <a rel="previous" accesskey="p" href="#Installing-packages">Installing packages</a>, Up: <a rel="up" accesskey="u" href="#Installing-packages">Installing packages</a> </div> <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) at the list of <em>binary</em> versions of packages available for your version of R and downloads the latest versions (if any), although optionally it will also download and install a source package by setting the <code>type</code> argument. <p>On Windows <code>install.packages</code> can also install a binary package from a local <samp><span class="file">zip</span></samp> 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>Windows binary packages for R are distributed as a single binary containing either or both architectures. <p>A few of the binary packages need other software to be installed on your system: see for example <a href="http://CRAN.R-project.org/bin/windows/contrib/3.0/@ReadMe">http://CRAN.R-project.org/bin/windows/contrib/3.0/@ReadMe</a>. For 64-bit builds, packages using Gtk+ (<a href="http://CRAN.R-project.org/package=Cairo"><strong>Cairo</strong></a>, <a href="http://CRAN.R-project.org/package=RGtk2"><strong>RGtk2</strong></a>, <a href="http://CRAN.R-project.org/package=cairoDevice"><strong>cairoDevice</strong></a> and those that depend on them) need the <samp><span class="file">bin</span></samp> directory of a bundled distribution from <a href="http://www.gtk.org/download-windows-64bit.html">http://www.gtk.org/download-windows-64bit.html</a> in the path: it should work to have both 32- and 64-bit Gtk+ <samp><span class="file">bin</span></samp> directories in the path on a 64-bit version of R. <p><samp><span class="command">R CMD INSTALL</span></samp> 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="source")</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 Vista/Windows 7/Server 2008 systems: these have been circumvented by setting the environment variable <samp><span class="env">R_INSTALL_TAR</span></samp> to ‘<samp><span class="samp">tar.exe</span></samp>’. <a name="index-R_005fINSTALL_005fTAR-51"></a> 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>For almost all packages <samp><span class="command">R CMD INSTALL</span></samp> 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 <samp><span class="command">R</span></samp> succeeded, whether or not the other architecture was successfully installed. The exceptions are packages with a non-empty <samp><span class="file">configure.win</span></samp> script or which make use of <samp><span class="file">src/Makefile.win</span></samp>. If <samp><span class="file">configure.win</span></samp> does something appropriate to both architectures use<a rel="footnote" href="#fn-12" name="fnd-12"><sup>12</sup></a> option <samp><span class="option">--force-biarch</span></samp>: otherwise <samp><span class="command">R CMD INSTALL --merge-multiarch</span></samp> 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>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 the 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-52"></a>There is provision to make use of a system-wide library of installed external software by setting the <samp><span class="command">make</span></samp> variable <code>LOCAL_SOFT</code>, to give an equivalent of <samp><span class="file">/usr/local</span></samp> on a Unix-alike. This can be set in <samp><span class="file">src/gnuwin/MkRules.local</span></samp> when R is built from sources (see the comments in <samp><span class="file">src/gnuwin/MkRules.dist</span></samp>), or in file<a rel="footnote" href="#fn-13" name="fnd-13"><sup>13</sup></a> <samp><span class="file">etc/i386/Makeconf</span></samp> or <samp><span class="file">etc/x64/Makeconf</span></samp> for an installed version of R. The version used by <acronym>CRAN</acronym> can be downloaded from <a href="http://www.stats.ox.ac.uk/pub/Rtools/libs.html">http://www.stats.ox.ac.uk/pub/Rtools/libs.html</a>. <div class="node"> <a name="OS-X-packages"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Customizing-package-compilation">Customizing package compilation</a>, Previous: <a rel="previous" accesskey="p" href="#Windows-packages">Windows packages</a>, Up: <a rel="up" accesskey="u" href="#Installing-packages">Installing packages</a> </div> <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 is an additional type <code>mac.binary</code> (the default in the <acronym>CRAN</acronym> distribution but not when compiling from source) that 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 ‘<samp><span class="samp">tgz</span></samp>’. The <span class="sc">R.app</span> GUI provides menus for installation of either binary or source packages, from <acronym>CRAN</acronym> or local files. <p>Note that many binary packages including compiled code are tied to a particular series (e.g. R 3.0.x or 3.1.x) of R. <p>Installing source packages which do not contain compiled code should work with no additional tools. For others you will need the `Command Line Tools' for <samp><span class="command">Xcode</span></samp> and compilers which match those used to build R: see <a href="#OS-X">OS X</a>. <p>Package <a href="http://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 Mavericks see <a href="#OS-X">OS X</a> and <a href="#Java-_0028OS-X_0029">Java (OS X)</a>. <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>A few of the binary packages need other software to be installed on your system. In particular packages using Gtk+ (<a href="http://CRAN.R-project.org/package=RGtk2"><strong>RGtk2</strong></a>, <a href="http://CRAN.R-project.org/package=cairoDevice"><strong>cairoDevice</strong></a> and those that depend on them) need the GTK framework installed from <a href="http://r.research.att.com/libs/">http://r.research.att.com/libs/</a>: the appropriate version at the time of writing was <a href="http://r.research.att.com/libs/GTK_2.24.17-X11.pkg">http://r.research.att.com/libs/GTK_2.24.17-X11.pkg</a> <p>It is often possible to use other compilers with the <acronym>CRAN</acronym> distribution of R, but the settings in the file <samp><span class="file">/Library/Frameworks/R.framework/Resources/etc/Makeconf</span></samp> will need to be changed, either by editing that file or in a file such as <samp><span class="file">~/.R/Makevars</span></samp> (see the next section). Entries which may need to be changed include ‘<samp><span class="samp">CC</span></samp>’, ‘<samp><span class="samp">CXX</span></samp>’, ‘<samp><span class="samp">FC</span></samp>’, ‘<samp><span class="samp">F77</span></samp>’, ‘<samp><span class="samp">FLIBS</span></samp>’ and the corresponding flags, and perhaps ‘<samp><span class="samp">CXXCPP</span></samp>’, ‘<samp><span class="samp">DYLIB_LD</span></samp>’, ‘<samp><span class="samp">MAIN_LD</span></samp>’, ‘<samp><span class="samp">SHLIB_CXXLD</span></samp>’, ‘<samp><span class="samp">SHLIB_FCLD</span></samp>’ and ‘<samp><span class="samp">SHLIB_LD</span></samp>’. <p>So for example you could select <samp><span class="command">clang</span></samp> for both C and C++ with extensive checking by having in <samp><span class="file">~/.R/Makevars</span></samp> <pre class="example"> CC=clang CXX=clang++ CFLAGS="-mtune=native -g -O2 -Wall -pedantic -Wconversion" CXXFLAGS="-mtune=native -g -O2 -Wall -pedantic -Wconversion" </pre> <p class="noindent">(this is expected to become necessary once Xcode 5 is released) and for another version of <samp><span class="command">gfortran-4.2</span></samp> we needed <pre class="example"> FLIBS=-lgfortran </pre> <div class="node"> <a name="Customizing-package-compilation"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Multiple-sub_002darchitectures">Multiple sub-architectures</a>, Previous: <a rel="previous" accesskey="p" href="#OS-X-packages">OS X packages</a>, Up: <a rel="up" accesskey="u" href="#Installing-packages">Installing packages</a> </div> <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><span class="file">/.R/Makevars-</span><var>R_PLATFORM</var></samp> (but <samp><var>HOME</var><span class="file">/.R/Makevars.win</span></samp> or <samp><var>HOME</var><span class="file">/.R/Makevars.win64</span></samp> on Windows), or if that does not exist, <samp><var>HOME</var><span class="file">/.R/Makevars</span></samp>, where ‘<samp><span class="samp">R_PLATFORM</span></samp>’ 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 <samp><span class="env">R_MAKEVARS_USER</span></samp>. <p>Package developers are encouraged to use this mechanism to enable a reasonable amount of diagnostic messaging (“warnings”) when compiling, such as e.g. <samp><span class="option">-Wall -pedantic</span></samp> for tools from GCC, the Gnu Compiler Collection. <p>Note that this mechanism can also be used when it necessary to change the optimization level for a particular package. For 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 95 code</span> FCFLAGS=-g -O -mtune=native </pre> <p>There is also provision for a site-wide <samp><span class="file">Makevars.site</span></samp> file under <samp><var>R_HOME</var><span class="file">/etc</span></samp> (in a sub-architecture-specific directory if appropriate). This is read immediately after <samp><span class="file">Makeconf</span></samp>, and an alternative file can be specified by environment variable <samp><span class="env">R_MAKEVARS_SITE</span></samp>. <div class="node"> <a name="Multiple-sub-architectures"></a> <a name="Multiple-sub_002darchitectures"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Byte_002dcompilation">Byte-compilation</a>, Previous: <a rel="previous" accesskey="p" href="#Customizing-package-compilation">Customizing package compilation</a>, Up: <a rel="up" accesskey="u" href="#Installing-packages">Installing packages</a> </div> <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>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 <dl> <dt><em>Unix-alikes</em><dd> where there is an <samp><span class="file">configure</span></samp> script, or a file <samp><span class="file">src/Makefile</span></samp>. <br><dt><em>Windows</em><dd> where there is a non-empty <samp><span class="file">configure.win</span></samp> script, or a file <samp><span class="file">src/Makefile.win</span></samp> (with some exceptions where the package is known to have an architecture-independent <samp><span class="file">configure.win</span></samp>, or if <samp><span class="option">--force-biarch</span></samp> or a field in the <samp><span class="file">DESCRIPTION</span></samp> file is used to assert so). </dl> <p class="noindent">In those cases only the current architecture is installed. Further sub-architectures can be installed by <pre class="example"> R CMD INSTALL --libs-only <var>pkg</var> </pre> <p class="noindent">using the path to <samp><span class="command">R</span></samp> or <samp><span class="command">R --arch</span></samp> to select the additional sub-architecture. There is also <samp><span class="command">R CMD INSTALL --merge-multiarch</span></samp> to build and merge the two architectures, starting with a source tarball. <div class="node"> <a name="Byte-compilation"></a> <a name="Byte_002dcompilation"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Multiple-sub_002darchitectures">Multiple sub-architectures</a>, Up: <a rel="up" accesskey="u" href="#Installing-packages">Installing packages</a> </div> <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 the option <samp><span class="option">--byte-compile</span></samp> with <samp><span class="command">R CMD INSTALL</span></samp> or with <code>install.packages(type = "source")</code>. <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>Byte-compilation can be controlled on a per-package basis by the ‘<samp><span class="samp">ByteCompile</span></samp>’ field in the <samp><span class="file">DESCRIPTION</span></samp> file. <div class="node"> <a name="Updating-packages"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Removing-packages">Removing packages</a>, Previous: <a rel="previous" accesskey="p" href="#Installing-packages">Installing packages</a>, Up: <a rel="up" accesskey="u" href="#Add_002don-packages">Add-on packages</a> </div> <h3 class="section">6.4 Updating packages</h3> <p><a name="index-update_002epackages-53"></a><a name="index-Packages_002c-updating-54"></a> 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>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>One sometimes-useful additional piece of information that <code>packageStatus()</code> returns is the status of a package, as <code>"ok"</code>, <code>"upgrade"</code> or <code>"unavailable"</code> (in the currently selected repositories). For example <pre class="example"> > inst <- packageStatus()$inst > inst[inst$Status != "ok", c("Package", "Version", "Status")] 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 class="node"> <a name="Removing-packages"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Setting-up-a-package-repository">Setting up a package repository</a>, Previous: <a rel="previous" accesskey="p" href="#Updating-packages">Updating packages</a>, Up: <a rel="up" accesskey="u" href="#Add_002don-packages">Add-on packages</a> </div> <h3 class="section">6.5 Removing packages</h3> <p><a name="index-remove_002epackages-55"></a><a name="index-Packages_002c-removing-56"></a> Packages can be removed in a number of ways. From a command prompt they can be removed by <pre class="example"> R CMD REMOVE -l /path/to/library <var>pkg1</var> <var>pkg2</var> ... </pre> <p>From a running R process they can be removed by <pre class="example"> > remove.packages(c("pkg1", "pkg2"), lib = file.path("path", "to", "library")) </pre> <p>Finally, in most installations one can just remove the package directory from the library. <div class="node"> <a name="Setting-up-a-package-repository"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Checking-installed-source-packages">Checking installed source packages</a>, Previous: <a rel="previous" accesskey="p" href="#Removing-packages">Removing packages</a>, Up: <a rel="up" accesskey="u" href="#Add_002don-packages">Add-on packages</a> </div> <h3 class="section">6.6 Setting up a package repository</h3> <p><a name="index-Repositories-57"></a> 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 ‘base’ 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 ‘<samp><span class="samp">ftp://</span></samp>’ and ‘<samp><span class="samp">file://</span></samp>’, but not on most systems ‘<samp><span class="samp">https://</span></samp>’). Under that base URL there should be directory trees for one or more of the following types of package distributions: <ul> <li><code>"source"</code>: located at <samp><span class="file">src/contrib</span></samp> and containing <samp><span class="file">.tar.gz</span></samp> files. Other forms of compression can be used, e.g. <samp><span class="file">.tar.bz2</span></samp> or <samp><span class="file">.tar.xz</span></samp> files. Complete repositories contain the sources corresponding to any binary packages, and in any case it is wise to have a <samp><span class="file">src/contrib</span></samp> area with a possibly empty <samp><span class="file">PACKAGES</span></samp> file. <li><code>"win.binary"</code>: located at <samp><span class="file">bin/windows/contrib/</span><var>x.y</var></samp> for R versions <var>x.y.z</var> and containing <samp><span class="file">.zip</span></samp> files for Windows. <li><code>"mac.binary"</code>: located at <samp><span class="file">bin/macosx/contrib/</span><var>3.y</var></samp> for R versions <var>3.y.z</var> and containing <samp><span class="file">.tgz</span></samp> files. <li><code>"mac.binary.leopard"</code>: located at <samp><span class="file">bin/macosx/leopard/contrib/</span><var>2.y</var></samp> for R versions <var>2.y.z</var> and containing <samp><span class="file">.tgz</span></samp> files. </ul> <p>Each terminal directory must also contain a <samp><span class="file">PACKAGES</span></samp> file. This can be a concatenation of the <samp><span class="file">DESCRIPTION</span></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><span class="file">PACKAGES.gz</span></samp> file, a <samp><span class="command">gzip</span></samp>-compressed version of <samp><span class="file">PACKAGES</span></samp>—as this will be downloaded in preference to <samp><span class="file">PACKAGES</span></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><span class="file">PACKAGES.gz</span></samp>.) <p>To add your repository to the list offered by <code>setRepositories()</code>, see the help file for that function. <p>Incomplete repositories are better specified <em>via</em> a <code>contriburl</code> argument than <em>via</em> being set as a repository. <p>A repository can contain subdirectories, when the descriptions in the <samp><span class="file">PACKAGES</span></samp> file of packages in subdirectories must include a line of the form <pre class="example"> Path: <var>path/to/subdirectory</var> </pre> <p class="noindent">—once again <code>write_PACKAGES</code> is the simplest way to set this up. <div class="node"> <a name="Checking-installed-source-packages"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Setting-up-a-package-repository">Setting up a package repository</a>, Up: <a rel="up" accesskey="u" href="#Add_002don-packages">Add-on packages</a> </div> <h3 class="section">6.7 Checking installed source packages</h3> <p>It can be convenient to run <samp><span class="command">R CMD check</span></samp> 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): <pre class="example"> R CMD INSTALL -l <var>libdir</var> <var>pkg</var> > <var>pkg</var>.log 2>&1 R CMD check -l <var>libdir</var> --install=check:<var>pkg</var>.log <var>pkg</var> </pre> <p class="noindent">Where sub-architectures are in use the <samp><span class="command">R CMD check</span></samp> line can be repeated with additional architectures by <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> <p class="noindent">where <samp><span class="option">--extra-arch</span></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><span class="option">--no-multiarch</span></samp> may need to be added to the <code>INSTALL</code> lines.) On Unix-alikes the architecture to run is selected by <samp><span class="option">--arch</span></samp>: this can also be used on Windows with <samp><var>R_HOME</var><span class="file">/bin/R.exe</span></samp>, but it is more usual to select the path to the <samp><span class="command">Rcmd.exe</span></samp> of the desired architecture. <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 <pre class="example"> .../bin/i386/Rcmd INSTALL -l <var>libdir</var> <var>tarball</var> --build > <var>pkg</var>.log 2>&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> <p class="noindent">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><samp><span class="command">R CMD INSTALL</span></samp> can do a <code>i386</code> install and then add the <code>x64</code> DLL from a single command by <pre class="example"> R CMD INSTALL --merge-multiarch -l <var>libdir</var> <var>tarball</var> </pre> <p class="noindent">and <samp><span class="option">--build</span></samp> can be added to zip up the installation. <div class="node"> <a name="Internationalization"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Choosing-between-32_002d-and-64_002dbit-builds">Choosing between 32- and 64-bit builds</a>, Previous: <a rel="previous" accesskey="p" href="#Add_002don-packages">Add-on packages</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <h2 class="chapter">7 Internationalization and Localization</h2> <p><a name="index-Internationalization-58"></a><a name="index-Localization-59"></a> <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. <!-- Prior to 2005 @R{} worked in the ISO Latin-1 8-bit character set and so --> <!-- covered English and most Western European languages (if not necessarily --> <!-- their currency symbols). Since @R{} 2.1.0 it has supported Eastern --> <!-- European 8-bit character sets, and multi-byte character sets such as --> <!-- UTF-8 and others used for Chinese, Japanese and Korean. --> <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-60"></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>The other aspect of the internationalization is support for the translation of messages. This is enabled in almost all builds of R. <ul class="menu"> <li><a accesskey="1" href="#Locales">Locales</a> <li><a accesskey="2" href="#Localization-of-messages">Localization of messages</a> </ul> <div class="node"> <a name="Locales"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Localization-of-messages">Localization of messages</a>, Previous: <a rel="previous" accesskey="p" href="#Internationalization">Internationalization</a>, Up: <a rel="up" accesskey="u" href="#Internationalization">Internationalization</a> </div> <h3 class="section">7.1 Locales</h3> <p><a name="index-Locale-61"></a> 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>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 <ul> <li>A human language. These are generally specified by a lower-case two-character abbreviation following ISO 639 (see e.g. <a href="http://en.wikipedia.org/wiki/ISO_639-1">http://en.wikipedia.org/wiki/ISO_639-1</a>). <li>A ‘territory’, used mainly to specify the currency. These are generally specified by an upper-case two-character abbreviation following ISO 3166 (see e.g. <a href="http://en.wikipedia.org/wiki/ISO_3166">http://en.wikipedia.org/wiki/ISO_3166</a>). <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>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>). </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, and most OSes have only one charset each for most languages. <ul class="menu"> <li><a accesskey="1" href="#Locales-under-Unix_002dalikes">Locales under Unix-alikes</a> <li><a accesskey="2" href="#Locales-under-Windows">Locales under Windows</a> <li><a accesskey="3" href="#Locales-under-OS-X">Locales under OS X</a> </ul> <div class="node"> <a name="Locales-under-Unix-alikes"></a> <a name="Locales-under-Unix_002dalikes"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Locales-under-Windows">Locales under Windows</a>, Previous: <a rel="previous" accesskey="p" href="#Locales">Locales</a>, Up: <a rel="up" accesskey="u" href="#Locales">Locales</a> </div> <h4 class="subsection">7.1.1 Locales under Unix-alikes</h4> <p>Modern Linux uses the XPG<a rel="footnote" href="#fn-14" name="fnd-14"><sup>14</sup></a> locale specifications which have the form ‘<samp><span class="samp">en_GB</span></samp>’, ‘<samp><span class="samp">en_GB.UTF-8</span></samp>’, ‘<samp><span class="samp">aa_ER.UTF-8@saaho</span></samp>’, ‘<samp><span class="samp">de_AT.iso885915@euro</span></samp>’, the components being in the order listed above. (See <samp><span class="command">man locale</span></samp> and <samp><span class="command">locale -a</span></samp> for more details.) Similar schemes are used by most Unix-alikes: some (including some distributions of Linux) use ‘<samp><span class="samp">.utf8</span></samp>’ rather than ‘<samp><span class="samp">.UTF-8</span></samp>’. <p>Note that whereas UTF-8 locales are nowadays almost universally used, locales such as ‘<samp><span class="samp">en_GB</span></samp>’ use 8-bit encodings for backwards compatibility. <div class="node"> <a name="Locales-under-Windows"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Locales-under-OS-X">Locales under OS X</a>, Previous: <a rel="previous" accesskey="p" href="#Locales-under-Unix_002dalikes">Locales under Unix-alikes</a>, Up: <a rel="up" accesskey="u" href="#Locales">Locales</a> </div> <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="http://msdn.microsoft.com/en-us/library/hzz3tw78(v=vs.80)">http://msdn.microsoft.com/en-us/library/hzz3tw78(v=vs.80)</a> (or if Microsoft moves it yet again, search for ‘<samp><span class="samp">Windows language country strings</span></samp>’). <p>It offers only one encoding per language. <p>Some care is needed with Windows' locale names. For example, <code>chinese</code> is Traditional Chinese and not Simplified Chinese as used in most of the Chinese-speaking world. <div class="node"> <a name="Locales-under-OS-X"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Locales-under-Windows">Locales under Windows</a>, Up: <a rel="up" accesskey="u" href="#Locales">Locales</a> </div> <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="http://developer.apple.com/documentation/MacOSX/Conceptual/BPInternational/">http://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 ‘<samp><span class="samp">en_GB.UTF-8</span></samp>’ if it defaults to ‘<samp><span class="samp">C</span></samp>’ (as it sometimes does when logging it remotely and in batch jobs: note whether <samp><span class="command">Terminal</span></samp> sets the <samp><span class="env">LANG</span></samp> environment variable is an (advanced) option, but the default). <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>. <div class="node"> <a name="Localization-of-messages"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Locales">Locales</a>, Up: <a rel="up" accesskey="u" href="#Internationalization">Internationalization</a> </div> <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-62"></a><a name="index-LC_005fALL-63"></a><a name="index-LC_005fMESSAGES-64"></a><a name="index-LANG-65"></a><samp><span class="env">LANGUAGE</span></samp> and then<a rel="footnote" href="#fn-15" name="fnd-15"><sup>15</sup></a> by the environment variables <samp><span class="env">LC_ALL</span></samp>, <samp><span class="env">LC_MESSAGES</span></samp> and <samp><span class="env">LANG</span></samp>. (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 <samp><span class="env">LC_ALL</span></samp> do not all correspond to XPG language names and so <samp><span class="env">LANGUAGE</span></samp> may need to be set. (One example is ‘<samp><span class="samp">LC_ALL=es</span></samp>’ on Windows which sets the locale to Estonian and the language to Spanish.) <p>It is usually possible to change the language once R is running <em>via</em> (not Windows) <code>Sys.setlocale("LC_MESSAGES", "new_locale")</code>, or by setting an environment variable such as <samp><span class="env">LANGUAGE</span></samp>, <em>provided</em><a rel="footnote" href="#fn-16" name="fnd-16"><sup>16</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>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. <ul> <li>Domain <code>R</code> for the C-level error and warning messages from the R interpreter. <li>Domain <code>R-</code><var>pkg</var> 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>Domain <var>pkg</var> for the C-level messages in each package. <li>Domain <code>RGui</code> for the menus etc of the R for Windows GUI front-end. </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>R can be built without support for translations, but it is enabled by default. <p>R-level and C-level domains are subtly different, for example in the way strings are canonicalized before being passed for translation. <p>Translations are looked for by domain according to the currently specified language, as specifically as possible, so for example an Austrian (‘<samp><span class="samp">de_AT</span></samp>’) translation catalogue will be used in preference to a generic German one (‘<samp><span class="samp">de</span></samp>’) 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 ‘<samp><span class="samp">en_GB</span></samp>’ that translate the Americanisms (e.g., ‘<samp><span class="samp">gray</span></samp>’) in the standard messages into English.<a rel="footnote" href="#fn-17" name="fnd-17"><sup>17</sup></a> Two other examples: there are catalogues for ‘<samp><span class="samp">es</span></samp>’, which is Spanish as written in Spain and these will by default also be used in Spanish-speaking Latin American countries, and also for ‘<samp><span class="samp">pt_BR</span></samp>’, which are used for Brazilian locales but not for locales specifying Portugal. <p>Translations in the right language but the wrong charset are made use of <a name="index-LANGUAGE-66"></a>by on-the-fly re-encoding. The <samp><span class="env">LANGUAGE</span></samp> variable (only) can be a colon-separated list, for example ‘<samp><span class="samp">se:de</span></samp>’, giving a set of languages in decreasing order of preference. One special value is ‘<samp><span class="samp">en@quot</span></samp>’, 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>If no suitable translation catalogue is found or a particular message is not translated in any suitable catalogue, ‘English’<a rel="footnote" href="#fn-18" name="fnd-18"><sup>18</sup></a> is used. <p>See <a href="http://developer.r-project.org/Translations.html">http://developer.r-project.org/Translations.html</a> for how to prepare and install translation catalogues. <div class="node"> <a name="Choosing-between-32--and-64-bit-builds"></a> <a name="Choosing-between-32_002d-and-64_002dbit-builds"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#The-standalone-Rmath-library">The standalone Rmath library</a>, Previous: <a rel="previous" accesskey="p" href="#Internationalization">Internationalization</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <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., ‘<samp><span class="samp">x86_64</span></samp>’ Linux and OS X >= 10.6) 64-bit is. <p>All current versions of R use 32-bit integers and <acronym>ISO</acronym>/<acronym>IEC</acronym> 60559<a rel="footnote" href="#fn-19" name="fnd-19"><sup>19</sup></a> double-precision reals, and so compute to the same precision<a rel="footnote" href="#fn-20" name="fnd-20"><sup>20</sup></a> and with the same limits on the sizes of numerical quantities. The principal difference is in the size of the pointers. <p>64-bit builds have both advantages and disadvantages: <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–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 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). <li>Only 64-bit builds support ‘long vectors’, those with 2^31 or more elements (each of which needs at least 8GB of storage, 16GB for a numeric vector). <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 <samp><span class="command">configure</span></samp> 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>Because the pointers are larger, R'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>However, ‘other things’ may not be equal. In the specific case of ‘<samp><span class="samp">x86_64</span></samp>’ <em>vs</em> ‘<samp><span class="samp">ix86</span></samp>’, 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.) </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>Even on 64-bit builds of R there are limits on the size of R objects (see <code>help("Memory-limits")</code>, some of which stem from the use of 32-bit integers (especially in FORTRAN code). For example, the dimensions of an array are limited to 2^31 - 1. <div class="node"> <a name="The-standalone-Rmath-library"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Essential and useful other programs under a Unix-alike</a>, Previous: <a rel="previous" accesskey="p" href="#Choosing-between-32_002d-and-64_002dbit-builds">Choosing between 32- and 64-bit builds</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <h2 class="chapter">9 The standalone Rmath library</h2> <p>The routines supporting the distribution and special<a rel="footnote" href="#fn-21" name="fnd-21"><sup>21</sup></a> functions in R and a few others are declared in C header file <samp><span class="file">Rmath.h</span></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>The makefiles and other sources needed are in directory <samp><span class="file">src/nmath/standalone</span></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><samp><span class="file">Rmath.h</span></samp> contains ‘<samp><span class="samp">R_VERSION_STRING</span></samp>’, which is a character string containing the current R version, for example <code>"3.0.0"</code>. <p>There is full access to R's handling of <code>NaN</code>, <code>Inf</code> and <code>-Inf</code> via special versions of the macros and functions <pre class="example"> ISNAN, R_FINITE, R_log, R_pow and R_pow_di </pre> <p class="noindent">and (extern) constants <code>R_PosInf</code>, <code>R_NegInf</code> and <code>NA_REAL</code>. <p>There is no support for R'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>A little care is needed to use the random-number routines. You will need to supply the uniform random number generator <pre class="example"> double unif_rand(void) </pre> <p class="noindent">or use the one supplied (and with a shared library or DLL you will have to use the one supplied, which is the Marsaglia-multicarry with an entry point <pre class="example"> set_seed(unsigned int, unsigned int) </pre> <p class="noindent">to set its seeds). <p>The facilities to change the normal random number generator are available through the constant N01_kind. This takes values from the enumeration type <pre class="example"> typedef enum { BUGGY_KINDERMAN_RAMAGE, AHRENS_DIETER, BOX_MULLER, USER_NORM, INVERSION, KINDERMAN_RAMAGE } N01type; </pre> <p class="noindent">(and ‘<samp><span class="samp">USER_NORM</span></samp>’ is not available). <ul class="menu"> <li><a accesskey="1" href="#Unix_002dalike-standalone">Unix-alike standalone</a> <li><a accesskey="2" href="#Windows-standalone">Windows standalone</a> </ul> <div class="node"> <a name="Unix-alike-standalone"></a> <a name="Unix_002dalike-standalone"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Windows-standalone">Windows standalone</a>, Previous: <a rel="previous" accesskey="p" href="#The-standalone-Rmath-library">The standalone Rmath library</a>, Up: <a rel="up" accesskey="u" href="#The-standalone-Rmath-library">The standalone Rmath library</a> </div> <h3 class="section">9.1 Unix-alikes</h3> <p>If R has not already be made in the directory tree, <samp><span class="command">configure</span></samp> must be run as described in the main build instructions. <p>Then (in <samp><span class="file">src/nmath/standalone</span></samp>) <pre class="example"> make </pre> <p class="noindent">will make standalone libraries <samp><span class="file">libRmath.a</span></samp> and <samp><span class="file">libRmath.so</span></samp> (<samp><span class="file">libRmath.dylib</span></samp> on OS X): ‘<samp><span class="samp">make static</span></samp>’ and ‘<samp><span class="samp">make shared</span></samp>’ will create just one of them. <p>To use the routines in your own C or C++ programs, include <pre class="example"> #define MATHLIB_STANDALONE #include <Rmath.h> </pre> <p class="noindent">and link against ‘<samp><span class="samp">-lRmath</span></samp>’ (and ‘<samp><span class="samp">-lm</span></samp>’ if needed on your OS). The example file <samp><span class="file">test.c</span></samp> does nothing useful, but is provided to test the process (via <samp><span class="command">make test</span></samp>). Note that you will probably not be able to run it unless you add the directory containing <a name="index-LD_005fLIBRARY_005fPATH-67"></a><samp><span class="file">libRmath.so</span></samp> to the <samp><span class="env">LD_LIBRARY_PATH</span></samp> environment variable (<samp><span class="file">libRmath.dylib</span></samp>, <samp><span class="env">DYLD_LIBRARY_PATH</span></samp> on OS X). <p>The targets <pre class="example"> make install make uninstall </pre> <p class="noindent">will (un)install the header <samp><span class="file">Rmath.h</span></samp> and shared and static <a name="index-DESTDIR-68"></a>libraries (if built). Both <code>prefix=</code> and <samp><span class="env">DESTDIR</span></samp> are supported, together with more precise control as described for the main build. <p>‘<samp><span class="samp">make install</span></samp>’ installs a file for <samp><span class="command">pkg-config</span></samp> to use by e.g. <pre class="example"> $(CC) `pkg-config --cflags libRmath` -c test.c $(CC) `pkg-config --libs libRmath` test.o -o test </pre> <p>On some systems ‘<samp><span class="samp">make install-strip</span></samp>’ will install a stripped shared library. <div class="node"> <a name="Windows-standalone"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Unix_002dalike-standalone">Unix-alike standalone</a>, Up: <a rel="up" accesskey="u" href="#The-standalone-Rmath-library">The standalone Rmath library</a> </div> <h3 class="section">9.2 Windows</h3> <p>You need to set up<a rel="footnote" href="#fn-22" name="fnd-22"><sup>22</sup></a> almost all the tools to make R and then run (in a Unix-like shell) <pre class="example"> (cd ../../gnuwin32; make MkRules) (cd ../../include; make -f Makefile.win config.h Rconfig.h Rmath.h) make -f Makefile.win </pre> <p class="noindent">Alternatively, in a <samp><span class="file">cmd.exe</span></samp> shell use <pre class="example"> cd ../../include make -f Makefile.win config.h Rconfig.h Rmath.h cd ../nmath/standalone make -f Makefile.win </pre> <p>This creates a static library <samp><span class="file">libRmath.a</span></samp> and a DLL <samp><span class="file">Rmath.dll</span></samp>. If you want an import library <samp><span class="file">libRmath.dll.a</span></samp> (you don't need one), use <pre class="example"> make -f Makefile.win shared implib </pre> <p>To use the routines in your own C or C++ programs using MinGW, include <pre class="example"> #define MATHLIB_STANDALONE #include <Rmath.h> </pre> <p class="noindent">and link against ‘<samp><span class="samp">-lRmath</span></samp>’. This will use the first found of <samp><span class="file">libRmath.dll.a</span></samp>, <samp><span class="file">libRmath.a</span></samp> and <samp><span class="file">Rmath.dll</span></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> <pre class="example"> -Wl,-Bstatic -lRmath -Wl,dynamic -Wl,-Bdynamic -lRmath </pre> <p class="noindent">or by linking to explicit files (as in the ‘<samp><span class="samp">test</span></samp>’ target in <samp><span class="file">Makefile.win</span></samp>: this makes two executables, <samp><span class="file">test.exe</span></samp> which is dynamically linked, and <samp><span class="file">test-static.exe</span></samp>, which is statically linked). <p>It is possible to link to <samp><span class="file">Rmath.dll</span></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><span class="file">Rmath.def</span></samp> which can be used (possibly after editing) to create an import library for other systems such as Visual C++. <p>If you make use of dynamic linking you should use <pre class="example"> #define MATHLIB_STANDALONE #define RMATH_DLL #include <Rmath.h> </pre> <p class="noindent">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.) <div class="node"> <a name="Essential-and-useful-other-programs-under-a-Unix-alike"></a> <a name="Essential-and-useful-other-programs-under-a-Unix_002dalike"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a>, Previous: <a rel="previous" accesskey="p" href="#The-standalone-Rmath-library">The standalone Rmath library</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <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 <samp><span class="command">configure</span></samp>. <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 development version. The latter usually has the same name but with the extension ‘<samp><span class="samp">-devel</span></samp>’ or ‘<samp><span class="samp">-dev</span></samp>’: you need both versions installed. <ul class="menu"> <li><a accesskey="1" href="#Essential-programs-and-libraries">Essential programs and libraries</a> <li><a accesskey="2" href="#Useful-libraries-and-programs">Useful libraries and programs</a> <li><a accesskey="3" href="#Linear-algebra">Linear algebra</a> </ul> <div class="node"> <a name="Essential-programs-and-libraries"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Useful-libraries-and-programs">Useful libraries and programs</a>, Previous: <a rel="previous" accesskey="p" href="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Essential and useful other programs under a Unix-alike</a>, Up: <a rel="up" accesskey="u" href="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Essential and useful other programs under a Unix-alike</a> </div> <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>). Some add-on packages also need a C++ compiler. Your C compiler should be <acronym>ISO</acronym>/<acronym>IEC</acronym> 60059<a rel="footnote" href="#fn-23" name="fnd-23"><sup>23</sup></a>, POSIX 1003.1 and C99-compliant.<a rel="footnote" href="#fn-24" name="fnd-24"><sup>24</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 recent versions of <samp><span class="command">gcc</span></samp> with <code>glibc</code> this means including <samp><span class="option">-std=gnu99</span></samp><a rel="footnote" href="#fn-25" name="fnd-25"><sup>25</sup></a>. If the compiler is detected as <samp><span class="command">gcc</span></samp>, <samp><span class="option">-std=gnu99</span></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>Unless you do not want to view graphs on-screen (or use a Mac) you need ‘<samp><span class="samp">X11</span></samp>’ installed, including its headers and client libraries. For recent Fedora distributions it means (at least) RPMs ‘<samp><span class="samp">libX11</span></samp>’, ‘<samp><span class="samp">libX11-devel</span></samp>’, ‘<samp><span class="samp">libXt</span></samp>’ and ‘<samp><span class="samp">libXt-devel</span></samp>’. On Debian we recommend the meta-package ‘<samp><span class="samp">xorg-dev</span></samp>’. If you really do not want these you will need to explicitly configure R without X11, using <samp><span class="option">--with-x=no</span></samp>. <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><span class="option">--with-readline=no</span></samp> (or equivalent). <p>A suitably comprehensive <code>iconv</code> function is essential. The R usage requires <code>iconv</code> to be able to translate between <code>"latin1"</code> and <code>"UTF-8"</code>, to recognize <code>""</code> (as the current encoding) and <code>"ASCII"</code>, and to translate to and from the Unicode wide-character formats <code>"UCS-[24][BL]E"</code> — this is true for <code>glibc</code> but not of most commercial Unixes. However, you can make use of <acronym>GNU</acronym> <code>libiconv</code> (possibly as a plug-in replacement: see <a href="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</a>). <p>An implementation of <acronym>XDR</acronym> is required. This is part of <acronym>RPC</acronym> and historically has been part of <samp><span class="file">libc</span></samp> on a Unix-alike: however some builds<a rel="footnote" href="#fn-26" name="fnd-26"><sup>26</sup></a> of <code>glibc 2.14</code> hide it. The intention seems to be 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 (and <samp><span class="command">configure</span></samp> tries <samp><span class="file">/usr/include/tirpc</span></samp> if the headers are not found on the standard include path). The R sources contain a fall-back implementation of <acronym>XDR</acronym> which is likely to suffice on both 32- and 64-bit platforms. <p>The OS needs to have enough support<a rel="footnote" href="#fn-27" name="fnd-27"><sup>27</sup></a> for wide-character types: this is checked at configuration. <p>A <samp><span class="command">tar</span></samp> program is needed to unpack the sources and packages (including the recommended packages). A version<a rel="footnote" href="#fn-28" name="fnd-28"><sup>28</sup></a> that can automagically detect compressed archives is preferred for use with <code>untar()</code>: the configure script looks for <samp><span class="command">gtar</span></samp> and <samp><span class="command">gnutar</span></samp> before <a name="index-TAR-69"></a><samp><span class="command">tar</span></samp>: use environment variable <samp><span class="env">TAR</span></samp> to override this. <p>There need to be suitable versions of the tools <samp><span class="command">grep</span></samp> and <samp><span class="command">sed</span></samp>: the problems are usually with old AT&T and BSD variants. <samp><span class="command">configure</span></samp> will try to find suitable versions (including looking in <samp><span class="file">/usr/xpg4/bin</span></samp> which is used on some commercial Unixes). <p>You will not be able to build most of the manuals unless you have <samp><span class="command">makeinfo</span></samp> version 4.7 or later installed, and if not some of the <acronym>HTML</acronym> manuals will be linked to <acronym>CRAN</acronym>. To make PDF versions of the manuals you will also need file <samp><span class="file">texinfo.tex</span></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 <samp><span class="command">texi2dvi</span></samp>.<a rel="footnote" href="#fn-29" name="fnd-29"><sup>29</sup></a> Further, the versions of <samp><span class="command">texi2dvi</span></samp> and <samp><span class="file">texinfo.tex</span></samp> need to be compatible: we have seen problems with older TeX distributions (TeXLive 2007 and MiKTeX 2.8) used with <strong>texinfo</strong> 4.13. It should be possible to use <samp><span class="command">makeinfo</span></samp> version 5.x. <p><a name="index-Vignettes-70"></a>The PDF documentation (including <samp><span class="file">doc/NEWS.pdf</span></samp>) and building vignettes needs <samp><span class="command">pdftex</span></samp> and <samp><span class="command">pdflatex</span></samp>. 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 LaTeX packages are required (including <strong>url.sty</strong>, and <strong>listings.sty</strong>) and others such as <strong>hyperref</strong> and <strong>inconsolata</strong> are desirable (and without them you may need to change R's defaults: see <a href="#Making-the-manuals">Making the manuals</a>). <p>If you want to build from the R Subversion repository you need both <samp><span class="command">makeinfo</span></samp> and <samp><span class="command">pdflatex</span></samp>. <a name="index-Subversion-71"></a> <a name="index-PATH-72"></a>The essential programs should be in your <samp><span class="env">PATH</span></samp> at the time <samp><span class="command">configure</span></samp> is run: this will capture the full paths. <div class="node"> <a name="Useful-libraries-and-programs"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Linear-algebra">Linear algebra</a>, Previous: <a rel="previous" accesskey="p" href="#Essential-programs-and-libraries">Essential programs and libraries</a>, Up: <a rel="up" accesskey="u" href="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Essential and useful other programs under a Unix-alike</a> </div> <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>The ‘modern’ version of the <code>X11()</code>, <code>jpeg()</code>, <code>png()</code> and <code>tiff()</code> graphics devices uses the <code>cairo</code> and (optionally) <code>Pango</code> libraries. Cairo version 1.2.0 or later is required. Pango needs to be at least version 1.10, and 1.12 is the earliest version we have tested. (For Fedora users we believe the <code>pango-devel</code> RPM and its dependencies suffice.) R checks for <samp><span class="command">pkg-config</span></samp>, and uses that to check first that the ‘<samp><span class="samp">pangocairo</span></samp>’ package is installed (and if not, ‘<samp><span class="samp">cairo</span></samp>’) and if additional flags are needed for the ‘<samp><span class="samp">cairo-xlib</span></samp>’ package, then if suitable code can be compiled. These tests will fail if <samp><span class="command">pkg-config</span></samp> is not installed, 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. OS X comes with none of these libraries (but XQuartz, as used for 10.8 and later, ships <code>cairo</code>), but <code>cairo</code> support (without <code>Pango</code>) has been added to the binary distribution (see <a href="http://r.research.att.com/libs/">http://r.research.att.com/libs/</a> you need <code>fontconfig</code>, <code>freetype</code> and <code>pixman</code> too): <code>pkg-config</code> is still needed when building R from source and can be installed from its sources. <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 rel="footnote" href="#fn-30" name="fnd-30"><sup>30</sup></a> provides TrueType versions of Monotype fonts such as Arial and Times New Roman. Another useful set of fonts is the ‘liberation’ TrueType fonts available at <a href="https://fedorahosted.org/liberation-fonts/">https://fedorahosted.org/liberation-fonts/</a>,<a rel="footnote" href="#fn-31" name="fnd-31"><sup>31</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="http://en.wikipedia.org/wiki/Liberation_fonts">http://en.wikipedia.org/wiki/Liberation_fonts</a>). Then there is the ‘Free UCS Outline Fonts’ project (<a href="http://www.gnu.org/software/freefont/">http://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>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 – 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 <samp><span class="command">configure</span></samp> options <samp><span class="option">--without-libpng</span></samp>, <samp><span class="option">--without-jpeglib</span></samp> and <samp><span class="option">--without-libtiff</span></samp>. For most system installations the TIFF libraries will require JPEG libraries to be present and perhaps linked explicitly, so <samp><span class="option">--without-jpeglib</span></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>If you have them installed (including the appropriate headers and of suitable versions), system versions of <code>zlib</code>, <code>libbz2</code> and PCRE will be used if specified by <samp><span class="option">--with-system-zlib</span></samp> (version 1.2.5 or later), <samp><span class="option">--with-system-bzlib</span></samp> or <samp><span class="option">--with-system-pcre</span></samp> (version 8.10 or later, preferably 8.33 which is what is supplied with R): otherwise versions in the R sources will be compiled in. As the latter suffice and are tested with R you should not need to change this. <p><code>liblzma</code> from <code>xz-utils</code> version 5.0.3 or later will be used if installed: the version in the R sources can be selected instead by configuring with <samp><span class="option">--with-system-xz=no</span></samp>. Systems differ in what they call the package including this: e.g. on Fedora the library is in ‘<samp><span class="samp">xz-libs</span></samp>’ and the headers in ‘<samp><span class="samp">xz-devel</span></samp>’. <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 ‘<samp><span class="samp">xorg-dev</span></samp>’), but some distributions have split this into smaller parts, so for example recent versions of Fedora require the ‘<samp><span class="samp">libXmu</span></samp>’ and ‘<samp><span class="samp">libXmu-devel</span></samp>’ RPMs. <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'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 (including on OS X >= 10.4): should a very old or broken version of ICU be found this can be suppressed by <samp><span class="option">--without-ICU</span></samp>. <p>The <code>bitmap</code> and <code>dev2bitmap</code> devices and also <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 <samp><span class="env">R_GSCMD</span></samp> at that time. <a name="index-R_005fGSCMD-73"></a> <ul class="menu"> <li><a accesskey="1" href="#Tcl_002fTk">Tcl/Tk</a> <li><a accesskey="2" href="#Java-support">Java support</a> </ul> <div class="node"> <a name="Tcl%2fTk"></a> <a name="Tcl_002fTk"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Java-support">Java support</a>, Previous: <a rel="previous" accesskey="p" href="#Useful-libraries-and-programs">Useful libraries and programs</a>, Up: <a rel="up" accesskey="u" href="#Useful-libraries-and-programs">Useful libraries and programs</a> </div> <h4 class="subsection">A.2.1 Tcl/Tk</h4> <p>The <strong>tcltk</strong> package needs Tcl/Tk >= 8.4 installed: the sources are available at <a href="http://www.tcl.tk/">http://www.tcl.tk/</a>. To specify the locations of the Tcl/Tk files you may need the configuration options <dl> <dt><samp><span class="option">--with-tcltk</span></samp><dd>use Tcl/Tk, or specify its library directory <br><dt><samp><span class="option">--with-tcl-config=</span><var>TCL_CONFIG</var></samp><dd>specify location of <samp><span class="file">tclConfig.sh</span></samp> <br><dt><samp><span class="option">--with-tk-config=</span><var>TK_CONFIG</var></samp><dd>specify location of <samp><span class="file">tkConfig.sh</span></samp> </dl> <p class="noindent">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><span class="file">tcl.h</span></samp> and <samp><span class="file">tk.h</span></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>Versions of Tcl/Tk up to 8.5.12 and 8.6.0 have been tested (including most versions of 8.4.x, but not recently). <div class="node"> <a name="Java-support"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Tcl_002fTk">Tcl/Tk</a>, Up: <a rel="up" accesskey="u" href="#Useful-libraries-and-programs">Useful libraries and programs</a> </div> <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. <a name="index-JAVA_005fHOME-74"></a><samp><span class="env">JAVA_HOME</span></samp> can be set to point to a specific JRE/JDK. <p>Principal amongst these are setting some library paths to the Java libraries and JVM, which are stored in environment variable <a name="index-R_005fJAVA_005fLD_005fLIBRARY_005fPATH-75"></a><samp><span class="env">R_JAVA_LD_LIBRARY_PATH</span></samp> in file <samp><var>R_HOME</var><span class="file">/etc/ldpaths</span></samp> (or a sub-architecture-specific version). A typical setting for ‘<samp><span class="samp">x86_64</span></samp>’ Linux is <pre class="example"> JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/jre R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/amd64/server </pre> <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><span class="file">etc/Makeconf</span></samp> and <samp><var>R_HOME</var><span class="file">/etc/ldpaths</span></samp>. See <code>R CMD javareconf --help</code> for details. <p>Another way of overriding those settings is to set the environment variable <a name="index-R_005fJAVA_005fLD_005fLIBRARY_005fPATH-76"></a><samp><span class="env">R_JAVA_LD_LIBRARY_PATH</span></samp> (before R is started, hence not in <samp><span class="file">~/.Renviron</span></samp>), which suffices to run already-installed Java-using packages. For example <pre class="example"> R_JAVA_LD_LIBRARY_PATH=/usr/lib/jvm/java-1.7.0/jre/lib/amd64/server </pre> <p>It may be possible to avoid this by specifying an invariant link as the path. For example, on that system either of <pre class="example"> JAVA_HOME=/usr/lib/jvm/java-1.7.0 JAVA_HOME=/usr/lib/jvm/java-1.7.0/jre </pre> <p class="noindent">worked. <div class="node"> <a name="Linear-algebra"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Useful-libraries-and-programs">Useful libraries and programs</a>, Up: <a rel="up" accesskey="u" href="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Essential and useful other programs under a Unix-alike</a> </div> <h3 class="section">A.3 Linear algebra</h3> <p><a name="index-BLAS-library-77"></a> <ul class="menu"> <li><a accesskey="1" href="#BLAS">BLAS</a> <li><a accesskey="2" href="#LAPACK">LAPACK</a> <li><a accesskey="3" href="#Caveats">Caveats</a> </ul> <div class="node"> <a name="BLAS"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#LAPACK">LAPACK</a>, Previous: <a rel="previous" accesskey="p" href="#Linear-algebra">Linear algebra</a>, Up: <a rel="up" accesskey="u" href="#Linear-algebra">Linear algebra</a> </div> <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>You can specify a particular <acronym>BLAS</acronym> library <em>via</em> a value for the configuration option <samp><span class="option">--with-blas</span></samp> and not to use an external <acronym>BLAS</acronym> library by <samp><span class="option">--without-blas</span></samp> (the default). If <samp><span class="option">--with-blas</span></samp> is given with no <code>=</code>, its value is taken from the <a name="index-BLAS_005fLIBS-78"></a>environment variable <samp><span class="env">BLAS_LIBS</span></samp>, set for example in <samp><span class="file">config.site</span></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 ‘<samp><span class="samp">-l</span></samp>’, so <pre class="example"> --with-blas="foo" </pre> <p class="noindent">is an instruction to link against ‘<samp><span class="samp">-lfoo</span></samp>’ to find an external <acronym>BLAS</acronym> (which needs to be found both at link time and run time). <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>Some enhanced <acronym>BLAS</acronym>es are compiler-system-specific (<code>sunperf</code> on Solaris<a rel="footnote" href="#fn-32" name="fnd-32"><sup>32</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><span class="option">--with-blas</span></samp> with no value on the appropriate platforms. <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>. <p>Note that under Unix (but not under Windows) if R is compiled against a non-default <acronym>BLAS</acronym> and <samp><span class="option">--enable-BLAS-shlib</span></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="http://CRAN.R-project.org/package=quantreg"><strong>quantreg</strong></a> will need to be re-installed. <p>R relies on <acronym>ISO</acronym>/<acronym>IEC</acronym> 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—whereas <code>x*0</code> can be <code>NaN</code>. This is checked in the test suite. <ul class="menu"> <li><a accesskey="1" href="#ATLAS">ATLAS</a> <li><a accesskey="2" href="#ACML">ACML</a> <li><a accesskey="3" href="#Goto-and-OpenBLAS">Goto and OpenBLAS</a> <li><a accesskey="4" href="#MKL">MKL</a> <li><a accesskey="5" href="#Shared-BLAS">Shared BLAS</a> </ul> <div class="node"> <a name="ATLAS"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#ACML">ACML</a>, Previous: <a rel="previous" accesskey="p" href="#BLAS">BLAS</a>, Up: <a rel="up" accesskey="u" href="#BLAS">BLAS</a> </div> <h5 class="subsubsection">A.3.1.1 ATLAS</h5> <p>ATLAS (<a href="http://math-atlas.sourceforge.net/">http://math-atlas.sourceforge.net/</a>) is a “tuned” <acronym>BLAS</acronym> that runs on a wide range of Unix-alike platforms. Unfortunately it is usually built 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 ‘<samp><span class="samp">ix86</span></samp>’ platforms, but not always on ‘<samp><span class="samp">x86_64</span></samp>’ ones). <p>The usual way to specify ATLAS will be via <pre class="example"> --with-blas="-lf77blas -latlas" </pre> <p class="noindent">if the libraries are in the library path, otherwise by <pre class="example"> --with-blas="-L/path/to/ATLAS/libs -lf77blas -latlas" </pre> <p class="noindent">For example, ‘<samp><span class="samp">x86_64</span></samp>’ Fedora needs <pre class="example"> --with-blas="-L/usr/lib64/atlas -lf77blas -latlas" </pre> <p>For systems with multiple CPU cores it is possible to use a multi-threaded version of ATLAS, by specifying <pre class="example"> --with-blas="-lptf77blas -lpthread -latlas" </pre> <p>Consult its file <samp><span class="file">INSTALL.txt</span></samp> for how to build ATLAS with position-independent code: that file also describes how to build ATLAS as a shared library. <div class="node"> <a name="ACML"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Goto-and-OpenBLAS">Goto and OpenBLAS</a>, Previous: <a rel="previous" accesskey="p" href="#ATLAS">ATLAS</a>, Up: <a rel="up" accesskey="u" href="#BLAS">BLAS</a> </div> <h5 class="subsubsection">A.3.1.2 ACML</h5> <!-- : there used to be Solaris 10, but it seems no more. --> <p>For ‘<samp><span class="samp">x86_64</span></samp>’ and ‘<samp><span class="samp">i686</span></samp>’ processors under Linux there is the AMD Core Math Library (ACML) <a href="http://www.amd.com/acml">http://www.amd.com/acml</a>. For the <samp><span class="command">gcc</span></samp> version we could use <pre class="example"> --with-blas="-lacml" </pre> <p class="noindent">if the appropriate library directory (such as <a name="index-LD_005fLIBRARY_005fPATH-79"></a><samp><span class="file">/opt/acml5.1.0/gfortran64/lib</span></samp>) is in the <samp><span class="env">LD_LIBRARY_PATH</span></samp>. For other compilers, see the ACML documentation. There is a multithreaded Linux version of ACML available for recent versions of <samp><span class="command">gfortran</span></samp>. To make use of this you will need something like <pre class="example"> --with-blas="-L/opt/acml5.1.0/gfortran64_mp/lib -lacml_mp" </pre> <p class="noindent">(and you may need to arrange for the directory to be in <samp><span class="command">ld.so</span></samp> cache). <p>See see <a href="#Shared-BLAS">Shared BLAS</a> for an alternative (and in many ways preferable) way to use ACML. <p>The version last tested (5.1.0) failed the <samp><span class="file">reg-BLAS.R</span></samp> test in its handling of <code>NA</code>s. <div class="node"> <a name="Goto-and-OpenBLAS"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#MKL">MKL</a>, Previous: <a rel="previous" accesskey="p" href="#ACML">ACML</a>, Up: <a rel="up" accesskey="u" href="#BLAS">BLAS</a> </div> <h5 class="subsubsection">A.3.1.3 Goto and OpenBLAS</h5> <p>Dr Kazushige Goto wrote another tuned <acronym>BLAS</acronym> which is available for several processors and OSes. The final version is known as GotoBLAS2, and was re-released under a much less restrictive licence. Source code can be obtained from <a href="http://www.tacc.utexas.edu/tacc-projects/gotoblas2/">http://www.tacc.utexas.edu/tacc-projects/gotoblas2/</a> <p>Once it is built and installed, it can be used by configuring R with <pre class="example"> --with-blas="-lgoto2" </pre> <p>See see <a href="#Shared-BLAS">Shared BLAS</a> for an alternative (and in many ways preferable) way to use it. <p>Our understanding is that this project is now frozen and so will not be updated for CPUs released since mid-2010. However, OpenBLAS (<a href="http://xianyi.github.com/OpenBLAS/">http://xianyi.github.com/OpenBLAS/</a>) is a descendant project with support for some current CPUs (e.g. Intel Sandy Bridge and AMD Bulldozer). <div class="node"> <a name="MKL"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Shared-BLAS">Shared BLAS</a>, Previous: <a rel="previous" accesskey="p" href="#Goto-and-OpenBLAS">Goto and OpenBLAS</a>, Up: <a rel="up" accesskey="u" href="#BLAS">BLAS</a> </div> <h5 class="subsubsection">A.3.1.4 Intel MKL</h5> <p>For Intel processors<a rel="footnote" href="#fn-33" name="fnd-33"><sup>33</sup></a> under Linux, there is Intel's Math Kernel Library (<a href="http://www.intel.com/software/products/mkl/">http://www.intel.com/software/products/mkl/</a>). You are strongly encouraged to read the MKL User's Guide, which is installed with the library, before attempting to link to MKL. There are also versions of MKL for OS X and Windows, but they did not work with the standard compilers used for R on those platforms. <p>The MKL interface has changed several times, and may change again: the following notes apply exactly only to version 10.3. <p>Version 10 of MKL supports two linking models: the default model, which is backward compatible with version 9 (see below), and the pure layered model. The layered model gives the user fine-grained control over four different library layers: interface, threading, computation, and run-time library support. Some examples of linking to MKL using this layered model are given below. (These examples are for GCC compilers on ‘<samp><span class="samp">x86_64</span></samp>’.) The choice of interface layer is important on ‘<samp><span class="samp">x86_64</span></samp>’ since the Intel Fortran compiler returns complex values in different registers from the <acronym>GNU</acronym> Fortran compiler. You must therefore use the interface layer that matches your compiler (<code>mkl_intel*</code> or <code>mkl_gf*</code>). <p>R can be linked to a sequential version of MKL by something like <pre class="example"> MKL_LIB_PATH=/opt/intel/mkl/10.311.339/lib/intel64/ export LD_LIBRARY_PATH=$MKL_LIB_PATH MKL="-L${MKL_LIB_PATH} -lmkl_gf_lp64 -lmkl_sequential -lmkl_core" ./configure --with-blas="$MKL" --with-lapack </pre> <p class="noindent">where some versions may need <code>-lmkl_lapack</code> before <code>-lmkl_core</code>. The order of the libraries is important. The option <samp><span class="option">--with-lapack</span></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>Threaded MKL may be used (according to Zhang Zhang of Intel) by replacing the line defining the variable <code>MKL</code> with (Intel OMP) <pre class="example"> MKL="-L${MKL_LIB_PATH} -lmkl_gf_lp64 -lmkl_intel_thread \ -lmkl_core -liomp5 -lpthread" </pre> <p class="noindent">or (GNU OMP) <pre class="example"> MKL="-L${MKL_LIB_PATH} -lmkl_gf_lp64 -lmkl_gnu_thread \ -lmkl_core -fopenmp -lpthread" </pre> <p class="noindent">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 produce a sensible value for sole use of the machine. <p>Static threaded MKL may be used (GNU OpenMP) with something like <pre class="example"> MKL=" -L${MKL_LIB_PATH} \ -Wl,--start-group \ ${MKL_LIB_PATH}/libmkl_gf_lp64.a \ ${MKL_LIB_PATH}/libmkl_gnu_thread.a \ ${MKL_LIB_PATH}/libmkl_core.a \ -Wl,--end-group \ -lgomp -lpthread" </pre> <p class="noindent">(Thanks to Ei-ji Nakama). <p>The MKL documentation includes a ‘link line advisor’ which will suggest appropriate incantations: an on-line version was available at <a href="http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/">http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/</a> <p>The default linking model, which was also used by version 9 of MKL, can be used by <pre class="example"> --with-blas="-lmkl -lguide -lpthread" </pre> <p class="noindent">but this may not match your compiler on a 64-bit platform. This is multi-threaded, but in version 9 the number of threads defaults to 1. It can be increased by setting <code>OMP_NUM_THREADS</code>. (Thanks to Andy Liaw for the information.) <div class="node"> <a name="Shared-BLAS"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#MKL">MKL</a>, Up: <a rel="up" accesskey="u" href="#BLAS">BLAS</a> </div> <h5 class="subsubsection">A.3.1.5 Shared BLAS</h5> <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>R offers the option of compiling the <acronym>BLAS</acronym> into a dynamic library <code>libRblas</code> stored in <samp><var>R_HOME</var><span class="file">/lib</span></samp> and linking both R itself and all the add-on packages against that library. <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><span class="option">--enable-BLAS-shlib</span></samp>, and it can always be disabled via <samp><span class="option">--disable-BLAS-shlib</span></samp>. <p>This has both advantages and disadvantages. <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>There may be performance disadvantages in using a shared <acronym>BLAS</acronym>. Probably the most likely is when R'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><span class="file">R.bin</span></samp> (and <samp><span class="file">libR.a</span></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>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><span class="file">/etc/ldpaths</span></samp>. </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's) to <samp><var>R_HOME</var><span class="file">/lib/libRblas.so</span></samp>. For example, just <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> <p>will change the <acronym>BLAS</acronym> in use to multithreaded ACML. A similar link works for some versions of the Goto <acronym>BLAS</acronym> and perhaps for MKL (provided the appropriate <samp><span class="file">lib</span></samp> directory is in the run-time library path or <samp><span class="command">ld.so</span></samp> cache). <div class="node"> <a name="LAPACK"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Caveats">Caveats</a>, Previous: <a rel="previous" accesskey="p" href="#BLAS">BLAS</a>, Up: <a rel="up" accesskey="u" href="#Linear-algebra">Linear algebra</a> </div> <h4 class="subsection">A.3.2 LAPACK</h4> <p><a name="index-LAPACK-library-80"></a>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 ‘<samp><span class="samp">ix86</span></samp>’/‘<samp><span class="samp">x86_64</span></samp>’ Linux). At least LAPACK version 3.2 is required. This can only be done if <samp><span class="option">--with-blas</span></samp> has been used. <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><span class="option">--with-lapack</span></samp>. The default for <samp><span class="option">--with-lapack</span></samp> is to check the <acronym>BLAS</acronym> library and then look for an external library ‘<samp><span class="samp">-llapack</span></samp>’. 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 <pre class="example"> --with-lapack="-L/path/to/ATLAS/libs -llapack -lcblas" </pre> <p class="noindent">since the ATLAS subset of LAPACK depends on <code>libcblas</code>. A value for <samp><span class="option">--with-lapack</span></samp> can be set <em>via</em> the environment variable <a name="index-LAPACK_005fLIBS-81"></a><samp><span class="env">LAPACK_LIBS</span></samp>, but this will only be used if <samp><span class="option">--with-lapack</span></samp> is specified (as the default value is <code>no</code>) and the <acronym>BLAS</acronym> library does not contain LAPACK. <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><span class="option">--with-lapack</span></samp>. <p>If you do use <samp><span class="option">--with-lapack</span></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 <pre class="example"> DGEBRD gave error code -10 </pre> <p class="noindent">. Other potential problems are incomplete versions of the libraries, seen several times in Linux distributions over the years. <p>Please <strong>do</strong> bear in mind that using <samp><span class="option">--with-lapack</span></samp> is ‘definitely <strong>not</strong> recommended’: 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>Note too the comments about <acronym>ISO</acronym>/<acronym>IEC</acronym> 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 <blockquote> 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. </blockquote> <p>We rely on limited support in LAPACK for matrices with 2^31 or more elements: it is quite possible that an external LAPACK will not have that support. <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 <pre class="example"> -with-lapack="-lclapack -lf2c" </pre> <p class="noindent">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 <pre class="example"> -with-lapack="-lclapack -lcblas -lf2c" </pre> <div class="node"> <a name="Caveats"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#LAPACK">LAPACK</a>, Up: <a rel="up" accesskey="u" href="#Linear-algebra">Linear algebra</a> </div> <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><span class="option">-dalign</span></samp> is needed so <code>sunperf</code> can be used. <p>On some systems it is necessary that an external <acronym>BLAS</acronym>/LAPACK was built with the same FORTRAN compiler used to build R: known problems are with R built with <samp><span class="command">gfortran</span></samp>, see <a href="#Using-gfortran">Using gfortran</a>. <div class="node"> <a name="Configuration-on-a-Unix-alike"></a> <a name="Configuration-on-a-Unix_002dalike"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Platform-notes">Platform notes</a>, Previous: <a rel="previous" accesskey="p" href="#Essential-and-useful-other-programs-under-a-Unix_002dalike">Essential and useful other programs under a Unix-alike</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <h2 class="appendix">Appendix B Configuration on a Unix-alike</h2> <ul class="menu"> <li><a accesskey="1" href="#Configuration-options">Configuration options</a> <li><a accesskey="2" href="#Internationalization-support">Internationalization support</a> <li><a accesskey="3" href="#Configuration-variables">Configuration variables</a> <li><a accesskey="4" href="#Setting-the-shell">Setting the shell</a> <li><a accesskey="5" href="#Using-make">Using make</a> <li><a accesskey="6" href="#Using-FORTRAN">Using FORTRAN</a> <li><a accesskey="7" href="#Compile-and-load-flags">Compile and load flags</a> </ul> <div class="node"> <a name="Configuration-options"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Internationalization-support">Internationalization support</a>, Previous: <a rel="previous" accesskey="p" href="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a>, Up: <a rel="up" accesskey="u" href="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a> </div> <h3 class="section">B.1 Configuration options</h3> <p><samp><span class="command">configure</span></samp> has many options: running <pre class="example"> ./configure --help </pre> <p class="noindent">will give a list. Probably the most important ones not covered elsewhere are (defaults in brackets) <dl> <dt><samp><span class="option">--with-x</span></samp><dd>use the X Window System [yes] <br><dt><samp><span class="option">--x-includes=</span><var>DIR</var></samp><dd>X include files are in <var>DIR</var> <br><dt><samp><span class="option">--x-libraries=</span><var>DIR</var></samp><dd>X library files are in <var>DIR</var> <br><dt><samp><span class="option">--with-readline</span></samp><dd>use readline library (if available) [yes] <br><dt><samp><span class="option">--enable-R-profiling</span></samp><dd>attempt to compile support for <code>Rprof()</code> [yes] <br><dt><samp><span class="option">--enable-memory-profiling</span></samp><dd>attempt to compile support for <code>Rprofmem()</code> and <code>tracemem()</code> [no] <br><dt><samp><span class="option">--enable-R-shlib</span></samp><dd>build R as a shared/dynamic library [no] <br><dt><samp><span class="option">--enable-BLAS-shlib</span></samp><dd>build the <acronym>BLAS</acronym> as a shared/dynamic library [yes, except on AIX] </dl> <p class="noindent">You can use <samp><span class="option">--without-foo</span></samp> or <samp><span class="option">--disable-foo</span></samp> for the negatives. <p>You will want to use <samp><span class="option">--disable-R-profiling</span></samp> if you are building a profiled executable of R (e.g. with ‘<samp><span class="samp">-pg)</span></samp>’. <p>Flag <samp><span class="option">--enable-R-shlib</span></samp> causes the make process to build R as a dynamic (shared) library, typically called <samp><span class="file">libR.so</span></samp>, and link the main R executable <samp><span class="file">R.bin</span></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 rel="footnote" href="#fn-34" name="fnd-34"><sup>34</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><span class="option">--enable-R-shlib</span></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>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. <div class="node"> <a name="Internationalization-support"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Configuration-variables">Configuration variables</a>, Previous: <a rel="previous" accesskey="p" href="#Configuration-options">Configuration options</a>, Up: <a rel="up" accesskey="u" href="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a> </div> <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><span class="option">--disable-nls</span></samp>. The <code>configure</code> report will show <code>NLS</code> as one of the ‘Additional capabilities’ if support has been compiled in, and running in an English locale (but not the <code>C</code> locale) will include <pre class="example"> Natural language support but running in an English locale </pre> <p class="noindent">in the greeting on starting R. <div class="node"> <a name="Configuration-variables"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Setting-the-shell">Setting the shell</a>, Previous: <a rel="previous" accesskey="p" href="#Internationalization-support">Internationalization support</a>, Up: <a rel="up" accesskey="u" href="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a> </div> <h3 class="section">B.3 Configuration variables</h3> <p><a name="index-configure-82"></a>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><span class="file">config.site</span></samp> (which documents many of the variables you might want to set: others can be seen in file <samp><span class="file">etc/Renviron.in</span></samp>) or on the command line as <pre class="example"> ./configure <var>VAR</var>=<var>value</var> </pre> <p class="noindent">If you are building in a directory different from the sources, there can be copies of <samp><span class="file">config.site</span></samp> in the source and the build directories, and both will be read (in that order). In addition, if there is a file <samp><span class="file">~/.R/config</span></samp>, it is read between the <samp><span class="file">config.site</span></samp> files in the source and the build directories. <p>There is also a general <samp><span class="command">autoconf</span></samp> mechanism for <samp><span class="file">config.site</span></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-83"></a>environment variable <samp><span class="env">CONFIG_SITE</span></samp>, and if not is set at files such as <samp><span class="file">/usr/local/share/config.site</span></samp> and <samp><span class="file">/usr/local/etc/config.site</span></samp> in the area (exemplified by <samp><span class="file">/usr/local</span></samp>) where R would be installed. <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>See the variable output section of <code>configure --help</code> for a list of all these variables. <p>If you find you need to alter configure variables, it is worth noting that some settings may be cached in the file <samp><span class="file">config.cache</span></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><span class="option">--config-cache</span></samp> (or <samp><span class="option">-C</span></samp>) to enable caching. <ul class="menu"> <li><a accesskey="1" href="#Setting-paper-size">Setting paper size</a> <li><a accesskey="2" href="#Setting-the-browsers">Setting the browsers</a> <li><a accesskey="3" href="#Compilation-flags">Compilation flags</a> <li><a accesskey="4" href="#Making-manuals">Making manuals</a> </ul> <div class="node"> <a name="Setting-paper-size"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Setting-the-browsers">Setting the browsers</a>, Previous: <a rel="previous" accesskey="p" href="#Configuration-variables">Configuration variables</a>, Up: <a rel="up" accesskey="u" href="#Configuration-variables">Configuration variables</a> </div> <h4 class="subsection">B.3.1 Setting paper size</h4> <p><a name="index-R_005fPAPERSIZE-84"></a>One common variable to change is <samp><span class="env">R_PAPERSIZE</span></samp>, which defaults to ‘<samp><span class="samp">a4</span></samp>’, not ‘<samp><span class="samp">letter</span></samp>’. (Valid values are ‘<samp><span class="samp">a4</span></samp>’, ‘<samp><span class="samp">letter</span></samp>’, ‘<samp><span class="samp">legal</span></samp>’ and ‘<samp><span class="samp">executive</span></samp>’.) <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>The configure default will most often be ‘<samp><span class="samp">a4</span></samp>’ if <samp><span class="env">R_PAPERSIZE</span></samp> is unset. (If the (Debian Linux) program <samp><span class="command">paperconf</span></samp> is found <a name="index-PAPERSIZE-85"></a>or the environment variable <samp><span class="env">PAPERSIZE</span></samp> is set, these are used to produce the default.) <div class="node"> <a name="Setting-the-browsers"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Compilation-flags">Compilation flags</a>, Previous: <a rel="previous" accesskey="p" href="#Setting-paper-size">Setting paper size</a>, Up: <a rel="up" accesskey="u" href="#Configuration-variables">Configuration variables</a> </div> <h4 class="subsection">B.3.2 Setting the browsers</h4> <p><a name="index-R_005fBROWSER-86"></a>Another precious variable is <samp><span class="env">R_BROWSER</span></samp>, the default <acronym>HTML</acronym> browser, which should take a value of an executable in the user's path or specify a full path. <p><a name="index-R_005fPDFVIEWER-87"></a>Its counterpart for PDF files is <samp><span class="env">R_PDFVIEWER</span></samp>. <div class="node"> <a name="Compilation-flags"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Making-manuals">Making manuals</a>, Previous: <a rel="previous" accesskey="p" href="#Setting-the-browsers">Setting the browsers</a>, Up: <a rel="up" accesskey="u" href="#Configuration-variables">Configuration variables</a> </div> <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 ‘<samp><span class="samp">-L</span></samp>’ flags to be passed to the linker) and <code>CPPFLAGS</code> (for header files, using ‘<samp><span class="samp">-I</span></samp>’ flags to be passed to the C/C++ preprocessors), respectively, to specify these locations. These default to ‘<samp><span class="samp">-L/usr/local/lib</span></samp>’ (<code>LDFLAGS</code>, ‘<samp><span class="samp">-L/usr/local/lib64</span></samp>’ on most 64-bit Linux OSes) and ‘<samp><span class="samp">-I/usr/local/include</span></samp>’ (<code>CPPFLAGS</code>) to catch the most common cases. If libraries are still not found, then maybe your compiler/linker does not support re-ordering of <samp><span class="option">-L</span></samp> and <samp><span class="option">-l</span></samp> flags (this has been reported to be a problem on HP-UX with the native <samp><span class="command">cc</span></samp>). In this case, use a different compiler (or a front end shell script which does the re-ordering). <p>These flags can also be used to build a faster-running version of R. On most platforms using <samp><span class="command">gcc</span></samp>, having ‘<samp><span class="samp">-O3</span></samp>’ in <code>CFLAGS</code> and <code>FFLAGS</code> produces worthwhile performance gains with <samp><span class="command">gcc</span></samp> and <samp><span class="command">gfortran</span></samp>, but may result in a less reliable build (both segfaults and incorrect numeric computations have been seen). On systems using the <acronym>GNU</acronym> linker (especially those using R as a shared library), it is likely that including ‘<samp><span class="samp">-Wl,-O1</span></samp>’ in <code>LDFLAGS</code> is worthwhile, and ‘<samp><span class="samp">'-Bdirect,--hash-style=both,-Wl,-O1'</span></samp>’ is recommended at <a href="http://lwn.net/Articles/192624/">http://lwn.net/Articles/192624/</a>. Tuning compilation to a specific <acronym>CPU</acronym> family (e.g. ‘<samp><span class="samp">-mtune=native</span></samp>’ for <samp><span class="command">gcc</span></samp>) can give worthwhile performance gains, especially on older architectures such as ‘<samp><span class="samp">ix86</span></samp>’. <div class="node"> <a name="Making-manuals"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Compilation-flags">Compilation flags</a>, Up: <a rel="up" accesskey="u" href="#Configuration-variables">Configuration variables</a> </div> <h4 class="subsection">B.3.4 Making manuals</h4> <p><a name="index-R_005fRD4PDF-88"></a><a name="index-R_005fPAPERSIZE-89"></a>The default settings for making the manuals are controlled by <samp><span class="env">R_RD4PDF</span></samp> and <samp><span class="env">R_PAPERSIZE</span></samp>. <div class="node"> <a name="Setting-the-shell"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Using-make">Using make</a>, Previous: <a rel="previous" accesskey="p" href="#Configuration-variables">Configuration variables</a>, Up: <a rel="up" accesskey="u" href="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a> </div> <h3 class="section">B.4 Setting the shell</h3> <p>By default the shell scripts such as <samp><span class="file">R</span></samp> will be ‘<samp><span class="samp">#!/bin/sh</span></samp>’ scripts (or using the <samp><span class="env">SHELL</span></samp> chosen by <samp><span class="file">configure</span></samp>). This is almost always satisfactory, but on a few systems <samp><span class="file">/bin/sh</span></samp> is not a Bourne shell or clone, and the shell to be used can be changed by setting the configure variable <samp><span class="env">R_SHELL</span></samp> to a suitable value (a full path to a shell, e.g. <samp><span class="file">/usr/local/bin/bash</span></samp>). <div class="node"> <a name="Using-make"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Using-FORTRAN">Using FORTRAN</a>, Previous: <a rel="previous" accesskey="p" href="#Setting-the-shell">Setting the shell</a>, Up: <a rel="up" accesskey="u" href="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a> </div> <h3 class="section">B.5 Using make</h3> <p><a name="index-make-90"></a> To compile R, you will most likely find it easiest to use <acronym>GNU</acronym> <samp><span class="command">make</span></samp>, although the Sun <samp><span class="command">make</span></samp> works on Solaris, as does the native FreeBSD <samp><span class="command">make</span></samp>. The native <samp><span class="command">make</span></samp> has been reported to fail on SGI Irix 6.5 and Alpha/OSF1 (aka Tru64). <p>To build in a separate directory you need a <samp><span class="command">make</span></samp> that uses the <code>VPATH</code> variable, for example <acronym>GNU</acronym> <samp><span class="command">make</span></samp>, or Sun <samp><span class="command">make</span></samp> on Solaris 7 or later. <p><samp><span class="command">dmake</span></samp> has also been used. e.g, on Solaris 10. <p>If you want to use a <samp><span class="command">make</span></samp> by another name, for example if your <acronym>GNU</acronym> <samp><span class="command">make</span></samp> is called ‘<samp><span class="samp">gmake</span></samp>’, you need to set the variable <code>MAKE</code> at configure time, for example <p><a name="index-configure-91"></a> <pre class="example"> ./configure MAKE=gmake </pre> <div class="node"> <a name="Using-FORTRAN"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Compile-and-load-flags">Compile and load flags</a>, Previous: <a rel="previous" accesskey="p" href="#Using-make">Using make</a>, Up: <a rel="up" accesskey="u" href="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a> </div> <h3 class="section">B.6 Using FORTRAN</h3> <p><a name="index-FORTRAN-92"></a> <ul class="menu"> <li><a accesskey="1" href="#Using-gfortran">Using gfortran</a> </ul> <p>To compile R, you need a FORTRAN compiler. The default is to search for <!-- F95_compilers in m4/R.m4: --> <samp><span class="command">f95</span></samp>, <samp><span class="command">fort</span></samp>, <samp><span class="command">xlf95</span></samp>, <samp><span class="command">ifort</span></samp>, <samp><span class="command">ifc</span></samp>, <samp><span class="command">efc</span></samp>, <samp><span class="command">pgf95</span></samp> <samp><span class="command">lf95</span></samp>, <samp><span class="command">gfortran</span></samp>, <samp><span class="command">ftn</span></samp>, <samp><span class="command">g95</span></samp>, <!-- F90 compilers in m4/R.m4: --> <samp><span class="command">f90</span></samp>, <samp><span class="command">xlf90</span></samp>, <samp><span class="command">pghpf</span></samp>, <samp><span class="command">pgf90</span></samp>, <samp><span class="command">epcf90</span></samp>, <!-- F77 compilers in m4/R.m4: --> <samp><span class="command">g77</span></samp>, <samp><span class="command">f77</span></samp>, <samp><span class="command">xlf</span></samp>, <samp><span class="command">frt</span></samp>, <samp><span class="command">pgf77</span></samp>, <samp><span class="command">cf77</span></samp>, <samp><span class="command">fort77</span></samp>, <samp><span class="command">fl32</span></samp>, <samp><span class="command">af77</span></samp> (in that order)<a rel="footnote" href="#fn-35" name="fnd-35"><sup>35</sup></a>, and use whichever is found first; if none is found, R cannot be compiled. <!-- GCC_Fortran_compiler in m4/R.m4: --> However, if <samp><span class="command">CC</span></samp> is <samp><span class="command">gcc</span></samp>, the matching FORTRAN compiler (<samp><span class="command">g77</span></samp> for <samp><span class="command">gcc</span></samp> 3 and <code>gfortran</code> for <samp><span class="command">gcc</span></samp> 4) is used if available. <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-93"></a>should set the environment variable <samp><span class="env">PATH</span></samp> accordingly before running <samp><span class="command">configure</span></samp>, or use the configure variable <code>F77</code> to specify its full path. <p>If your FORTRAN libraries are in slightly peculiar places, you should <a name="index-LD_005fLIBRARY_005fPATH-94"></a>also look at <samp><span class="env">LD_LIBRARY_PATH</span></samp> or your system's equivalent to make sure that all libraries are on this path. <p>Note that only FORTRAN compilers which convert identifiers to lower case are supported. <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>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 rel="footnote" href="#fn-36" name="fnd-36"><sup>36</sup></a>, but you may need to avoid compiler flags asserting FORTRAN 77 compliance. <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>It might be possible to use <samp><span class="command">f2c</span></samp>, 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><span class="file">scripts/f77_f2c</span></samp>: this can be customized by setting <a name="index-F2C-95"></a><a name="index-F2CLIBS-96"></a><a name="index-CC-97"></a>the environment variables <samp><span class="env">F2C</span></samp>, <samp><span class="env">F2CLIBS</span></samp>, <samp><span class="env">CC</span></samp> and <a name="index-CPP-98"></a><samp><span class="env">CPP</span></samp>.) You will need to ensure that the FORTRAN type <code>integer</code> is translated to the C type <code>int</code>. Normally <samp><span class="file">f2c.h</span></samp> contains ‘<samp><span class="samp">typedef long int integer;</span></samp>’, which will work on a 32-bit platform but needs to be changed to ‘<samp><span class="samp">typedef int integer;</span></samp>’ on a 64-bit platform. If your compiler is not <samp><span class="command">gcc</span></samp> you will need to set <a name="index-FPICFLAGS-99"></a><samp><span class="env">FPICFLAGS</span></samp> appropriately. Also, the included LAPACK sources contain constructs that <samp><span class="command">f2c</span></samp> 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>). <div class="node"> <a name="Using-gfortran"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Using-FORTRAN">Using FORTRAN</a>, Up: <a rel="up" accesskey="u" href="#Using-FORTRAN">Using FORTRAN</a> </div> <h4 class="subsection">B.6.1 Using gfortran</h4> <p><samp><span class="command">gfortran</span></samp> is the F95 compiler that is part of <samp><span class="command">gcc</span></samp> 4.<var>x</var>.<var>y</var>. <p>On Linux ‘<samp><span class="samp">x86_64</span></samp>’ systems there is an incompatibility in the return conventions for double-complex functions between <samp><span class="command">gfortran</span></samp> and <samp><span class="command">g77</span></samp> which results in the final example in <code>example(eigen)</code> hanging or segfaulting under external <acronym>BLAS</acronym>s built under <samp><span class="command">g77</span></samp> (and also some external LAPACKs). The commonest cases will be detected by a <samp><span class="command">configure</span></samp> test. Although <samp><span class="command">g77</span></samp> is long obsolete this is still sometimes seen with C versions of external software using <samp><span class="command">g77</span></samp> conventions. <p>The default <code>FFLAGS</code> and <code>FCFLAGS</code> chosen (by <samp><span class="command">autoconf</span></samp>) for a <acronym>GNU</acronym> FORTRAN compiler is ‘<samp><span class="samp">-g -O2</span></samp>’. This has caused problems (segfaults and infinite loops) on ‘<samp><span class="samp">x86_64</span></samp>’ Linux in the past, but seems fine with <samp><span class="command">gfortran 4.4.4</span></samp> and later: for <code>gfortran 4.3.x</code> set <code>FFLAGS</code> and <code>FCFLAGS</code> to use at most ‘<samp><span class="samp">-O</span></samp>’. <div class="node"> <a name="Compile-and-load-flags"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Using-FORTRAN">Using FORTRAN</a>, Up: <a rel="up" accesskey="u" href="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a> </div> <h3 class="section">B.7 Compile and load flags</h3> <p>A wide range of flags can be set in the file <samp><span class="file">config.site</span></samp> or as configure variables on the command line. We have already mentioned <dl> <dt><code>CPPFLAGS</code><dd>header file search directory (<samp><span class="option">-I</span></samp>) and any other miscellaneous options for the C and C++ preprocessors and compilers <br><dt><code>LDFLAGS</code><dd>path (<samp><span class="option">-L</span></samp>), stripping (<samp><span class="option">-s</span></samp>) and any other miscellaneous options for the linker </dl> <p class="noindent">and others include <dl> <dt><code>CFLAGS</code><dd>debugging and optimization flags, C <br><dt><code>MAIN_CFLAGS</code><dd>ditto, for compiling the main program <br><dt><code>SHLIB_CFLAGS</code><dd>for shared objects <br><dt><code>FFLAGS</code><dd>debugging and optimization flags, FORTRAN <br><dt><code>SAFE_FFLAGS</code><dd>ditto for source files which need exact floating point behaviour <br><dt><code>MAIN_FFLAGS</code><dd>ditto, for compiling the main program <br><dt><code>SHLIB_FFLAGS</code><dd>for shared objects <br><dt><code>MAIN_LDFLAGS</code><dd>additional flags for the main link <br><dt><code>SHLIB_LDFLAGS</code><dd>additional flags for linking the shared objects <br><dt><code>LIBnn</code><dd>the primary library directory, <samp><span class="file">lib</span></samp> or <samp><span class="file">lib64</span></samp> <br><dt><code>CPICFLAGS</code><dd>special flags for compiling C code to be turned into a shared object <br><dt><code>FPICFLAGS</code><dd>special flags for compiling Fortran code to be turned into a shared object <br><dt><code>CXXPICFLAGS</code><dd>special flags for compiling C++ code to be turned into a shared object <br><dt><code>FCPICFLAGS</code><dd>special flags for compiling Fortran 95 code to be turned into a shared object <br><dt><code>DEFS</code><dd>defines to be used when compiling C code in R itself </dl> <p class="noindent">Library paths specified as <samp><span class="option">-L/lib/path</span></samp> in <code>LDFLAGS</code> are <a name="index-LD_005fLIBRARY_005fPATH-100"></a>collected together and prepended to <samp><span class="env">LD_LIBRARY_PATH</span></samp> (or your system's equivalent), so there should be no need for <samp><span class="option">-R</span></samp> or <samp><span class="option">-rpath</span></samp> flags. <p>Variables such as <samp><span class="env">CPICFLAGS</span></samp> are determined where possible by <samp><span class="command">configure</span></samp>. Some systems allows two types of PIC flags, for example ‘<samp><span class="samp">-fpic</span></samp>’ and ‘<samp><span class="samp">-fPIC</span></samp>’, and if they differ the first allows only a limited number of symbols in a shared object. Since R as a shared library has about 6200 symbols, if in doubt use the larger version. <p>To compile a profiling version of R, one might for example want to use ‘<samp><span class="samp">MAIN_CFLAGS=-pg</span></samp>’, ‘<samp><span class="samp">MAIN_FFLAGS=-pg</span></samp>’, ‘<samp><span class="samp">MAIN_LDFLAGS=-pg</span></samp>’ on platforms where ‘<samp><span class="samp">-pg</span></samp>’ cannot be used with position-independent code. <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>On some platforms <samp><span class="command">configure</span></samp> will select additional flags for <code>CFLAGS</code>, <code>CPPFLAGS</code>, <code>FFLAGS</code>, <code>CXXFLAGS</code> and <code>LIBS</code> in <code>R_XTRA_CFLAGS</code> (and so on). These are for options which are always required, for example to force <acronym>IEC</acronym> 60559 compliance. <div class="node"> <a name="Platform-notes"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#The-Windows-toolset">The Windows toolset</a>, Previous: <a rel="previous" accesskey="p" href="#Configuration-on-a-Unix_002dalike">Configuration on a Unix-alike</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <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>Older versions of this manual (for R < 2.10.0) contain notes on platforms such as HP-UX, IRIX and Alpha/OSF1 for which we have had no recent reports. <p>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 <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> <ul class="menu"> <li><a accesskey="1" href="#X11-issues">X11 issues</a> <li><a accesskey="2" href="#Linux">Linux</a> <li><a accesskey="3" href="#OS-X">OS X</a> <li><a accesskey="4" href="#Solaris">Solaris</a> <li><a accesskey="5" href="#AIX">AIX</a> <li><a accesskey="6" href="#FreeBSD">FreeBSD</a> <li><a accesskey="7" href="#Cygwin">Cygwin</a> <li><a accesskey="8" href="#New-platforms">New platforms</a> </ul> <div class="node"> <a name="X11-issues"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Linux">Linux</a>, Previous: <a rel="previous" accesskey="p" href="#Platform-notes">Platform notes</a>, Up: <a rel="up" accesskey="u" href="#Platform-notes">Platform notes</a> </div> <h3 class="section">C.1 X11 issues</h3> <p>The ‘<samp><span class="samp">X11()</span></samp>’ 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>The ‘modern’ version of the ‘<samp><span class="samp">X11()</span></samp>’ device is based on ‘<samp><span class="samp">cairo</span></samp>’ graphics and (in most implementations) uses ‘<samp><span class="samp">fontconfig</span></samp>’ 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 ‘<samp><span class="samp">X11()</span></samp>’ discussed in the rest of this section. <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 rel="footnote" href="#fn-37" name="fnd-37"><sup>37</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's <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> <p class="noindent">and you need to ensure that the ‘<samp><span class="samp">-100dpi</span></samp>’ versions are installed and on the X11 font path (check via <samp><span class="command">xset -q</span></samp>). The ‘<samp><span class="samp">X11()</span></samp>’ 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>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>"X11fonts"</code> which defaults to <pre class="example"> "-adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*" </pre> <p>If you are using a single-byte encoding, for example ISO 8859-2 in Eastern Europe or KOI8-R in Russian, use <samp><span class="command">xlsfonts</span></samp> 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 ‘<samp><span class="samp">xorg-x11-fonts-ISO8859-2-75dpi</span></samp>’ and ‘<samp><span class="samp">xorg-x11-fonts-cyrillic</span></samp>’ shown in the listing above. <p>Multi-byte encodings (most commonly UTF-8) are even more complicated. There are few fonts in ‘<samp><span class="samp">iso10646-1</span></samp>’, 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 ‘<samp><span class="samp">XLC_LOCALE</span></samp>’ directory (typically <samp><span class="file">/usr/share/X11/locale</span></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 ‘<samp><span class="samp">ja_JP.UTF-8</span></samp>’ but not when running in ‘<samp><span class="samp">en_GB.UTF-8</span></samp>’ on the same machine (although on some systems many UTF-8 X11 locales are aliased to ‘<samp><span class="samp">en_US.UTF-8</span></samp>’ which covers several character sets, e.g. ISO 8859-1 (Western European), JISX0208 (Kanji), KSC5601 (Korean), GB2312 (Chinese Han) and JISX0201 (Kana)). <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><span class="file">fonts</span></samp> directory or elsewhere, for example, <pre class="example"> /usr/share/fonts/default/Type1 /usr/share/fonts/ja/TrueType </pre> <div class="node"> <a name="Linux"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#OS-X">OS X</a>, Previous: <a rel="previous" accesskey="p" href="#X11-issues">X11 issues</a>, Up: <a rel="up" accesskey="u" href="#Platform-notes">Platform notes</a> </div> <h3 class="section">C.2 Linux</h3> <p><a name="index-Linux-101"></a> Linux is the main development platform for R, so compilation from the sources is normally straightforward with the standard compilers. <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 ‘<samp><span class="samp">-devel</span></samp>’ or ‘<samp><span class="samp">-dev</span></samp>’: you need both versions installed. So please check the <code>configure</code> output to see if the expected features are detected: if for example ‘<samp><span class="samp">readline</span></samp>’ is missing add the developer package. (On most systems you will also need ‘<samp><span class="samp">ncurses</span></samp>’ and its developer package, although these should be dependencies of the ‘<samp><span class="samp">readline</span></samp>’ package(s).) <p>When R has been installed from a binary distribution there are sometimes problems with missing components such as the FORTRAN compiler. Searching the ‘<samp><span class="samp">R-help</span></samp>’ archives will normally reveal what is needed. <p>It seems that ‘<samp><span class="samp">ix86</span></samp>’ 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 ‘<samp><span class="samp">x86_64</span></samp>’. 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>The default optimization settings chosen for <code>CFLAGS</code> etc are conservative. It is likely that using <samp><span class="option">-mtune</span></samp> will result in significant performance improvements on recent CPUs (especially for ‘<samp><span class="samp">ix86</span></samp>’): one possibility is to add <samp><span class="option">-mtune=native</span></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><span class="option">-mtume=core2</span></samp>.<a rel="footnote" href="#fn-38" name="fnd-38"><sup>38</sup></a> It is also possible to increase the optimization levels to <samp><span class="option">-O3</span></samp>: however for many versions of the compilers this has caused problems in at least one <acronym>CRAN</acronym> package. <p>For platforms with both 64- and 32-bit support, it is likely that <pre class="example"> LDFLAGS="-L/usr/local/lib64 -L/usr/local/lib" </pre> <p class="noindent">is appropriate since most (but not all) software installs its 64-bit libraries in <samp><span class="file">/usr/local/lib64</span></samp>. To build a 32-bit version of R on ‘<samp><span class="samp">x86_64</span></samp>’ with Fedora 18 we used <pre class="example"> CC="gcc -m32" CXX="g++ -m32" F77="gfortran -m32" FC=${F77} OBJC=${CC} LDFLAGS="-L/usr/local/lib" LIBnn=lib </pre> <p class="noindent">Note the use of ‘<samp><span class="samp">LIBnn</span></samp>’: ‘<samp><span class="samp">x86_64</span></samp>’ Fedora installs its 64-bit software in <samp><span class="file">/usr/lib64</span></samp> and 32-bit software in <samp><span class="file">/usr/lib</span></samp>. Linking will skip over inappropriate binaries, but for example the 32-bit Tcl/Tk configure scripts are in <samp><span class="file">/usr/lib</span></samp>. It may also be necessary to set the <samp><span class="command">pkg-config</span></samp> path, e.g. by <pre class="example"> export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig </pre> <p>64-bit versions of Linux are built with support for files > 2Gb, and 32-bit versions will be if possible unless <samp><span class="option">--disable-largefile</span></samp> is specified. <p>To build a 64-bit version of R on ‘<samp><span class="samp">ppc64</span></samp>’ (also known as ‘<samp><span class="samp">powerpc64</span></samp>’) with <samp><span class="command">gcc</span></samp> 4.1.1, Ei-ji Nakama used <pre class="example"> CC="gcc -m64" CXX="gxx -m64" F77="gfortran -m64" FC="gfortran -m64" CFLAGS="-mminimal-toc -fno-optimize-sibling-calls -g -O2" FFLAGS="-mminimal-toc -fno-optimize-sibling-calls -g -O2" </pre> <p class="noindent">the additional flags being needed to resolve problems linking against <samp><span class="file">libnmath.a</span></samp> and when linking R as a shared library. <ul class="menu"> <li><a accesskey="1" href="#Clang">Clang</a> <li><a accesskey="2" href="#Intel-compilers">Intel compilers</a> <li><a accesskey="3" href="#Oracle-Solaris-Studio-compilers">Oracle Solaris Studio compilers</a> </ul> <div class="node"> <a name="Clang"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Intel-compilers">Intel compilers</a>, Previous: <a rel="previous" accesskey="p" href="#Linux">Linux</a>, Up: <a rel="up" accesskey="u" href="#Linux">Linux</a> </div> <h4 class="subsection">C.2.1 Clang</h4> <p>R has been built with Linux ‘<samp><span class="samp">ix86</span></samp>’ and ‘<samp><span class="samp">x86_64</span></samp>’ C and C++ compilers (<a href="http://clang.llvm.org">http://clang.llvm.org</a>, versions 3.0, 3.2 and 3.3) based on the Clang front-ends, invoked by <code>CC=clang CXX=clang++</code>, together with <samp><span class="command">gfortran</span></samp>. These take very similar options to the corresponding GCC compilers. <p>This has to be used in conjunction with a Fortran compiler: the <samp><span class="command">configure</span></samp> code will remove <samp><span class="option">-lgcc</span></samp> from <samp><span class="env">FLIBS</span></samp>, which is needed for some versions of <samp><span class="command">gfortran</span></samp>. <div class="node"> <a name="Intel-compilers"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Oracle-Solaris-Studio-compilers">Oracle Solaris Studio compilers</a>, Previous: <a rel="previous" accesskey="p" href="#Clang">Clang</a>, Up: <a rel="up" accesskey="u" href="#Linux">Linux</a> </div> <h4 class="subsection">C.2.2 Intel compilers</h4> <p>Intel compilers have been used under ‘<samp><span class="samp">ix86</span></samp>’ and ‘<samp><span class="samp">x86_64</span></samp>’ Linux. Brian Ripley used version 9.0 of the compilers for ‘<samp><span class="samp">x86_64</span></samp>’ on Fedora Core 5 with <pre class="example"> CC=icc CFLAGS="-g -O3 -wd188 -ip -mp" F77=ifort FLAGS="-g -O3 -mp" CXX=icpc CXXFLAGS="-g -O3 -mp" FC=ifort FCFLAGS="-g -O3 -mp" ICC_LIBS=/opt/compilers/intel/cce/9.1.039/lib IFC_LIBS=/opt/compilers/intel/fce/9.1.033/lib LDFLAGS="-L$ICC_LIBS -L$IFC_LIBS -L/usr/local/lib64" SHLIB_CXXLD=icpc </pre> <p class="noindent"><samp><span class="command">configure</span></samp> will add ‘<samp><span class="samp">-c99</span></samp>’ to <code>CC</code> for C99-compliance. This causes warnings with <code>icc</code> 10 and later, so use <code>CC="icc -std=c99"</code> there. The flag <samp><span class="option">-wd188</span></samp> suppresses a large number of warnings about the enumeration type ‘<samp><span class="samp">Rboolean</span></samp>’. Because the Intel C compiler sets ‘<samp><span class="samp">__GNUC__</span></samp>’ without complete emulation of <samp><span class="command">gcc</span></samp>, we suggest adding <code>CPPFLAGS=-no-gcc</code>. <p>To maintain correct <acronym>IEC</acronym> 60559 arithmetic you most likely need add flags to <code>CFLAGS</code>, <code>FFLAGS</code> and <code>CXXFLAGS</code> such as <samp><span class="option">-mp</span></samp> (shown above) or <samp><span class="option">-fp-model precise -fp-model source</span></samp>, depending on the compiler version. <p>Others have reported success with versions 10.x and 11.x. <div class="node"> <a name="Oracle-Solaris-Studio-compilers"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Intel-compilers">Intel compilers</a>, Up: <a rel="up" accesskey="u" href="#Linux">Linux</a> </div> <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, (<a href="http://developers.sun.com/sunstudio/index.jsp">http://developers.sun.com/sunstudio/index.jsp</a>) On ‘<samp><span class="samp">x86_64</span></samp>’ Linux with <pre class="example"> CC=suncc CFLAGS="-xO5 -xc99 -xlibmil -nofstore" CPICFLAGS=-Kpic F77=sunf95 FFLAGS="-O5 -libmil -nofstore" FPICFLAGS=-Kpic CXX="sunCC -library=stlport4" CXXFLAGS="-xO5 -xlibmil -nofstore -features=tmplrefstatic" 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="-O5 -libmil" </pre> <p class="noindent"><samp><span class="option">-m64</span></samp> could be added, but was the default. Do not use <samp><span class="option">-fast</span></samp>: see the warnings under Solaris. (The C++ options are also explained under Solaris.) <p>Others have found on at least some versions of ‘<samp><span class="samp">ix86</span></samp>’ Linux that the configure flag <samp><span class="option">--disable-largefile</span></samp> was needed (since <samp><span class="file">glob.h</span></samp> on that platform presumed <samp><span class="command">gcc</span></samp> was being used). <div class="node"> <a name="OS-X"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Solaris">Solaris</a>, Previous: <a rel="previous" accesskey="p" href="#Linux">Linux</a>, Up: <a rel="up" accesskey="u" href="#Platform-notes">Platform notes</a> </div> <h3 class="section">C.3 OS X</h3> <p><a name="index-OS-X-102"></a> You can build R using Apple's ‘Command Line Tools for Xcode’ and and suitable compilers. You will also need <code>readline</code> (or to configure with <samp><span class="option">--without-readline</span></samp>). <p>You may also need to install an X sub-system (or you will need to configure with <samp><span class="option">--without-x</span></samp>): X is part of the standard OS X distribution in versions prior to Mountain Lion, but not always installed. For Mountain Lion and later, see <a href="http://xquartz.macosforge.org/">http://xquartz.macosforge.org/</a>: some people prefer to use XQuartz on earlier versions of OS X instead of the Apple version. <p>In principle R can be built for 10.4.x, 10.5.x and for PowerPC Macs but this has not been tested recently: 10.6 (Snow Leopard) is the earliest version currently tested. 32-bit Intel builds of R 3.0.0 were tested: they would be needed for Snow Leopard running on very old machines with Core Solo or Core Duo CPUs. The instructions here concentrate on ‘<samp><span class="samp">x86_64</span></samp>’ builds. <p>To use the <code>quartz()</code> graphics device you need to configure with <samp><span class="option">--with-aqua</span></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 data editor/viewer. (This needs an Objective-C compiler<a rel="footnote" href="#fn-39" name="fnd-39"><sup>39</sup></a> which can compile the code for <code>quartz()</code>.) <p>Use <samp><span class="option">--without-aqua</span></samp> if you want a standard Unix-alike build: apart from disabling <code>quartz()</code> and the ability to use the build with <span class="sc">R.app</span>, it also changes the default location of the personal library (see <code>?.libPaths()</code>). Also use <samp><span class="option">--disable-R-framework</span></samp> to install in the standard layout. <p>‘Command Line Tools for Xcode’ used to be part of the Apple Developer Tools (‘Xcode’) but nowadays need 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) or if you have a recent Xcode installed (from the App Store or from <a href="https://developer.apple.com/devcenter/mac/">https://developer.apple.com/devcenter/mac/</a>) you can install the command-line tools from within Xcode, from the ‘<samp><span class="samp">Downloads</span></samp>’ pane in the ‘<samp><span class="samp">Preferences</span></samp>’. <p>Various compilers can be used. The <acronym>CRAN</acronym> distribution of R is built using <ul> <li><samp><span class="command">gcc</span></samp> from the Xcode distribution. This is a version of gcc 4.2.1 with an LLVM backend. Note that Apple have announced that Xcode 4.6 will be the last ‘release’ with this compiler (4.6.2 does contain it but 5 is expected not to), and it is likely that <samp><span class="command">clang</span></samp> will be used before R 3.1.0 is released. <li><samp><span class="command">gfortran</span></samp> 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><span class="file">/usr/local/bin</span></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><samp><span class="command">clang</span></samp> from the Xcode distribution, to compile the Objective-C parts of the <code>quartz()</code> device. </ul> <p>To use these, have in <samp><span class="file">config.site</span></samp> something like <pre class="example"> CC="llvm-gcc-4.2" CXX="llvm-g++-4.2" F77="gfortran-4.2 -arch x86_64" FC=$F77 OBJC="clang" </pre> <p class="noindent">Full names are not needed, but help to ensure that the intended compilers are used. 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>The OpenMP support in this version of <samp><span class="command">gcc</span></samp> is problematic, so the <acronym>CRAN</acronym> build is configured with <samp><span class="option">--disable-openmp</span></samp>. The alternative, <samp><span class="command">clang</span></samp>, has no OpenMP support. <p>Pre-compiled versions of many of the <a href="#Useful-libraries-and-programs">Useful libraries and programs</a> are available from <a href="http://r.research.att.com/libs/">http://r.research.att.com/libs/</a>. You will most likely want at least <code>jpeg</code>, <code>libpng</code> and <code>readline</code> (and perhaps <code>tiff</code>). <code>pkg-config</code> is not provided by Apple and useful for many packages. <p><a name="index-BLAS-library-103"></a><a name="index-LAPACK-library-104"></a>The <code>Accelerate</code> library can be used <em>via</em> the configuration options <pre class="example"> --with-blas="-framework Accelerate" --with-lapack </pre> <p class="noindent">to provide higher-performance versions of the <acronym>BLAS</acronym> and LAPACK routines. (Use of <code>Accelerate</code> with <samp><span class="option">--with-lapack</span></samp> does not work on Snow Leopard: it may work there without.) <p>Looking at the top of <samp><span class="file">/Library/Frameworks/R.framework/Resources/etc/Makeconf</span></samp> will show the compilers and configuration options used for the <acronym>CRAN</acronym> binary package for R: at the time of writing <pre class="example"> --with-system-zlib --enable-memory-profiling --disable-openmp </pre> <p class="noindent">was used. <p>The TeX implementation used by the developers is MacTeX (<a href="http://www.tug.org/mactex/">http://www.tug.org/mactex/</a>): the full installation is several gigabytes, but a smaller version (ca 300MB) is available at <a href="http://www.tug.org/mactex/morepackages.html">http://www.tug.org/mactex/morepackages.html</a>: you will want to add some packages, including <strong>inconsolata</strong>. <ul class="menu"> <li><a accesskey="1" href="#Snow-Leopard">Snow Leopard</a> <li><a accesskey="2" href="#Lion">Lion</a> <li><a accesskey="3" href="#Mountain-Lion">Mountain Lion</a> <li><a accesskey="4" href="#Mavericks">Mavericks</a> <li><a accesskey="5" href="#Tcl_002fTk-headers-and-libraries">Tcl/Tk headers and libraries</a> <li><a accesskey="6" href="#Java-_0028OS-X_0029">Java (OS X)</a> <li><a accesskey="7" href="#Frameworks">Frameworks</a> <li><a accesskey="8" href="#Building-R_002eapp">Building R.app</a> </ul> <div class="node"> <a name="Snow-Leopard"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Lion">Lion</a>, Previous: <a rel="previous" accesskey="p" href="#OS-X">OS X</a>, Up: <a rel="up" accesskey="u" href="#OS-X">OS X</a> </div> <h4 class="subsection">C.3.1 Snow Leopard</h4> <p>A quirk on Snow Leopard is that the X11 libraries are not in the default linking path, so something like ‘<samp><span class="samp">LIBS=-L/usr/X11/lib</span></samp>’ may be required in <samp><span class="file">config.site</span></samp>, or you can use the <samp><span class="command">configure</span></samp> options <samp><span class="option">--x-includes=/usr/X11/include --x-libraries=/usr/X11/lib.</span></samp>. <p>The <acronym>CRAN</acronym> binaries are built using Xcode 4.2, a version available only to subscribing developers. It is expected that 3.2.6 (the last public free version for Snow Leopard) will work. <div class="node"> <a name="Lion"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Mountain-Lion">Mountain Lion</a>, Previous: <a rel="previous" accesskey="p" href="#Snow-Leopard">Snow Leopard</a>, Up: <a rel="up" accesskey="u" href="#OS-X">OS X</a> </div> <h4 class="subsection">C.3.2 Lion</h4> <p>No tweaks are known to be needed on Lion. See the notes on Mountain Lion if XQuartz is in use. <div class="node"> <a name="Mountain-Lion"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Mavericks">Mavericks</a>, Previous: <a rel="previous" accesskey="p" href="#Lion">Lion</a>, Up: <a rel="up" accesskey="u" href="#OS-X">OS X</a> </div> <h4 class="subsection">C.3.3 Mountain Lion</h4> <p>The X11 system used with Mountain Lion is XQuartz (see above). <p>To build the graphics devices depending on cairographics the XQuartz path for <samp><span class="command">pkg-config</span></samp> files needs to be known to <samp><span class="command">pkg-config</span></samp> when <samp><span class="command">configure</span></samp> is run: this usually means adding it to the <samp><span class="env">PKG_CONFIG_PATH</span></samp> environment variable, e.g. <pre class="example"> export PKG_CONFIG_PATH= \ /opt/X11/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig </pre> <p>For some pre-compiled software, for example the GTK framework, <samp><span class="file">/opt/X11/include</span></samp> may need to be added to the include paths. <div class="node"> <a name="Mavericks"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Tcl_002fTk-headers-and-libraries">Tcl/Tk headers and libraries</a>, Previous: <a rel="previous" accesskey="p" href="#Mountain-Lion">Mountain Lion</a>, Up: <a rel="up" accesskey="u" href="#OS-X">OS X</a> </div> <h4 class="subsection">C.3.4 Mavericks</h4> <p>Mavericks is associated with Xcode 5, and is said to download software components as needed without installing all of Xcode. <p>It is likely that <samp><span class="command">clang</span></samp> will be the preferred C compiler, using something like <pre class="example"> CC="clang" CXX="clang++" F77="gfortran-4.2 -arch x86_64" FC=$F77 OBJC="clang" </pre> <p>See the comments under Mountain Lion about X11 and GTK. <div class="node"> <a name="Tcl%2fTk-headers-and-libraries"></a> <a name="Tcl_002fTk-headers-and-libraries"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Java-_0028OS-X_0029">Java (OS X)</a>, Previous: <a rel="previous" accesskey="p" href="#Mavericks">Mavericks</a>, Up: <a rel="up" accesskey="u" href="#OS-X">OS X</a> </div> <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 <span class="sc">R.app</span> 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 <pre class="example"> --with-tcl-config=/usr/local/lib/tclConfig.sh --with-tk-config=/usr/local/lib/tkConfig.sh </pre> <p>Note that this expects a fully-updated X11 installation: it was built against the Apple X11 from Snow Leopard, but XQuartz will work if recent enough (e.g. version 2.7.4). <p>There is also a native (‘Aqua’) version of Tcl/Tk which produces widgets in the native OS X style: this will not work with <span class="sc">R.app</span> because of conflicting event loops, 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 current versions of Tcl/Tk (8.5.9 in Mountain Lion). It is better to install Tcl/Tk 8.6.x or 8.5.x from the sources or the binary distribution at <a href="http://www.activestate.com/activetcl/downloads">http://www.activestate.com/activetcl/downloads</a>. Configure R with <pre class="example"> --with-tcl-config=/Library/Frameworks/Tcl.framework/tclConfig.sh --with-tk-config=/Library/Frameworks/Tk.framework/tkConfig.sh </pre> <p class="noindent">(for the versions bundled with OS X, use paths starting with <samp><span class="file">/System/Library</span></samp>). <div class="node"> <a name="Java-(OS-X)"></a> <a name="Java-_0028OS-X_0029"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Frameworks">Frameworks</a>, Previous: <a rel="previous" accesskey="p" href="#Tcl_002fTk-headers-and-libraries">Tcl/Tk headers and libraries</a>, Up: <a rel="up" accesskey="u" href="#OS-X">OS X</a> </div> <h4 class="subsection">C.3.6 Java</h4> <p>The situation with Java support on OS X is messy, with Apple essentially no longer supporting Java (and what it does support is Java 6, which has reached end-of-life). Snow Leopard and Lion shipped with a Java 6 runtime (JRE). <p>Mountain Lion did not come with an installed JRE, and an upgrade to Mountain Lion removed one if already installed. It is intended to be installed at first use. Check if a JRE is installed by running <samp><span class="command">java -version</span></samp> in a <samp><span class="command">Terminal</span></samp> window: if Java is not installed this should prompt you to install it. <p>However, for security reasons you may want/need to install the latest Java from Oracle (currently Java 7 from <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">http://www.oracle.com/technetwork/java/javase/downloads/index.html</a>); this is for Lion and later. <p>To see what compatible versions of Java are currently installed, run <samp><span class="command">/usr/libexec/java_home -V -a x86_64</span></samp>. If needed, set the environment variable <samp><span class="env">JAVA_HOME</span></samp> to choose between these, both when R is built from the sources and when <samp><span class="command">R CMD javareconf</span></samp> is run. <p>Configuring and building R both looks for a JRE and for support for compiling JNI programs (used by packages <a href="http://CRAN.R-project.org/package=rJava"><strong>rJava</strong></a> and <a href="http://CRAN.R-project.org/package=JavaGD"><strong>JavaGD</strong></a>); the latter requires a JDK (Java SDK) and not just a JRE. <p>The build process tries to fathom out what JRE/JDK to use, but it may need some help, e.g. by setting <samp><span class="env">JAVA_HOME</span></samp>. The Apple JRE can be specified explicitly by something like <pre class="example"> JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home JAVA_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers" JAVA_LD_LIBRARY_PATH= JAVA_LIBS="-framework JavaVM" </pre> <p class="noindent">The Apple developer versions of the JDK install somewhere like <pre class="example"> JAVA_HOME=/Library/Java/JavaVirtualMachines/1.6.0_43-b01-447.jdk/Contents/Home </pre> <p class="noindent">The Oracle JDK can be specified explicitly by something like <pre class="example"> JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home JAVA_CPPFLAGS="-I/${JAVA_HOME}/include -I/${JAVA_HOME}/include/darwin" JAVA_LD_LIBRARY_PATH="${JAVA_HOME}/jre/lib/server" JAVA_LIBS="-L/${JAVA_HOME}/jre/lib/server -ljvm" </pre> <p>in <samp><span class="file">config.site</span></samp>. <samp><span class="env">JAVA_LD_LIBRARY_PATH</span></samp> is used as part of <samp><span class="env">DYLD_FALLBACK_LIBRARY_PATH</span></samp> and so is less likely to cause conflicts, but <samp><span class="file">${JAVA_HOME}/jre/lib</span></samp> is still best avoided as in some JDKs it contains libraries which conflict with system libraries. <p>Note that it is necessary to set the environment variable <samp><span class="env">NOAWT</span></samp> to <code>1</code> to install many of the Java-using packages. <div class="node"> <a name="Frameworks"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Building-R_002eapp">Building R.app</a>, Previous: <a rel="previous" accesskey="p" href="#Java-_0028OS-X_0029">Java (OS X)</a>, Up: <a rel="up" accesskey="u" href="#OS-X">OS X</a> </div> <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 <pre class="example"> ./configure --enable-R-framework </pre> <p>This is only needed if you want to build R for use with the <span class="sc">R.app</span> console, and implies <samp><span class="option">--enable-R-shlib</span></samp> to build R as a dynamic library. This option configures R to be built and installed as a framework called <samp><span class="file">R.framework</span></samp>. The default installation path for <samp><span class="file">R.framework</span></samp> is <samp><span class="file">/Library/Frameworks</span></samp> but this can be changed at configure time by specifying the flag <samp><span class="option">--enable-R-framework[=</span><var>DIR</var><span class="option">]</span></samp> or at install time as <pre class="example"> make prefix=/where/you/want/R.framework/to/go install </pre> <div class="node"> <a name="Building-R.app"></a> <a name="Building-R_002eapp"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Frameworks">Frameworks</a>, Up: <a rel="up" accesskey="u" href="#OS-X">OS X</a> </div> <h4 class="subsection">C.3.8 Building R.app</h4> <p>Note that building the <span class="sc">R.app</span> GUI console is a separate project, using Xcode. Before compiling <span class="sc">R.app</span> make sure the current version of R is installed in <samp><span class="file">/Library/Frameworks/R.framework</span></samp> and working at the command-line (this can be a binary install). <p>The current sources can be checked out by <pre class="example"> svn co https://svn.r-project.org/R-packages/trunk/Mac-GUI </pre> <p class="noindent">This can be built by loading the <code>R.xcodeproj</code> project (select the <code>R</code> target and the <code>SnowLeopard64</code> or <code>Lion64</code> configuration), or from the command-line by e.g. <pre class="example"> xcodebuild -target R -configuration SnowLeopard64 </pre> <p>See also the <samp><span class="file">INSTALL</span></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><span class="sc">R.app</span> does not need to be installed in any specific way. Building <span class="sc">R.app</span> results in the <span class="sc">R.app</span> bundle which appears as one R icon. This application bundle can be run anywhere and it is customary to place it in the <em>Applications</em> folder. <div class="node"> <a name="Solaris"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#AIX">AIX</a>, Previous: <a rel="previous" accesskey="p" href="#OS-X">OS X</a>, Up: <a rel="up" accesskey="u" href="#Platform-notes">Platform notes</a> </div> <h3 class="section">C.4 Solaris</h3> <p><a name="index-Solaris-105"></a> R has been built successfully on Solaris 10 (both Sparc and ‘<samp><span class="samp">x86</span></samp>’) using the (zero cost) Oracle Solaris Studio compilers: there has been some success with <samp><span class="command">gcc</span></samp> 4/<samp><span class="command">gfortran</span></samp>. (Recent Sun machines are AMD Opterons or Intel Xeons (‘<samp><span class="samp">amd64</span></samp>’) rather than ‘<samp><span class="samp">x86</span></samp>’, but 32-bit ‘<samp><span class="samp">x86</span></samp>’ executables are the default.) <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>The Solaris versions of several of the tools needed to build R (e.g. <samp><span class="command">make</span></samp>, <samp><span class="command">ar</span></samp> and <samp><span class="command">ld</span></samp>) are in <samp><span class="file">/usr/ccs/bin</span></samp>, so if using those tools ensure this is in your path. A version of the preferred <acronym>GNU</acronym> <samp><span class="command">tar</span></samp> is (if installed) in <samp><span class="file">/usr/sfw/bin</span></samp>, as sometimes are tools like <samp><span class="command">makeinfo</span></samp>. It may be necessary to avoid the tools in <samp><span class="file">/usr/ucb</span></samp>: POSIX-compliant versions of some tools can be found in <samp><span class="file">/usr/xpg4/bin</span></samp> and <samp><span class="file">/usr/xpg6/bin</span></samp>. <p>A large selection of Open Source software can be installed from <a href="http://www.opencsw.org">http://www.opencsw.org</a>, by default installed under <samp><span class="file">/opt/csw</span></samp>. <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>The native <samp><span class="command">make</span></samp> suffices to build R but a small number of packages require <acronym>GNU</acronym> <samp><span class="command">make</span></samp> (some without good reason and without declaring it as ‘<samp><span class="samp">SystemRequirements</span></samp>’ in the <samp><span class="file">DESCRIPTION</span></samp> file). <p>Some people have reported that the Solaris <code>libintl</code> needs to be avoided, for example by using <samp><span class="option">--disable-nls</span></samp> or <samp><span class="option">--with-included-gettext</span></samp> or using <code>libintl</code> from OpenCSW. <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 <samp><span class="command">configure</span></samp> option <samp><span class="option">--disable-long-double</span></samp> can be used for faster but less accurate computations. <p>When using the Oracle compilers<a rel="footnote" href="#fn-40" name="fnd-40"><sup>40</sup></a> do <em>not</em> specify <samp><span class="option">-fast</span></samp>, as this disables <acronym>IEEE</acronym> arithmetic and <samp><span class="command">make check</span></samp> will fail. <p>A little juggling of paths was needed to ensure <acronym>GNU</acronym> <code>libiconv</code> (in <samp><span class="file">/usr/local</span></samp>) was used rather than the Solaris <code>iconv</code>: <pre class="example"> CC="cc -xc99" CFLAGS="-O -xlibmieee" F77=f95 FFLAGS=-O CXX="CC -library=stlport4" CXXFLAGS=-O FC=f95 FCFLAGS=$FFLAGS FCLIBS="-lfai -lfsu" R_LD_LIBRARY_PATH="/usr/local/lib:/opt/csw/gcc4/lib:/opt/csw/lib" </pre> <p class="noindent">For a 64-bit target add <samp><span class="option">-m64</span></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 <samp><span class="command">pkg-config</span></samp> at the 64-bit directories, e.g. one of <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> <p class="noindent">and to specify a 64-bit Java VM by e.g. <pre class="example"> JAVA_CPPFLAGS="-I${JAVA_HOME}/../include -I${JAVA_HOME}/../include/solaris" JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/amd64/server JAVA_LIBS="-L${JAVA_HOME}/lib/amd64/server \ -R${JAVA_HOME}/lib/amd64/server -ljvm" </pre> <p class="noindent">With Solaris Studio 12.[23] on Sparc, <code>FCLIBS</code> needs to be <pre class="example"> FCLIBS="-lfai -lfai2 -lfsu" </pre> <p class="noindent">(and possibly other Fortran libraries, but this suffices for the packages currently on CRAN). <p>Currently ‘<samp><span class="samp">amd64</span></samp>’ and ‘<samp><span class="samp">sparcv9</span></samp>’ builds work out-of-the-box with Sun Studio 12u1 but not Solaris Studio 12.2 and later: <samp><span class="file">libRblas.so</span></samp> and <samp><span class="file">lapack.so</span></samp> are generated with code that causes relocation errors (which is being linked in from the Fortran libraries). This means that building R as a shared library may be impossible with Solaris Studio >= 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 ‘<samp><span class="samp">amd64</span></samp>’ set in <samp><span class="file">config.site</span></samp> something like <pre class="example"> FLIBS_IN_SO="-R/opt/solarisstudio12.3/lib/amd64 /opt/solarisstudio12.3/lib/amd64/libfui.so /opt/solarisstudio12.3/lib/amd64/libfsu.so" </pre> <p class="noindent">For 64-bit Sparc, set in <samp><span class="file">config.site</span></samp> something like <pre class="example"> FLIBS="-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" </pre> <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><span class="option">-xlibmieee</span></samp> to ensure this. <p>You can target specific Sparc architectures for (slightly) higher performance: <samp><span class="option">-xtarget=native</span></samp> (in <code>CFLAGS</code> etc) tunes the compilation to the current machine. <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>On ‘<samp><span class="samp">x86</span></samp>’ you will get marginally higher performance <em>via</em> <pre class="example"> CFLAGS="-xO5 -xc99 -xlibmieee -xlibmil -nofstore -xtarget=native" FFLAGS="-O5 -libmil -nofstore -xtarget=native" CXXFLAGS="-xO5 -xlibmil -nofstore -xtarget=native" SAFE_FFLAGS="-libmil -fstore -xtarget=native" </pre> <p class="noindent">but the use of <code>-nofstore</code> can be less numerically stable, and some packages (notably <a href="http://CRAN.R-project.org/package=mgcv"><strong>mgcv</strong></a> on ‘<samp><span class="samp">x86</span></samp>’) failed to compile at higher optimization levels with version 12.3. <p>The Solaris Studio compilers provide several implementations of the C++ standard which select both the set of headers and a C++ runtime library. These are selected by the <samp><span class="option">-library</span></samp> flag, which as it is needed for both compiling and linking is best specified as part of the compiler. The examples above use ‘<samp><span class="samp">stlport4</span></samp>’, currently the most modern of the options: the default (but still needed to be specified as it is needed for linking) is ‘<samp><span class="samp">Cstd</span></samp>’: see <a href="http://developers.sun.com/solaris/articles/cmp_stlport_libCstd.html">http://developers.sun.com/solaris/articles/cmp_stlport_libCstd.html</a>. Note though that most external Solaris C++ libraries will have been built with ‘<samp><span class="samp">Cstd</span></samp>’ and so an R package using such libraries also needs to be. Occasionally the flag <samp><span class="option">-library=stlport4,Crun</span></samp> has been needed. <p>Several <acronym>CRAN</acronym> packages using C++ need the more liberal interpretation given by adding <pre class="example"> CXXFLAGS="-features=tmplrefstatic" </pre> <p><a name="index-BLAS-library-106"></a><a name="index-LAPACK-library-107"></a> 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) <pre class="example"> ./configure --with-blas='-library=sunperf' --with-lapack </pre> <p class="noindent">This has often given test failures in the past, in several different places. At the time of writing it fails in <samp><span class="file">tests/reg-BLAS.R</span></samp>, and on some builds, including for ‘<samp><span class="samp">amd64</span></samp>’, it fails in <code>example(eigen)</code>. <p>Parsing very complex expressions needs a lot of stack space when the Oracle compilers are used: several packages require the stack increased to say 20MB. <ul class="menu"> <li><a accesskey="1" href="#Using-gcc">Using gcc</a> </ul> <div class="node"> <a name="Using-gcc"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Solaris">Solaris</a>, Up: <a rel="up" accesskey="u" href="#Solaris">Solaris</a> </div> <h4 class="subsection">C.4.1 Using gcc</h4> <p>If using <samp><span class="command">gcc</span></samp>, ensure that the compiler was compiled for the version of Solaris in use. (This can be ascertained from <samp><span class="command">gcc -v</span></samp>.) <samp><span class="command">gcc</span></samp> makes modified versions of some header files, and several reports of problems were due to using <samp><span class="command">gcc</span></samp> compiled on one version of Solaris on a later version. <p>The notes here are for <samp><span class="command">gcc</span></samp> set up to use the Solaris linker: it can also be set up to use GNU <samp><span class="command">ld</span></samp>, but that has not been tested. <p>Compilation for a 32-bit Sparc target with <samp><span class="command">gcc</span></samp> 4.8.1 needed <pre class="example"> CPPFLAGS=-I/opt/csw/include LDFLAGS="-L/opt/csw/gcc4/lib -L/opt/csw/lib" </pre> <p class="noindent">and for a 64-bit Sparc target <pre class="example"> CC="gcc -m64" F77="gfortran -m64" CXX="g++ -m64" FC=$F77 CPPFLAGS=-I/opt/csw/include LDFLAGS="-L/opt/csw/gcc4/lib/sparcv9 -L/opt/csw/lib/sparcv9" </pre> <p class="noindent">Note that paths such as <samp><span class="file">/opt/csw/gcc4/lib/sparcv9</span></samp> may need to be in the <a name="index-LD_005fLIBRARY_005fPATH-108"></a><samp><span class="env">LD_LIBRARY_PATH</span></samp> during configuration. <p>The compilation can be tuned to a particular cpu: the <acronym>CRAN</acronym> check system uses <code>-mtune=niagara2</code>. <p>Compilation for an ‘<samp><span class="samp">x86</span></samp>’ target with <samp><span class="command">gcc</span></samp> 4.8.1 needed <pre class="example"> CC="/opt/csw/gcc4/bin/gcc -m32" CPPFLAGS="-I/opt/csw/include -I/usr/local/include" F77="/opt/csw/gcc4/bin/gfortran -m32" CXX="/opt/csw/gcc4/bin/g++ -m32" FC="/opt/csw/gcc4/bin/gfortran -m32" LDFLAGS="-L/opt/csw/gcc4/lib -L/opt/csw/lib -L/usr/local/lib" </pre> <p class="noindent">(<code>-L/opt/csw/lib</code> is needed since TeXLive was built using 32-bit <code>gcc</code>, and we need <samp><span class="file">/opt/csw/lib</span></samp> in <code>R_LD_LIBRARY_PATH</code>.) <p>For an ‘<samp><span class="samp">amd64</span></samp>’ target with <samp><span class="command">gcc</span></samp> 4.8.1 we used <pre class="example"> CC="/opt/csw/gcc4/bin/gcc -m64" CPPFLAGS="-I/opt/csw/include -I/usr/local/include" F77="/opt/csw/gcc4/bin/gfortran -m64" FPICFLAGS=-fPIC CXX="/opt/csw/gcc4/bin/g++ -m64" FC=$F77 FCPICFLAGS=$FPICFLAGS LDFLAGS="-L/opt/csw/gcc4/lib/amd64 -L/opt/csw/lib/amd64" </pre> <div class="node"> <a name="AIX"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#FreeBSD">FreeBSD</a>, Previous: <a rel="previous" accesskey="p" href="#Solaris">Solaris</a>, Up: <a rel="up" accesskey="u" href="#Platform-notes">Platform notes</a> </div> <h3 class="section">C.5 AIX</h3> <p><a name="index-AIX-109"></a> We no longer support AIX prior to 4.2, and <samp><span class="command">configure</span></samp> will throw an error on such systems. <p>Ei-ji Nakama was able to build under AIX 5.2 on ‘<samp><span class="samp">powerpc</span></samp>’ with GCC 4.0.3 in several configurations. 32-bit versions could be configured with <samp><span class="option">--without-iconv</span></samp> as well as <samp><span class="option">--enable-R-shlib</span></samp>. For 64-bit versions he used <pre class="example"> OBJECT_MODE=64 CC="gcc -maix64" CXX="g++ -maix64" F77="gfortran -maix64" FC="gfortran -maix64" </pre> <p class="noindent">and was also able to build with the IBM <code>xlc</code> and Hitachi <code>f90</code> compilers by <pre class="example"> OBJECT_MODE=64 CC="xlc -q64" CXX="g++ -maix64" F77="f90 -cpu=pwr4 -hf77 -parallel=0 -i,L -O3 -64" FC="f90 -cpu=pwr4 -hf77 -parallel=0 -i,L -O3 -64" FLIBS="-L/opt/ofort90/lib -lhf90vecmath -lhf90math -lf90" </pre> <p>Some systems have <samp><span class="command">f95</span></samp> as an IBM compiler that does not by default accept FORTRAN 77. It needs the flag <samp><span class="option">-qfixed=72</span></samp>, or to be invoked as <samp><span class="command">xlf_r</span></samp>. <!-- http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.xlf91a.doc/xlfug/hu00465.htm --> <p>The AIX native <code>iconv</code> does not support encodings ‘<samp><span class="samp">latin1</span></samp>’ nor ‘<samp><span class="samp">""</span></samp>’ and so cannot be used. (As far as we know <acronym>GNU</acronym> <code>libiconv</code> could be installed.) <p>Fan Long reports success on AIX 5.3 using <!-- https://stat.ethz.ch/pipermail/r-devel/2008-August/050318.html --> <pre class="example"> OBJECT_MODE=64 LIBICONV=<var>/where/libiconv/installed</var> CC="xlc_r -q64" CFLAGS="-O -qstrict" CXX="xlC_r -q64" CXXFLAGS="-O -qstrict" F77="xlf_r -q64" AR="ar -X64" CPPFLAGS="-I$LIBICONV/include -I/usr/lpp/X11/include/X11" LDFLAGS="-L$LIBICONV/lib -L/usr/lib -L/usr/X11R6/lib" </pre> <p><a name="index-R_005fSHELL-110"></a>On one AIX 6.x system it was necessary to use <samp><span class="env">R_SHELL</span></samp> to set the default shell to be Bash rather than Zsh. <p>Kurt Hornik and Stefan Theussl at WU (Wirtschaftsuniversität Wien) successfully built R on a ‘<samp><span class="samp">powerpc</span></samp>’ (8-<acronym>CPU</acronym> Power6 system) running AIX 6.1, configuring with or without <samp><span class="option">--enable-R-shlib</span></samp> (Ei-ji Nakama's support is gratefully acknowledged). <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, X11, and Perl. Additional open source software (OSS) is packaged for AIX in <samp><span class="file">.rpm</span></samp> files and available from both IBM's “AIX Toolbox for Linux Applications” (<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><span class="file">/opt/freeware</span></samp>, hence corresponding executables are found in <a name="index-PATH-111"></a><samp><span class="file">/opt/freeware/bin</span></samp> which thus needs to be in <samp><span class="env">PATH</span></samp> 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="http://www.tug.org/texlive/">http://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>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>To compile for a 64-bit ‘<samp><span class="samp">powerpc</span></samp>’ (Power6 <acronym>CPU</acronym>) target one can use <pre class="example"> CC ="gcc -maix64 -pthread" CXX="g++ -maix64 -pthread" FC="gfortran -maix64 -pthread" F77="gfortran -maix64 -pthread" CFLAGS="-O2 -g -mcpu=power6" FFLAGS="-O2 -g -mcpu=power6" FCFLAGS="-O2 -g -mcpu=power6" </pre> <p class="noindent">for the GCC and <pre class="example"> CC=xlc CXX=xlc++ FC=xlf F77=xlf CFLAGS="-qarch=auto -qcache=auto -qtune=auto -O3 -qstrict -ma" FFLAGS="-qarch=auto -qcache=auto -qtune=auto -O3 -qstrict" FCFLAGS="-qarch=auto -qcache=auto -qtune=auto -O3 -qstrict" CXXFLAGS="-qarch=auto -qcache=auto -qtune=auto -O3 -qstrict" </pre> <p class="noindent">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-112"></a><samp><span class="env">OBJECT_MODE</span></samp> environment variable appropriately (recommended) or using an additional compiler flag (<samp><span class="option">-q32</span></samp> or <samp><span class="option">-q64</span></samp>). By default the IBM XL compilers produce 32 bit code. Thus, to build R with 64-bit support one needs to either export <samp><span class="env">OBJECT_MODE=64</span></samp> in the environment or, alternatively, use the <samp><span class="option">-q64</span></samp> compiler options. <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>Further installation instructions to set up a proper R development environment can be found in the “R on AIX” project on R-Forge (<a href="http://R-Forge.R-project.org/projects/aix/">http://R-Forge.R-project.org/projects/aix/</a>). <div class="node"> <a name="FreeBSD"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Cygwin">Cygwin</a>, Previous: <a rel="previous" accesskey="p" href="#AIX">AIX</a>, Up: <a rel="up" accesskey="u" href="#Platform-notes">Platform notes</a> </div> <h3 class="section">C.6 FreeBSD</h3> <p><a name="index-FreeBSD-113"></a> The reports here were for R 2.15.x. <p>Rainer Hurling has reported success on ‘<samp><span class="samp">amd64</span></samp>’ FreeBSD 9.0 (and on earlier versions in the past), and Brian Ripley tested ‘<samp><span class="samp">amd64</span></samp>’ FreeBSD 8.2. Since Darwin (the base OS of OS X) is based on FreeBSD we find testing on Darwin tends to pick up most potential problems on FreeBSD. However, FreeBSD lacks adequate character type (e.g. which are alphabetic) and collation support for multi-byte locales (but a port of ICU is available), and does not yet implement C99 complex math functions (for which R's substitutes are used). <p>The native BSD <samp><span class="command">make</span></samp> suffices to build R but a number of packages require <acronym>GNU</acronym> <samp><span class="command">make</span></samp>, despite the recommendations of the “Writing R Extensions” manual. <p>The simplest way to get the additional software needed to build R is to install a pre-compiled version first, e.g. by <pre class="example"> pkg_add -r R </pre> <p class="noindent">(on the system this was tested on, this installed Tcl, Tk, blas, lapack and <code>gcc-4.6.2</code> which includes <samp><span class="command">gfortran46</span></samp>). A listing of dependencies (not necessarily for current R) can be found at <a href="http://www.freebsd.org/ports/lang.html">http://www.freebsd.org/ports/lang.html</a>: you will however also need a TeX system<a rel="footnote" href="#fn-41" name="fnd-41"><sup>41</sup></a> to build the manuals. <p>Then R itself can be built by something like <pre class="example"> ./configure CC=gcc46 F77=gfortran46 CXX=g++46 FC=gfortran46 </pre> <p>There are also FreeBSD packages for a small eclectic collection of <acronym>CRAN</acronym> packages. <p>Beware that the lack of adequate support for non-<acronym>ASCII</acronym> characters in UTF-8 locales has many consequences in R: for example names will not be recognized as alphabetic by <code>make.names</code>. <div class="node"> <a name="Cygwin"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#New-platforms">New platforms</a>, Previous: <a rel="previous" accesskey="p" href="#FreeBSD">FreeBSD</a>, Up: <a rel="up" accesskey="u" href="#Platform-notes">Platform notes</a> </div> <h3 class="section">C.7 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. R requires C99 complex type support, which is available as from Cygwin 1.7.8 (March 2011). However, the (new) implementation of <code>cacos</code> gives incorrect results, so we undefine <code>HAVE_CACOS</code> in <samp><span class="file">src/main/complex.c</span></samp> on that platform. <p>Many versions of Cygwin during 2011 were unable to build R: 1.7.9-1 with <acronym>GCC</acronym> 4.5.3-3 in November 2011 was able to do so. Cygwin has not been tested for R 3.0.0 or later. <p>Only building as a shared library can possibly work,<a rel="footnote" href="#fn-42" name="fnd-42"><sup>42</sup></a> so use e.g <pre class="example"> ./configure --disable-nls --enable-R-shlib FLIBS=-lgfortran make </pre> <p class="noindent">Enabling NLS does work if required, although adding <samp><span class="option">--with-included-gettext</span></samp> is preferable. You will see many warnings about the use of auto-import. Setting ‘<samp><span class="samp">FLIBS</span></samp>’ explicitly seems needed currently as the auto-detection gives an incorrect value. <p>You will need the <strong>tetex-extra</strong> Cygwin package to build <samp><span class="file">NEWS.pdf</span></samp> and the vignettes. <p>Note that this gives you a command-line application using <code>readline</code> for command editing. The ‘<samp><span class="samp">X11</span></samp>’ 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><span class="file">/usr/lib/tkConfig.sh</span></samp> script in the version we looked at, which needs to have <pre class="example"> TK_LIB_SPEC='-ltk84' </pre> <p>The overhead of using shell scripts makes this noticeably slower than a native build of R on Windows. <p>Even when R can be built, not all the tests passed: there were incorrect results from wide-character regular expressions code and from sourcing CR-delimited files. <p>Do not use Cygwin's BLAS library: it is known to give incorrect results. <div class="node"> <a name="New-platforms"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Cygwin">Cygwin</a>, Up: <a rel="up" accesskey="u" href="#Platform-notes">Platform notes</a> </div> <h3 class="section">C.8 New platforms</h3> <p>There are a number of sources of problems when installing R on a new hardware/OS platform. These include <p><strong>Floating Point Arithmetic</strong>: R requires arithmetic compliant with <acronym>IEC</acronym> 60559, also known as <acronym>IEEE</acronym> 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 ‘<samp><span class="samp">ix86</span></samp>’ 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><span class="option">-ieee_with_inexact</span></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><span class="file">config.site</span></samp> which resides in the top level directory. <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><span class="option">-fast</span></samp> on the Solaris Studio compilers has caused R's <code>NaN</code> to be set incorrectly, and <samp><span class="command">gcc</span></samp>'s <samp><span class="option">-ffast-math</span></samp> has given incorrect results. <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 <samp><span class="command">xmkmf</span></samp>), 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 <samp><span class="command">cc</span></samp> and <samp><span class="command">ld</span></samp> usually reveals the correct incantation. Once you know the recipe you can modify the file <samp><span class="file">config.site</span></samp> (following the instructions therein) so that the build will use these options. <p>It seems that <samp><span class="command">gcc</span></samp> 3.4.x and later on ‘<samp><span class="samp">ix86</span></samp>’ Linux defeat attempts by the LAPACK code to avoid computations entirely in extended-precision registers, so file <samp><span class="file">src/modules/lapack/dlamc.f</span></samp> may need to be compiled without optimization. Set the configure variable <samp><span class="env">SAFE_FFLAGS</span></samp> to the flags to be used for this file. If configure detects <acronym>GNU</acronym> FORTRAN it adds flag <samp><span class="option">-ffloat-store</span></samp> to <samp><span class="env">FFLAGS</span></samp>. (Other settings are needed when using <samp><span class="command">icc</span></samp> on ‘<samp><span class="samp">ix86</span></samp>’ Linux, for example. Using <samp><span class="option">-mpc64</span></samp> is preferable on more recent GCC compilers.) <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>If you are having trouble getting R to work on your platform please feel free to use the ‘<samp><span class="samp">R-devel</span></samp>’ mailing list to ask questions. We have had a fair amount of practice at porting R to new platforms <small class="enddots">...</small> <div class="node"> <a name="The-Windows-toolset"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Function-and-variable-index">Function and variable index</a>, Previous: <a rel="previous" accesskey="p" href="#Platform-notes">Platform notes</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <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="http://CRAN.R-project.org/bin/windows/Rtools/">http://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>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 rel="footnote" href="#fn-43" name="fnd-43"><sup>43</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><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>We have collected most of the necessary tools (unfortunately not all, due to license or size limitations) into an executable installer named<a rel="footnote" href="#fn-44" name="fnd-44"><sup>44</sup></a> <samp><span class="file">Rtools30.exe</span></samp>, available from <a href="http://CRAN.R-project.org/bin/windows/Rtools/">http://CRAN.R-project.org/bin/windows/Rtools/</a>. You should download and run it, choosing the default “Package authoring installation” to build add-on packages, or the “full installation” if you intend to build R. <p>You will need the following items to build R and packages. See the subsections below for detailed descriptions. <ul> <li>The command line tools (in <samp><span class="file">Rtools*.exe</span></samp>) <li>The MinGW-w64 32/64-bit toolchain to compile C, Fortran and C++. </ul> For installing simple source packages containing data or R source but no compiled code, none of these are needed. Perl is no longer needed to build R nor to install nor develop source packages. <p>A complete build of R including PDF manuals, and producing the installer will also need the following: <ul> <li>LaTeX <li>The Inno Setup installer <li>(optional) <code>qpdf</code> </ul> <p><a name="index-PATH-114"></a>It is important to set your <samp><span class="env">PATH</span></samp> properly. The installer <samp><span class="file">Rtools*.exe</span></samp> optionally sets the path to components that it installs. <p>Your <samp><span class="env">PATH</span></samp> may include <samp><span class="file">.</span></samp> first, then the <samp><span class="file">bin</span></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>For example for a 32-bit build, all on one line, <pre class="example"> PATH=c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;c:\MiKTeX\miktex\bin; c:\R\R-3.0\bin\i386;c:\windows;c:\windows\system32 </pre> <p class="noindent">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 rel="footnote" href="#fn-45" name="fnd-45"><sup>45</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>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. <ul class="menu"> <li><a accesskey="1" href="#LaTeX">LaTeX</a> <li><a accesskey="2" href="#The-Inno-Setup-installer">The Inno Setup installer</a> <li><a accesskey="3" href="#The-command-line-tools">The command line tools</a> <li><a accesskey="4" href="#The-MinGW_002dw64-toolchain">The MinGW-w64 toolchain</a> <li><a accesskey="5" href="#Useful-additional-programs">Useful additional programs</a> </ul> <div class="node"> <a name="LaTeX"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#The-Inno-Setup-installer">The Inno Setup installer</a>, Previous: <a rel="previous" accesskey="p" href="#The-Windows-toolset">The Windows toolset</a>, Up: <a rel="up" accesskey="u" href="#The-Windows-toolset">The Windows toolset</a> </div> <h3 class="section">D.1 LaTeX</h3> <p>The ‘<samp><span class="samp">MiKTeX</span></samp>’ (<a href="http://www.miktex.org/">http://www.miktex.org/</a>) distribution of LaTeX includes a suitable port of <code>pdftex</code>. The ‘basic’ version of ‘<samp><span class="samp">MiKTeX</span></samp>’ almost suffices (the <strong>grid</strong> vignettes need <samp><span class="file">fancyvrb.sty</span></samp>), but it will install the 15Mb ‘<samp><span class="samp">lm</span></samp>’ package if allowed to (although that is not actually used). The <samp><span class="file">Rtools*.exe</span></samp> installer does <em>not</em> include any version of LaTeX. <p>It is also possible to use the TeXLive distribution from <a href="http://www.tug.org/texlive/">http://www.tug.org/texlive/</a>. <p><a name="index-R_005fRD4PDF-115"></a>Please read <a href="#Making-the-manuals">Making the manuals</a> about how to make <samp><span class="file">fullrefman.pdf</span></samp> and set the environment variable <samp><span class="env">R_RD4PDF</span></samp> suitably; ensure you have the required fonts installed or that ‘<samp><span class="samp">MiKTeX</span></samp>’ is set up to install LaTeX packages on first use. (In any case ensure that the <strong>inconsolata</strong> package is installed—you can check with the MiKTeX Package Manager.) <div class="node"> <a name="The-Inno-Setup-installer"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#The-command-line-tools">The command line tools</a>, Previous: <a rel="previous" accesskey="p" href="#LaTeX">LaTeX</a>, Up: <a rel="up" accesskey="u" href="#The-Windows-toolset">The Windows toolset</a> </div> <h3 class="section">D.2 The Inno Setup installer</h3> <p>To make the installer package (<samp><span class="file">R-3.0.2-win.exe</span></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><span class="file">Rtools*.exe</span></samp>. <p>Copy file <samp><span class="file">src/gnuwin32/MkRules.dist</span></samp> to <samp><span class="file">src/gnuwin32/MkRules.local</span></samp> and edit it to set <code>ISDIR</code> to the location where Inno Setup was installed. <div class="node"> <a name="The-command-line-tools"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#The-MinGW_002dw64-toolchain">The MinGW-w64 toolchain</a>, Previous: <a rel="previous" accesskey="p" href="#The-Inno-Setup-installer">The Inno Setup installer</a>, Up: <a rel="up" accesskey="u" href="#The-Windows-toolset">The Windows toolset</a> </div> <h3 class="section">D.3 The command line tools</h3> <p>This item is installed by the <samp><span class="file">Rtools*.exe</span></samp> installer. <!-- INSTALL may use sh make zip (and tar if R_INSTALL_TAR is used) --> <!-- build may use make and sh. --> <!-- Rdiff.sh USED to use diff echo grep sed tr: grep and tr are no longer used. --> <!-- basename is used in src/library/Recommended/Makefile.win --> <!-- comm, sort, uniq are used in producing .def files --> <!-- cmp is used in src/include/Makefile.win, tools/{copy,move}-if-change --> <!-- cp is used as $(CP) in numerous Makefiles --> <!-- cut is used to make RVER --> <!-- date is used when building base and tools --> <!-- diff is used by tools::Rdiff and tests/Makefile.common --> <!-- du is used by R CMD check --> <!-- expr is used in tools/GETVERSION --> <!-- find is used in installer/Makefile --> <!-- expr is used in tools/GETCONFIG --> <!-- gzip is used in src/library/Makefile.win, R CMD build --> <!-- ls is used in src/library/*/Makefile.win --> <!-- mkdir is used in numerous Makefiles --> <!-- rsync is only needed if building from svn --> <!-- sed is used in tools/GETVERSION, many Makefiles --> <!-- touch is used in Makefiles --> <!-- unzip is used in making R, e.g. for zoneinfo.zip --> <!-- AFAICS [g]awk, egrep, grep, head, rmdir, tail, tr, wc are no longer used --> <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="http://www.cygwin.com/">http://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><span class="file">Rtools*.exe</span></samp>. <!-- So needed for end users: --> <!-- comm cp diff echo gzip make mkdir rm sh sort tar uniq zip --> <p><strong>Beware</strong>: ‘Native’ ports of make are <strong>not</strong> suitable (including those called ‘MinGW make’ at the MinGW SourceForge site and <samp><span class="command">mingw32-make</span></samp> 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-116"></a>You may need to set the environment variable <samp><span class="env">CYGWIN</span></samp> to a value including ‘<samp><span class="samp">nodosfilewarning</span></samp>’ to suppress messages about Windows-style paths. <div class="node"> <a name="The-MinGW-w64-toolchain"></a> <a name="The-MinGW_002dw64-toolchain"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Useful-additional-programs">Useful additional programs</a>, Previous: <a rel="previous" accesskey="p" href="#The-command-line-tools">The command line tools</a>, Up: <a rel="up" accesskey="u" href="#The-Windows-toolset">The Windows toolset</a> </div> <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 ‘toolchain’. <p>The preferred toolchain since R 2.14.2 is part of <code>Rtools30.exe</code>: this uses a beta version of <samp><span class="command">gcc 4.6.3</span></samp> and version 2.0.1 of the MinGW-w64 project's runtime. <p>This toolchain uses <em>multilib</em>: that is there is a single front-end such as <samp><span class="command">gcc.exe</span></samp> for each of the compilers and 32-bit (the default) and 64-bit compilation are selected by the flags<a rel="footnote" href="#fn-46" name="fnd-46"><sup>46</sup></a> <samp><span class="option">-m32</span></samp> and <samp><span class="option">-m64</span></samp> respectively. The tools are all 32-bit Windows executables and should be able to run on any current version of Windows—however you do need a 64-bit version of Windows to build 64-bit R as the build process runs R. <p>To select a 32-bit or 64-bit build of R, set the options in <samp><span class="file">MkRules.local</span></samp> appropriately (following the comments in the file). <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="http://www.stats.ox.ac.uk/pub/Rtools/multilib/">http://www.stats.ox.ac.uk/pub/Rtools/multilib/</a>. Users developing packages with <a href="http://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="http://CRAN.R-project.org/package=Rcpp"><strong>Rcpp</strong></a> from its sources yourself. <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. <div class="node"> <a name="Useful-additional-programs"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#The-MinGW_002dw64-toolchain">The MinGW-w64 toolchain</a>, Up: <a rel="up" accesskey="u" href="#The-Windows-toolset">The Windows toolset</a> </div> <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><span class="file">MkRules.local</span></samp>. <p>Developers of packages will find some of the ‘goodies’ at <a href="http://www.stats.ox.ac.uk/pub/Rtools/goodies">http://www.stats.ox.ac.uk/pub/Rtools/goodies</a> useful. <p>There is a version of the <samp><span class="command">file</span></samp> command that identifies the type of files, and is used by <samp><span class="command">Rcmd check</span></samp> if available. The binary distribution is included in <samp><span class="file">Rtools30.exe</span></samp>. <p>The file <samp><span class="file">xzutils.zip</span></samp> contains the program <samp><span class="command">xz</span></samp> which can be used to (de)compress files with that form of compression. <div class="node"> <a name="Function-and-variable-index"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Concept-index">Concept index</a>, Previous: <a rel="previous" accesskey="p" href="#The-Windows-toolset">The Windows toolset</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <h2 class="unnumbered">Function and variable index</h2> <ul class="index-vr" compact> <li><a href="#index-configure-91"><code>configure</code></a>: <a href="#Using-make">Using make</a></li> <li><a href="#index-configure-82"><code>configure</code></a>: <a href="#Configuration-variables">Configuration variables</a></li> <li><a href="#index-configure-17"><code>configure</code></a>: <a href="#Installation">Installation</a></li> <li><a href="#index-configure-10"><code>configure</code></a>: <a href="#Simple-compilation">Simple compilation</a></li> <li><a href="#index-install_002epackages-50"><code>install.packages</code></a>: <a href="#Installing-packages">Installing packages</a></li> <li><a href="#index-make-90"><code>make</code></a>: <a href="#Using-make">Using make</a></li> <li><a href="#index-R_005fHOME-9"><code>R_HOME</code></a>: <a href="#Simple-compilation">Simple compilation</a></li> <li><a href="#index-remove_002epackages-55"><code>remove.packages</code></a>: <a href="#Removing-packages">Removing packages</a></li> <li><a href="#index-update_002epackages-53"><code>update.packages</code></a>: <a href="#Updating-packages">Updating packages</a></li> </ul><div class="node"> <a name="Concept-index"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Environment-variable-index">Environment variable index</a>, Previous: <a rel="previous" accesskey="p" href="#Function-and-variable-index">Function and variable index</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <h2 class="unnumbered">Concept index</h2> <ul class="index-cp" compact> <li><a href="#index-AIX-109">AIX</a>: <a href="#AIX">AIX</a></li> <li><a href="#index-BLAS-library-106">BLAS library</a>: <a href="#Solaris">Solaris</a></li> <li><a href="#index-BLAS-library-103">BLAS library</a>: <a href="#OS-X">OS X</a></li> <li><a href="#index-BLAS-library-77">BLAS library</a>: <a href="#Linear-algebra">Linear algebra</a></li> <li><a href="#index-FORTRAN-92">FORTRAN</a>: <a href="#Using-FORTRAN">Using FORTRAN</a></li> <li><a href="#index-FreeBSD-113">FreeBSD</a>: <a href="#FreeBSD">FreeBSD</a></li> <li><a href="#index-Installation-16">Installation</a>: <a href="#Installation">Installation</a></li> <li><a href="#index-Installing-under-Unix_002dalikes-5">Installing under Unix-alikes</a>: <a href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a></li> <li><a href="#index-Installing-under-Windows-24">Installing under Windows</a>: <a href="#Installing-R-under-Windows">Installing R under Windows</a></li> <li><a href="#index-Internationalization-58">Internationalization</a>: <a href="#Internationalization">Internationalization</a></li> <li><a href="#index-LAPACK-library-107">LAPACK library</a>: <a href="#Solaris">Solaris</a></li> <li><a href="#index-LAPACK-library-104">LAPACK library</a>: <a href="#OS-X">OS X</a></li> <li><a href="#index-LAPACK-library-80">LAPACK library</a>: <a href="#LAPACK">LAPACK</a></li> <li><a href="#index-Libraries-37">Libraries</a>: <a href="#Add_002don-packages">Add-on packages</a></li> <li><a href="#index-Libraries_002c-managing-41">Libraries, managing</a>: <a href="#Managing-libraries">Managing libraries</a></li> <li><a href="#index-Libraries_002c-site-42">Libraries, site</a>: <a href="#Managing-libraries">Managing libraries</a></li> <li><a href="#index-Libraries_002c-user-45">Libraries, user</a>: <a href="#Managing-libraries">Managing libraries</a></li> <li><a href="#index-Linux-101">Linux</a>: <a href="#Linux">Linux</a></li> <li><a href="#index-Linux-6">Linux</a>: <a href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a></li> <li><a href="#index-Locale-61">Locale</a>: <a href="#Locales">Locales</a></li> <li><a href="#index-Locale-60">Locale</a>: <a href="#Internationalization">Internationalization</a></li> <li><a href="#index-Localization-59">Localization</a>: <a href="#Internationalization">Internationalization</a></li> <li><a href="#index-Manuals-13">Manuals</a>: <a href="#Making-the-manuals">Making the manuals</a></li> <li><a href="#index-Manuals_002c-installing-19">Manuals, installing</a>: <a href="#Installation">Installation</a></li> <li><a href="#index-Obtaining-R-1">Obtaining R</a>: <a href="#Obtaining-R">Obtaining R</a></li> <li><a href="#index-OS-X-102">OS X</a>: <a href="#OS-X">OS X</a></li> <li><a href="#index-OS-X-29">OS X</a>: <a href="#Installing-R-under-OS-X">Installing R under OS X</a></li> <li><a href="#index-OS-X-7">OS X</a>: <a href="#Installing-R-under-Unix_002dalikes">Installing R under Unix-alikes</a></li> <li><a href="#index-Packages-36">Packages</a>: <a href="#Add_002don-packages">Add-on packages</a></li> <li><a href="#index-Packages_002c-default-39">Packages, default</a>: <a href="#Default-packages">Default packages</a></li> <li><a href="#index-Packages_002c-installing-48">Packages, installing</a>: <a href="#Installing-packages">Installing packages</a></li> <li><a href="#index-Packages_002c-removing-56">Packages, removing</a>: <a href="#Removing-packages">Removing packages</a></li> <li><a href="#index-Packages_002c-updating-54">Packages, updating</a>: <a href="#Updating-packages">Updating packages</a></li> <li><a href="#index-Rbitmap_002edll-27">Rbitmap.dll</a>: <a href="#Building-the-bitmap-files">Building the bitmap files</a></li> <li><a href="#index-Repositories-57">Repositories</a>: <a href="#Setting-up-a-package-repository">Setting up a package repository</a></li> <li><a href="#index-Site-libraries-43">Site libraries</a>: <a href="#Managing-libraries">Managing libraries</a></li> <li><a href="#index-Solaris-105">Solaris</a>: <a href="#Solaris">Solaris</a></li> <li><a href="#index-Sources-for-R-2">Sources for R</a>: <a href="#Getting-and-unpacking-the-sources">Getting and unpacking the sources</a></li> <li><a href="#index-Subversion-71">Subversion</a>: <a href="#Essential-programs-and-libraries">Essential programs and libraries</a></li> <li><a href="#index-Subversion-4">Subversion</a>: <a href="#Using-Subversion-and-rsync">Using Subversion and rsync</a></li> <li><a href="#index-User-libraries-46">User libraries</a>: <a href="#Managing-libraries">Managing libraries</a></li> <li><a href="#index-Vignettes-70">Vignettes</a>: <a href="#Essential-programs-and-libraries">Essential programs and libraries</a></li> <li><a href="#index-winCairo_002edll-28">winCairo.dll</a>: <a href="#Building-the-cairo-devices-files">Building the cairo devices files</a></li> </ul><div class="node"> <a name="Environment-variable-index"></a> <p><hr> Previous: <a rel="previous" accesskey="p" href="#Concept-index">Concept index</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> <h2 class="unnumbered">Environment variable index</h2> <ul class="index-en" compact> <li><a href="#index-BLAS_005fLIBS-78"><code>BLAS_LIBS</code></a>: <a href="#BLAS">BLAS</a></li> <li><a href="#index-CC-97"><code>CC</code></a>: <a href="#Using-FORTRAN">Using FORTRAN</a></li> <li><a href="#index-CONFIG_005fSITE-83"><code>CONFIG_SITE</code></a>: <a href="#Configuration-variables">Configuration variables</a></li> <li><a href="#index-CPP-98"><code>CPP</code></a>: <a href="#Using-FORTRAN">Using FORTRAN</a></li> <li><a href="#index-CYGWIN-116"><code>CYGWIN</code></a>: <a href="#The-command-line-tools">The command line tools</a></li> <li><a href="#index-DESTDIR-68"><code>DESTDIR</code></a>: <a href="#Unix_002dalike-standalone">Unix-alike standalone</a></li> <li><a href="#index-DESTDIR-20"><code>DESTDIR</code></a>: <a href="#Installation">Installation</a></li> <li><a href="#index-F2C-95"><code>F2C</code></a>: <a href="#Using-FORTRAN">Using FORTRAN</a></li> <li><a href="#index-F2CLIBS-96"><code>F2CLIBS</code></a>: <a href="#Using-FORTRAN">Using FORTRAN</a></li> <li><a href="#index-FPICFLAGS-99"><code>FPICFLAGS</code></a>: <a href="#Using-FORTRAN">Using FORTRAN</a></li> <li><a href="#index-JAVA_005fHOME-74"><code>JAVA_HOME</code></a>: <a href="#Java-support">Java support</a></li> <li><a href="#index-LANG-65"><code>LANG</code></a>: <a href="#Localization-of-messages">Localization of messages</a></li> <li><a href="#index-LANGUAGE-62"><code>LANGUAGE</code></a>: <a href="#Localization-of-messages">Localization of messages</a></li> <li><a href="#index-LAPACK_005fLIBS-81"><code>LAPACK_LIBS</code></a>: <a href="#LAPACK">LAPACK</a></li> <li><a href="#index-LC_005fALL-63"><code>LC_ALL</code></a>: <a href="#Localization-of-messages">Localization of messages</a></li> <li><a href="#index-LC_005fCOLLATE-23"><code>LC_COLLATE</code></a>: <a href="#Testing-a-Unix_002dalike-Installation">Testing a Unix-alike Installation</a></li> <li><a href="#index-LC_005fMESSAGES-64"><code>LC_MESSAGES</code></a>: <a href="#Localization-of-messages">Localization of messages</a></li> <li><a href="#index-LD_005fLIBRARY_005fPATH-108"><code>LD_LIBRARY_PATH</code></a>: <a href="#Using-gcc">Using gcc</a></li> <li><a href="#index-LD_005fLIBRARY_005fPATH-100"><code>LD_LIBRARY_PATH</code></a>: <a href="#Compile-and-load-flags">Compile and load flags</a></li> <li><a href="#index-LD_005fLIBRARY_005fPATH-94"><code>LD_LIBRARY_PATH</code></a>: <a href="#Using-FORTRAN">Using FORTRAN</a></li> <li><a href="#index-LD_005fLIBRARY_005fPATH-79"><code>LD_LIBRARY_PATH</code></a>: <a href="#ACML">ACML</a></li> <li><a href="#index-LD_005fLIBRARY_005fPATH-67"><code>LD_LIBRARY_PATH</code></a>: <a href="#Unix_002dalike-standalone">Unix-alike standalone</a></li> <li><a href="#index-LOCAL_005fSOFT-52"><code>LOCAL_SOFT</code></a>: <a href="#Windows-packages">Windows packages</a></li> <li><a href="#index-OBJECT_005fMODE-112"><code>OBJECT_MODE</code></a>: <a href="#AIX">AIX</a></li> <li><a href="#index-PAPERSIZE-85"><code>PAPERSIZE</code></a>: <a href="#Setting-paper-size">Setting paper size</a></li> <li><a href="#index-PATH-114"><code>PATH</code></a>: <a href="#The-Windows-toolset">The Windows toolset</a></li> <li><a href="#index-PATH-111"><code>PATH</code></a>: <a href="#AIX">AIX</a></li> <li><a href="#index-PATH-93"><code>PATH</code></a>: <a href="#Using-FORTRAN">Using FORTRAN</a></li> <li><a href="#index-PATH-72"><code>PATH</code></a>: <a href="#Essential-programs-and-libraries">Essential programs and libraries</a></li> <li><a href="#index-R_005fARCH-21"><code>R_ARCH</code></a>: <a href="#Sub_002darchitectures">Sub-architectures</a></li> <li><a href="#index-R_005fBROWSER-86"><code>R_BROWSER</code></a>: <a href="#Setting-the-browsers">Setting the browsers</a></li> <li><a href="#index-R_005fDEFAULT_005fPACKAGES-40"><code>R_DEFAULT_PACKAGES</code></a>: <a href="#Default-packages">Default packages</a></li> <li><a href="#index-R_005fDISABLE_005fHTTPD-12"><code>R_DISABLE_HTTPD</code></a>: <a href="#Help-options">Help options</a></li> <li><a href="#index-R_005fGSCMD-73"><code>R_GSCMD</code></a>: <a href="#Useful-libraries-and-programs">Useful libraries and programs</a></li> <li><a href="#index-R_005fINSTALL_005fTAR-51"><code>R_INSTALL_TAR</code></a>: <a href="#Windows-packages">Windows packages</a></li> <li><a href="#index-R_005fJAVA_005fLD_005fLIBRARY_005fPATH-75"><code>R_JAVA_LD_LIBRARY_PATH</code></a>: <a href="#Java-support">Java support</a></li> <li><a href="#index-R_005fLIBS-38"><code>R_LIBS</code></a>: <a href="#Add_002don-packages">Add-on packages</a></li> <li><a href="#index-R_005fLIBS_005fSITE-44"><code>R_LIBS_SITE</code></a>: <a href="#Managing-libraries">Managing libraries</a></li> <li><a href="#index-R_005fLIBS_005fUSER-47"><code>R_LIBS_USER</code></a>: <a href="#Managing-libraries">Managing libraries</a></li> <li><a href="#index-R_005fPAPERSIZE-89"><code>R_PAPERSIZE</code></a>: <a href="#Making-manuals">Making manuals</a></li> <li><a href="#index-R_005fPAPERSIZE-84"><code>R_PAPERSIZE</code></a>: <a href="#Setting-paper-size">Setting paper size</a></li> <li><a href="#index-R_005fPAPERSIZE-30"><code>R_PAPERSIZE</code></a>: <a href="#Running-R">Running R</a></li> <li><a href="#index-R_005fPAPERSIZE-14"><code>R_PAPERSIZE</code></a>: <a href="#Making-the-manuals">Making the manuals</a></li> <li><a href="#index-R_005fPDFVIEWER-87"><code>R_PDFVIEWER</code></a>: <a href="#Setting-the-browsers">Setting the browsers</a></li> <li><a href="#index-R_005fRD4PDF-115"><code>R_RD4PDF</code></a>: <a href="#LaTeX">LaTeX</a></li> <li><a href="#index-R_005fRD4PDF-88"><code>R_RD4PDF</code></a>: <a href="#Making-manuals">Making manuals</a></li> <li><a href="#index-R_005fRD4PDF-15"><code>R_RD4PDF</code></a>: <a href="#Making-the-manuals">Making the manuals</a></li> <li><a href="#index-R_005fSHELL-110"><code>R_SHELL</code></a>: <a href="#AIX">AIX</a></li> <li><a href="#index-R_005fUSER-34"><code>R_USER</code></a>: <a href="#Running-R">Running R</a></li> <li><a href="#index-TAR-69"><code>TAR</code></a>: <a href="#Essential-programs-and-libraries">Essential programs and libraries</a></li> <li><a href="#index-TAR_005fOPTIONS-25"><code>TAR_OPTIONS</code></a>: <a href="#Getting-the-source-files">Getting the source files</a></li> <li><a href="#index-TAR_005fOPTIONS-3"><code>TAR_OPTIONS</code></a>: <a href="#Getting-and-unpacking-the-sources">Getting and unpacking the sources</a></li> <li><a href="#index-TEMP-33"><code>TEMP</code></a>: <a href="#Running-R">Running R</a></li> <li><a href="#index-TMP-32"><code>TMP</code></a>: <a href="#Running-R">Running R</a></li> <li><a href="#index-TMPDIR-49"><code>TMPDIR</code></a>: <a href="#Installing-packages">Installing packages</a></li> <li><a href="#index-TMPDIR-31"><code>TMPDIR</code></a>: <a href="#Running-R">Running R</a></li> <li><a href="#index-TMPDIR-26"><code>TMPDIR</code></a>: <a href="#Building-the-core-files">Building the core files</a></li> <li><a href="#index-TMPDIR-8"><code>TMPDIR</code></a>: <a href="#Simple-compilation">Simple compilation</a></li> </ul><div class="footnote"> <hr> <a name="texinfo-footnotes-in-document"></a><h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> e.g. <acronym>GNU</acronym> <samp><span class="command">tar</span></samp> version 1.15 or later, or that from the ‘<samp><span class="samp">libarchive</span></samp>’ (as used on OS 10.6 and later) or ‘Heirloom Toolchest’ distributions.</p> <p class="footnote"><small>[<a name="fn-2" href="#fnd-2">2</a>]</small> for some Subversion clients ‘<samp><span class="samp">http:</span></samp>’ may appear to work, but requires continual redirection.</p> <p class="footnote"><small>[<a name="fn-3" href="#fnd-3">3</a>]</small> Most aspects will work with paths containing spaces, but external software used by R, e.g. <samp><span class="command">texi2dvi</span></samp> version <code>4.8</code>, may not.</p> <p class="footnote"><small>[<a name="fn-4" href="#fnd-4">4</a>]</small> which use <samp><span class="file">lib</span></samp> rather than <samp><span class="file">lib64</span></samp> for their primary 64-bit library directories.</p> <p class="footnote"><small>[<a name="fn-5" href="#fnd-5">5</a>]</small> for example, if you configured R with <samp><span class="option">--without-recommended</span></samp>.</p> <p class="footnote"><small>[<a name="fn-6" href="#fnd-6">6</a>]</small> on a Unix-alike, ‘<samp><span class="samp">incosolata</span></samp>’ is omitted if not found by <samp><span class="command">configure</span></samp>.</p> <p class="footnote"><small>[<a name="fn-7" href="#fnd-7">7</a>]</small> with possible values ‘<samp><span class="samp">i386</span></samp>’, ‘<samp><span class="samp">x64</span></samp>’, ‘<samp><span class="samp">32</span></samp>’ and ‘<samp><span class="samp">64</span></samp>’.</p> <p class="footnote"><small>[<a name="fn-8" href="#fnd-8">8</a>]</small> mainly on RedHat and Fedora, whose layout is described here.</p> <p class="footnote"><small>[<a name="fn-9" href="#fnd-9">9</a>]</small> unless they were excluded in the build.</p> <p class="footnote"><small>[<a name="fn-10" href="#fnd-10">10</a>]</small> its binding is locked once the startup files have been read, so users cannot easily change it.</p> <p class="footnote"><small>[<a name="fn-11" href="#fnd-11">11</a>]</small> If a proxy needs to be set, see <samp><span class="command">?download.file</span></samp>.</p> <p class="footnote"><small>[<a name="fn-12" href="#fnd-12">12</a>]</small> 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><span class="file">tools:::.install_packages</span></samp> for the list. It can also be specified in the package's <samp><span class="file">DESCRIPTION</span></samp> file.</p> <p class="footnote"><small>[<a name="fn-13" href="#fnd-13">13</a>]</small> or by adding it in a file such as <samp><span class="file">etc/i386/Makevars.site</span></samp>, which does not exist by default.</p> <p class="footnote"><small>[<a name="fn-14" href="#fnd-14">14</a>]</small> ‘X/Open Portability Guide’, which has had several versions.</p> <p class="footnote"><small>[<a name="fn-15" href="#fnd-15">15</a>]</small> On some systems setting <samp><span class="env">LC_ALL</span></samp> or <samp><span class="env">LC_MESSAGES</span></samp> to ‘<samp><span class="samp">C</span></samp>’ disables <samp><span class="env">LANGUAGE</span></samp>.</p> <p class="footnote"><small>[<a name="fn-16" href="#fnd-16">16</a>]</small> If you try changing from French to Russian except in a UTF-8 locale, you will most likely find messages change to English.</p> <p class="footnote"><small>[<a name="fn-17" href="#fnd-17">17</a>]</small> the language written in England: some people living in the USA appropriate this name for their language.</p> <p class="footnote"><small>[<a name="fn-18" href="#fnd-18">18</a>]</small> with Americanisms.</p> <p class="footnote"><small>[<a name="fn-19" href="#fnd-19">19</a>]</small> also known as <acronym>IEEE</acronym> 754</p> <p class="footnote"><small>[<a name="fn-20" href="#fnd-20">20</a>]</small> at least when storing quantities: the on-FPU precision is allowed to vary</p> <p class="footnote"><small>[<a name="fn-21" href="#fnd-21">21</a>]</small> e.g. Bessel, beta and gamma functions</p> <p class="footnote"><small>[<a name="fn-22" href="#fnd-22">22</a>]</small> including copying <samp><span class="file">MkRules.dist</span></samp> to <samp><span class="file">MkRule.local</span></samp> and selecting the architecture.</p> <p class="footnote"><small>[<a name="fn-23" href="#fnd-23">23</a>]</small> also known as <acronym>IEEE</acronym> 754</p> <p class="footnote"><small>[<a name="fn-24" href="#fnd-24">24</a>]</small> Note that C11 compilers (when they appear) need not be C99-compliant: R requires support for <code>double complex</code> which is optional in C11 but is mandatory in C99.</p> <p class="footnote"><small>[<a name="fn-25" href="#fnd-25">25</a>]</small> <samp><span class="option">-std=c99</span></samp> excludes POSIX functionality, but <samp><span class="file">config.h</span></samp> will turn on all <acronym>GNU</acronym> extensions to include the POSIX functionality.</p> <p class="footnote"><small>[<a name="fn-26" href="#fnd-26">26</a>]</small> apparently when built by default, but not for example as built for Fedora 15.</p> <p class="footnote"><small>[<a name="fn-27" href="#fnd-27">27</a>]</small> specifically, the C99 functionality of headers <samp><span class="file">wchar.h</span></samp> and <samp><span class="file">wctype.h</span></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> <p class="footnote"><small>[<a name="fn-28" href="#fnd-28">28</a>]</small> Such as <acronym>GNU</acronym> <samp><span class="command">tar</span></samp> 1.15 or later, <samp><span class="command">bsdtar</span></samp> (from <a href="http://code.google.com/p/libarchive/">http://code.google.com/p/libarchive/</a>, as used by FreeBSD and OS 10.6 and later) or <samp><span class="command">tar</span></samp> from the Heirloom Toolchest (<a href="http://heirloom.sourceforge.net/tools.html">http://heirloom.sourceforge.net/tools.html</a>).</p> <p class="footnote"><small>[<a name="fn-29" href="#fnd-29">29</a>]</small> <samp><span class="command">texi2dvi</span></samp> is normally a shell script. Some versions, e.g. that from <strong>texinfo</strong> 4.13a, need to be run under <samp><span class="command">bash</span></samp> rather than a Bourne shell as on, say, Solaris.</p> <p class="footnote"><small>[<a name="fn-30" href="#fnd-30">30</a>]</small> also known as <code>ttf-mscorefonts-installer</code> in the Debian/Ubuntu world: see also <a href="http://en.wikipedia.org/wiki/Core_fonts_for_the_Web">http://en.wikipedia.org/wiki/Core_fonts_for_the_Web</a>.</p> <p class="footnote"><small>[<a name="fn-31" href="#fnd-31">31</a>]</small> <code>ttf-liberation</code> in Debian/Ubuntu.</p> <p class="footnote"><small>[<a name="fn-32" href="#fnd-32">32</a>]</small> Using the Oracle Solaris Studio <samp><span class="command">cc</span></samp> and <samp><span class="command">f95</span></samp> compilers</p> <p class="footnote"><small>[<a name="fn-33" href="#fnd-33">33</a>]</small> and perhaps others</p> <p class="footnote"><small>[<a name="fn-34" href="#fnd-34">34</a>]</small> We have measured 15–20% on ‘<samp><span class="samp">i686</span></samp>’ Linux and around 10% on ‘<samp><span class="samp">x86_64</span></samp>’ Linux.</p> <p class="footnote"><small>[<a name="fn-35" href="#fnd-35">35</a>]</small> On HP-UX <samp><span class="command">fort77</span></samp> is the <acronym>POSIX</acronym> compliant FORTRAN compiler, and comes after <samp><span class="command">g77</span></samp>.</p> <p class="footnote"><small>[<a name="fn-36" href="#fnd-36">36</a>]</small> as well as its equivalence to the <code>Rcomplex</code> structure defined in <samp><span class="file">R_ext/Complex.h</span></samp>.</p> <p class="footnote"><small>[<a name="fn-37" href="#fnd-37">37</a>]</small> for example, <code>X11 font at size 14 could not be loaded</code>.</p> <p class="footnote"><small>[<a name="fn-38" href="#fnd-38">38</a>]</small> or <code>-mtune=corei7</code> for Intel Core i3/15/17 with <samp><span class="command">gcc >= 4.6.0</span></samp>.</p> <p class="footnote"><small>[<a name="fn-39" href="#fnd-39">39</a>]</small> Apple's <code>clang</code> should be able to: some builds of <code>gcc</code> can, but not all built with Objective C support work.</p> <p class="footnote"><small>[<a name="fn-40" href="#fnd-40">40</a>]</small> including <samp><span class="command">gcc</span></samp> for Sparc from Oracle.</p> <p class="footnote"><small>[<a name="fn-41" href="#fnd-41">41</a>]</small> TeXLive is recommended.</p> <p class="footnote"><small>[<a name="fn-42" href="#fnd-42">42</a>]</small> Windows DLLs need to have all links resolved at build time and so cannot resolve against <samp><span class="file">R.bin</span></samp>.</p> <p class="footnote"><small>[<a name="fn-43" href="#fnd-43">43</a>]</small> For example, the Cygwin version of <code>make 3.81</code> fails to work correctly.</p> <p class="footnote"><small>[<a name="fn-44" href="#fnd-44">44</a>]</small> for R 2.15.3 and later.</p> <p class="footnote"><small>[<a name="fn-45" href="#fnd-45">45</a>]</small> such as <samp><span class="command">sort</span></samp>, <samp><span class="command">find</span></samp> and perhaps <samp><span class="command">make</span></samp>.</p> <p class="footnote"><small>[<a name="fn-46" href="#fnd-46">46</a>]</small> these flags apply to the compilers: some of the tools use different flags. 32-bit builds are the default.</p> <hr></div> </body></html> <!-- Local Variables: coding: iso-8859-1 End: -->