Rev 29820 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
<html lang="en"><head><title>R Installation and Administration</title><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><meta name="description" content="R Installation and Administration"><meta name="generator" content="makeinfo 4.6"><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 }--></style></head><body><h1 class="settitle">R Installation and Administration</h1><a name="Top"></a><h2 class="unnumbered">R Installation and Administration</h2><p>This is a guide to installation and administration for R.<p>The current version of this document is 2.0.0 (2004-06-16).ISBN 3-900051-02-X<a name="Obtaining%20R"></a><h2 class="chapter">1 Obtaining R</h2><p>Sources, binaries and documentation for R can be obtained via<small>CRAN</small>, the "Comprehensive R Archive Network". See the file<code>RESOURCES</code> in the R distribution for information on<small>CRAN</small>.<a name="Getting%20and%20unpacking%20the%20sources"></a><h3 class="section">1.1 Getting and unpacking the sources</h3><p>The simplest way is to download the most recent<code>R-</code><var>x</var><code>.</code><var>y</var><code>.</code><var>z</var><code>.tgz</code> file, and unpack it with<pre class="smallexample"> tar xvfz R-<var>x</var>.<var>y</var>.<var>z</var>.tgz</pre><p>on systems that have GNU <code>tar</code> installed. On other systems youneed at least to have the <code>gzip</code> program installed. Then youcan use<pre class="smallexample"> gzip -dc R-<var>x</var>.<var>y</var>.<var>z</var>.tgz | tar xvf -</pre><p>If you need to transport the sources on floppy disks, you can downloadthe <code>R-</code><var>x</var><code>.</code><var>y</var><code>.</code><var>z</var><code>.tgz-split.*</code> files and paste themtogether at the destination with (Unix)<pre class="smallexample"> cat R-<var>x</var>.<var>y</var>.<var>z</var>-split.* > R-<var>x</var>.<var>y</var>.<var>z</var>.tgz</pre><p>and proceed as above. If you want the build to be usable by a group ofusers, set <code>umask</code> before unpacking so that the files will bereadable by the target group (e.g., <code>umask 022</code> to be usable by allusers).<a name="Getting%20patched%20and%20development%20versions"></a><h3 class="section">1.2 Getting patched and development versions</h3><p>A patched version of the current release, <code>r-patched</code> and thecurrent development version, <code>r-devel</code>, are available as dailytarballs and via rsync. The development version is also available byanonymous CVS from <a href="http://anoncvs.r-project.org/">http://anoncvs.r-project.org/</a>.<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 either<code>R-patched.tar.gz</code> or <code>R-devel.tar.gz</code> (or the<code>.tar.bz2</code> versions) and unpack as described in the previoussection.<p>These versions do not contain the current sources for the recommendedpackages, which can be obtained by rsync (see the next section) or fromCRAN. Do ensure that you have the correct versions of the recommendedpackages: if the number in the file <code>VERSION</code> is<code></code><var>x</var><code>.</code><var>y</var><code>.</code><var>z</var><code></code> you need to download the contents of<code>http://cran.r-project.org/src/contrib/</code><var>x</var><code>.</code><var>y</var><code>.</code><var>z</var><code>/Recommended</code>to directory <code>src/library/Recommended</code> in the sources you haveunpacked. Normally <code>R-patched.tar.gz</code> will have the number of thelast released version, and <code>R-devel.tar.gz</code> that of the next minor(<code></code><var>x</var><code>.</code><var>y</var><code>.0</code>) release. After downloading manually you needto execute <code>tools/link-recommended</code> from the top level of thesources to make the requisite links in <code>src/library/Recommended</code>.<p>One way to download the package sources is to use <code>wget</code>. Asuitable incantation from the top level of the R sources might be<pre class="smallexample"> wget -r -l1 --no-parent -A\*.gz -nd -P src/library/Recommended \http://cran.r-project.org/src/contrib/<var>x</var>.<var>y</var>.<var>z</var>/Recommendedtools/link-recommended</pre><a name="Using%20rsync"></a><h3 class="section">1.3 Using rsync</h3><p>Sources are also available via anonymous rsync. Use<pre class="smallexample"> rsync -rC --delete rsync.r-project.org::<var>module</var> R</pre><p>to create a copy of the source tree specified by <var>module</var> in thesubdirectory <code>R</code> of the current directory, where <var>module</var> canbe one of <code>r-release</code> (current released version), <code>r-patched</code>(patched released version), and <code>r-devel</code> (development version).The rsync trees are created directly from the master CVS archive and areupdated hourly. The <code>-C</code> option in the <code>rsync</code> commandis to cause it to skip the CVS directories. Further information on<code>rsync</code> is available at <a href="http://rsync.samba.org/rsync/">http://rsync.samba.org/rsync/</a>.<p>Note that the sources available via rsync do not include the recommendedpackages, whereas these are included in the tarballs of releasedversions. To install the appropriate sources for the recommendedpackages, run <code>./tools/rsync-recommended</code> from the top-level ofthe R sources.<a name="Installing%20R%20under%20Unix"></a><h2 class="chapter">2 Installing R under Unix</h2><p>R will configure and build under a number of common Unix platformsincluding i386-freebsd, <var>cpu</var>-linux-gnu for the i386, alpha, amd64,arm, hppa, ia64, m68k, powerpc, and sparc CPUs (see e.g.<a href="http://buildd.debian.org/build.php?&pkg=r-base">http://buildd.debian.org/build.php?&pkg=r-base</a>) andsparc-sun-solaris, as well as probably (it is tested less frequently onthese) i386-netbsd, i386-openbsd, i386-sun-solaris,powerpc-apple-darwin, mips-sgi-irix, alpha-dec-osf4, rs6000-ibm-aix andhppa-hp-hpux.<p>In addition, binary distributions are available for most common Linuxdistributions, and for Mac OS X (Darwin) with and without X11. See the<small>FAQ</small> for current details. These are installed inplatform-specific ways. So for the rest of this chapter we consideronly building from the sources.<a name="Simple%20compilation"></a><h3 class="section">2.1 Simple compilation</h3><p>First review the essential and useful tools and libraries in<a href="#Essential%20and%20useful%20other%20programs">Essential and useful other programs</a>, and install those you want orneed. Ensure that the environment variable <code>TMPDIR</code> is eitherunset or points to a valid temporary directory.<p>Choose a place to install the R tree (R is not just a binary, buthas additional data sets, help files, font metrics etc). Let us callthis place <var>R_HOME</var>. Untar the source code. This should createdirectories <code>src</code>, <code>doc</code>, and several more. Issue thefollowing commands:<pre class="smallexample"> ./configuremake</pre><p>(See <a href="#Using%20make">Using make</a> if your make is not called <code>make</code>.)<p>Then check the built system works correctly, by<pre class="smallexample"> make check</pre><p>Failures are not necessarily problems as they might be caused by missingfunctionality, but you should look carefully at any reporteddiscrepancies. To re-run the tests you would need<pre class="smallexample"> make check FORCE=FORCE</pre><p>More comprehensive testing can be done by<pre class="smallexample"> make check-devel</pre><p>or<pre class="smallexample"> make check-all</pre><p>see <code>tests/README</code>.<p>If these commands execute successfully, the R binary will be copiedto the <code></code><var>R_HOME</var><code>/bin</code> directory. In addition, a shell-scriptfront-end called <code>R</code> will be created and copied to the samedirectory. You can copy this script to a place where users can invokeit, for example to <code>/usr/local/bin/R</code>. You could also copy the manpage <code>R.1</code> to a place where your <code>man</code> reader finds it,such as <code>/usr/local/man/man1</code>. If you want to install the completeR tree to, e.g., <code>/usr/local/lib/R</code>, see <a href="#Installation">Installation</a>.Note: you do not <em>need</em> to install R: you can run it from whereit was built.<p>You do not necessarily have to build R in the top-level sourcedirectory (say, <code></code><var>TOP_SRCDIR</var><code></code>). To build in<code></code><var>BUILDDIR</var><code></code>, run<pre class="smallexample"> cd <var>BUILDDIR</var><var>TOP_SRCDIR</var>/configuremake</pre><p>and so on, as described further below. This has the advantage of alwayskeeping your source tree "clean". (You may need GNU <code>make</code> toallow this.)<p>Make will also build plain text help pages as well as <small>HTML</small> andLaTeX versions of the R object documentation (the three kinds canalso be generated separately using <code>make help</code>, <code>make html</code>and <code>make latex</code>). Note that you need Perl version 5: if this isnot available on your system, you can obtain PDF versions of thedocumentation files via <small>CRAN</small>.<p>Now <code>rehash</code> if necessary, type <kbd>R</kbd>, and read the R manualsand the R <small>FAQ</small> (files <code>FAQ</code> or<code>doc/html/faq.html</code>, or<a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html">http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html</a> which always hasthe latest version).<a name="Making%20the%20manuals"></a><h3 class="section">2.2 Making the manuals</h3><p>There is a set of manuals that can be built from the sources,<dl><dt><code>refman</code><dd>Printed versions of all the help pages.<br><dt><code>R-FAQ</code><dd>R <small>FAQ</small> (which is already built for you).<br><dt><code>R-intro</code><dd>"An Introduction to R".<br><dt><code>R-data</code><dd>"R Data Import/Export".<br><dt><code>R-admin</code><dd>"R Installation and Administration", this manual.<br><dt><code>R-exts</code><dd>"Writing R Extensions".<br><dt><code>R-lang</code><dd>"The R Language Definition".</dl><p>To make these, use<pre class="smallexample"> make dvi to create DVI versionsmake pdf to create PDF versionsmake info to create info files (not <code>refman</code>).</pre><p>You will not be able to build the info files unless you have<code>makeinfo</code> version 4 or later installed.<p>The DVI versions can be previewed and printed using standard programssuch as <code>xdvi</code> and <code>dvips</code>. The PDF versions can beviewed using Acrobat Reader or (fairly recent versions of) ghostscript:they have hyperlinks that can be followed in Acrobat Reader. The infofiles are suitable for reading online with Emacs or the standalone GNUInfo.<a name="Installation"></a><h3 class="section">2.3 Installation</h3><p>After<pre class="smallexample"> ./configuremakemake check</pre><p>have been completed successfully, you can install the complete R treeto your system by typing<pre class="smallexample"> make install</pre><p>This will install to the following directories:<dl><dt><code></code><var>prefix</var><code>/bin</code><dd>the front-end shell script<br><dt><code></code><var>prefix</var><code>/man/man1</code><dd>the man page<br><dt><code></code><var>prefix</var><code>/lib/R</code><dd>all the rest (libraries, on-line help system, <small class="dots">...</small>)</dl><p>where <var>prefix</var> is determined during configuration (typically<code>/usr/local</code>) and can be set by running <code>configure</code> withthe option <code>--prefix</code>, as in<pre class="smallexample"> ./configure --prefix=/where/you/want/R/to/go</pre><p>This causes <code>make install</code> to install the R executable to<code>/where/you/want/R/to/go/bin</code>, and so on. The prefix of theinstallation directories can be seen in the status message that isdisplayed at the end of <code>configure</code>. You can install intoanother directory by using<pre class="smallexample"> make prefix=/path/to/here install</pre><p>More precise control is available at configure time via options: see<code>configure --help</code> for details.<p>To install DVI, info and PDF versions of the manuals, use one or more of<pre class="smallexample"> make install-dvimake install-infomake install-pdf</pre><p>To ensure that the installed tree is usable by the right group of users,set <code>umask</code> appropriately (perhaps to <code>022</code>) before unpackingthe sources and throughout the build process.<a name="Installing%20R%20under%20Windows"></a><h2 class="chapter">3 Installing R under Windows</h2><p>The <code>bin/windows</code> directory of a <small>CRAN</small> site containsbinaries for a base distribution and a large number of add-on packagesfrom <small>CRAN</small> to run on Windows 95, 98, NT4, 2000, ME and XP (atleast) on Intel x86 and clones (but not on other platforms).<p>You do need one of those Windows versions: Windows 3.11+win32s will notwork.<p>Your file system must allow long file names (as is likely exceptperhaps for some network-mounted systems).<p>Installation is <em>via</em> the installers <code>rw2000dev.exe</code>or <code>miniR.exe</code>. Just double-click on the icon and follow theinstructions. You can uninstall R from the Control Panel.<p>See the <a href="http://cran.r-project.org/bin/windows/rw-FAQ.html">R Windows <small>FAQ</small></a> for more details.<a name="Building%20from%20source"></a><h3 class="section">3.1 Building from source</h3><p>If you want to build this port from the sources, see the file<code>src/gnuwin32/INSTALL</code> in the source distribution. You will needto collect, install and test an extensive set of tools: see<a href="http://www.murdoch-sutherland.com/Rtools/">http://www.murdoch-sutherland.com/Rtools/</a> for the current locations.<p>You may need to compile under a case-honouring file system: we foundthat a <code>samba</code>-mounted file system (which maps all file names tolower case) did not work. Open a commands window at a directory <em>whosepath does not contain spaces</em>, and run something like<pre class="smallexample"> tar zxvf R-2.0.0.tgzcd R-2.0.0\src\gnuwin32make all recommended</pre><p>sit back and wait (for about 15 minutes on 1GHz PIII with a fast localdisc).<p>For further details, including how to make the documentation and how tocross-compile, see <code>src/gnuwin32/INSTALL</code>.<a name="Installing%20R%20under%20Mac%20OS%20X"></a><h2 class="chapter">4 Installing R under Mac OS X</h2><p>The <code>bin/macosx</code> directory of a <small>CRAN</small> site containsbinaries for a base distribution and a large number of add-on packagesfrom <small>CRAN</small> to run on Mac OS X version 10.2.0 or higher.<p>The simplest way is to use <code>R.dmg.sit</code>. Just double-click on theicon and the archive will be expanded as an image di file. Read the<code>ReadMe.txt</code> inside the disk image and follow the instructions.<p>See the <a href="http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html">R for Mac OS X <small>FAQ</small></a> for more details.<a name="Building%20from%20source%20on%20Mac%20OS%20X"></a><h3 class="section">4.1 Building from source on Mac OS X</h3><p>If you want to build this port from the sources, you can read the abovementioned <a href="http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html">R for Mac OS X <small>FAQ</small></a> for full details. You will need to collectand install some tools as explained in the document. Than you have toexpand the R sources and configure R appropriately, for example<pre class="smallexample"> tar zxvf R-2.0.0.tgzcd R-2.0.0./configure --with-blas='-framework vecLib' --with-lapack --with-aquamake</pre><p>sit back and wait. The last option <code>--with-aqua</code> is needed only if you want a Console GUI.The first two options are strongly recommended.<p>R is by default configured and installed as a framework called<code>R.framework</code>. The default path for <code>R.framework</code> is<code>/Library/Frameworks</code> but this can be changed at configure timespecifying the flag <code>--enable-R-framework[=DIR]</code> or at installtime as<pre class="smallexample"> make prefix=/where/you/want/R.framework/to/go install</pre><p>the <code>R.framework</code> has not to be specified in the path.<a name="Add-on%20packages"></a><h2 class="chapter">5 Add-on packages</h2><p>It is helpful to use the correct terminology. A <em>package</em> isloaded from a <em>library</em> by the function <code>library()</code>. Thus alibrary is a directory containing installed packages; the main libraryis <code></code><var>R_HOME</var><code>/library</code>, but others can be used, for example bysetting the environment variable <code>R_LIBS</code> or using the R function<code>.libPaths()</code>.<a name="Installing%20packages"></a><h3 class="section">5.1 Installing packages</h3><p>Packages may be distributed in source form or compiled binary form.Installing source packages requires that compilers and tools(including Perl 5.004 or later) be installed. Binary packagesare platform specific and generally needno special tools to install, but see the documentation foryour platform for details.<p>Note that you need to specify implicitly or explicitly the library towhich the package is to be installed. This is only an issue if you havemore than one library, of course.<p>To install packages from source on Unix use<pre class="smallexample"> R CMD INSTALL -l /path/to/library <var>pkg1</var> <var>pkg2</var> ...</pre><p>The part <code>-l /path/to/library</code> can be omitted, in which case thefirst library in <code>R_LIBS</code> is used if set, otherwise the mainlibrary <code></code><var>R_HOME</var><code>/library</code> is used. (<code>R_LIBS</code> is lookedfor in the environment: <code>.Renviron</code> is not read by <code>R CMD</code>.)<p>The same command works in Windows if you have the source-code packagefiles installed.<p>Alternatively, packages can be downloaded and installed from withinR. First set the option <code>CRAN</code> to your nearest <small>CRAN</small>mirror, for example<pre class="smallexample"> > options(CRAN = "http://cran.us.r-project.org/")</pre><p>Then download and install package <strong>foo</strong> by<pre class="smallexample"> > install.packages("foo")</pre><p>Unless the library is specified (argument <code>lib</code>) the first libraryin the library search path is used.<p>What this does is different on Unix and Windows. On Unix it consultsthe list of available source packages on <small>CRAN</small>, downloads thelatest version of the <strong>foo</strong> sources, and installs it (via <code>RCMD INSTALL</code>). On Windows it looks at the list of <em>binary</em>versions of packages and downloads the latest version (if any).<p>On Windows <code>install.packages</code> can also install a binary packagefrom a local <code>zip</code> file by setting argument <code>CRAN</code> to<code>NULL</code>. <code>RGui.exe</code> has a menu <code>Packages</code> with a GUIinterface to <code>install.packages</code>, <code>update.packages</code> and<code>library</code>.<p>On Mac OS X <code>install.packages</code> works as it does on other Unixsystems, but there is an additional function <code>install.binaries</code>that will download and install binary packages from<small>CRAN</small>. These Macintosh binary package files have theextension <code>tgz</code>. The Aqua GUI provides for installation of eitherbinary or source packages, from <small>CRAN</small> or local files.<a name="Updating%20packages"></a><h3 class="section">5.2 Updating packages</h3><p>The command <code>update.packages()</code> is the simplest way to ensure thatall the packages on your system are up to date. Set the <code>CRAN</code>option as in the previous section. The <code>update.packages()</code>downloads the list of available packages and their current versions,compares it with those installed and offers to fetch and install anythat have later versions on <small>CRAN</small>.<p>An alternative way of keeping packages up-to-date is provided by thecommand <code>packageStatus()</code>, which returns an object with informationon all installed packages and packages available at multiplerepositories (CRAN, local archive, <small class="dots">...</small>). The <code>print</code> and<code>summary</code> methods give an overview of installed and availablepackages, the <code>upgrade</code> method offers to fetch and install outdatedpackages. This allows R to fetch packages from several repositories andkeep in sync with all of them, instead of only one CRAN mirror, and isintended to become the default package manager for future versions of R.<a name="Removing%20packages"></a><h3 class="section">5.3 Removing packages</h3><p>Packages can be removed in a number of ways. From a command prompt theycan be removed by<pre class="smallexample"> 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="smallexample"> > remove.packages(c("pkg1", "pkg2"),lib = file.path("path", "to", "library"))</pre><p>Finally, in most installations one can just remove the package directoryfrom the library.<p><strong>Note:</strong> whereas it is currently possible to install package<em>bundles</em>, one cannot remove these as such--the packages containedin the bundle have to removed individually.<a name="Essential%20and%20useful%20other%20programs"></a><h2 class="appendix">Appendix A Essential and useful other programs</h2><p>This appendix gives details of programs you will need to build R onUnix-like platforms, or which will be used by R if found by<code>configure</code>.<p>Remember that some package management systems (such as <small>RPM</small> anddeb) make a distinction between the user version of a package and thedevelopment version. The latter usually has the same name but with theextension <code>-devel</code> or <code>-dev</code>: you need both versionsinstalled.<a name="Essential%20programs"></a><h3 class="section">A.1 Essential programs</h3><p>You need a means of compiling C and FORTRAN 77 (see <a href="#Using%20FORTRAN">Using FORTRAN</a>). Some add-on packages also need a C++ compiler.<p>Unless you do not want to view graphs on-screen you need <code>X11</code>installed, including its headers and client libraries. (On RedHat Linuxthis means the <code>XFree86-devel</code> and <code>XFree86-libs</code> RPMs, forexample.)<p>You will need Perl version 5.004 or later, available via<a href="http://www.perl.com/CPAN/">http://www.perl.com/CPAN/</a>, to build any of the on-linedocumentation.<p>You will not be able to build the info files unless you have<code>makeinfo</code> version 4 or later installed.<p>The typeset documentation needs <code>tex</code> and <code>latex</code>, or<code>pdftex</code> and <code>pdflatex</code>.<a name="Useful%20libraries%20and%20programs"></a><h3 class="section">A.2 Useful libraries and programs</h3><p>The command-line editing depends on the <code>readline</code> libraryavailable from any GNU mirror: you will need a fairly recent version.<p>The bitmapped graphics devices <code>jpeg()</code> and <code>png()</code> need theappropriate headers and libraries installed: <code>jpeg</code> (version 6bor later) or <code>libpng</code> (version 1.2.3 or later) and <code>zlib</code>(version 1.1.3 or later) respectively.<p>The <code>bitmap</code> and <code>dev2bitmap</code> devices make use of ghostscript(<a href="http://www.cs.wisc.edu/~ghost">http://www.cs.wisc.edu/~ghost</a>).<p>If you have them installed (including the appropriate headers and oflate enough versions), <code>zlib</code>, <code>libbz2</code> and PCRE will be usedif specified by <code>--with-zlib</code>, <code>--with-bzlib</code> or<code>--with-pcre</code>: otherwise versions in the R sources will becompiled in. As the latter suffice and are tested with R you shouldnot need to change this.<a name="Tcl%2fTk"></a><h3 class="subsection">A.2.1 Tcl/Tk</h4><p>The <strong>tcltk</strong> package needs Tcl/Tk installed: the sources areavailable at <a href="http://www.scriptics.com/">http://www.scriptics.com/</a>. To specify the locationsof the Tcl/Tk files you may need the configuration options<dl><dt><code>--with-tcltk</code><dd>use Tcl/Tk, or specify its library directory<br><dt><code>--with-tcl-config=</code><var>TCL_CONFIG</var><code></code><dd>specify location of <code>tclConfig.sh</code><br><dt><code>--with-tk-config=</code><var>TK_CONFIG</var><code></code><dd>specify location of <code>tkConfig.sh</code></dl><p>or use the configure variables <code>TCLTK_LIBS</code> and<code>TCLTK_CPPFLAGS</code> to specify the flags needed for linking againstthe Tcl and Tk libraries and for finding the <code>tcl.h</code> and<code>tk.h</code> headers, respectively.<p>Versions of Tcl/TK from 8.3 to 8.4.4 have been used successfully: 8.0 isno longer supported.<a name="Linear%20algebra"></a><h3 class="subsection">A.2.2 Linear algebra</h4><p>The linear algebra routines in R can make use of enhanced BLAS (BasicLinear Algebra Subprograms, <a href="http://www.netlib.org/blas/faq.html">http://www.netlib.org/blas/faq.html</a>)routines. Some are compiler-system-specific (<code>libsunperf</code> on SunSparc<a rel="footnote" href="#fn-1"><sup>1</sup></a>, <code>libessl</code> on IBM, <code>vecLib</code> on Mac OSX) but ATLAS (<a href="http://math-atlas.sourceforge.net/">http://math-atlas.sourceforge.net/</a>) is a "tuned"BLAS that runs on a wide range of Unix-alike platforms. If no morespecific library is found, a <code>libblas</code> library in the library pathwill be used. You can specify a particular BLAS library <em>via</em> avalue for the configuration option <code>--with-blas</code> and not to usean external BLAS library by <code>--without-blas</code>. (Alternatively,the environment variable <code>BLAS_LIBS</code> can be set, for example in<code>config.site</code>.)<p>For systems with multiple processors it is possible to use amulti-threaded version of ATLAS. (Prior to R 1.8.0 this was notsupported since <code>SIGINT</code> signals sent to the process and handled bythe wrong thread could result in segfaults.) A remaining issue is thatR profiling, which uses the <code>SIGPROF</code> signal, may causeproblems. You may want to disable profiling if you use a multi-threadedversion of ATLAS. You can use a multi-threaded ATLAS by specifying<pre class="smallexample"> --with-blas="-lptf77blas -lpthread -latlas"</pre><p>Another tuned BLAS which is available for some processors under Linux isby Kazushige Goto, currently available at<a href="http://www.cs.utexas.edu/users/flame/goto/">http://www.cs.utexas.edu/users/flame/goto/</a>. Once this is isinstalled, it can be used by one of<pre class="smallexample"> --with-blas=goto--with-blas=-lgoto</pre>Multi-threaded versions of Goto's BLAS are available, so please note the<em>caveat</em> in the previous paragraph.<p>For Intel processors under Linux, Intel's Math Kernel Library<a href="http://www.intel.com/software/products/mkl/">http://www.intel.com/software/products/mkl/</a>can be used by<pre class="smallexample"> --with-blas="-lmkl -lguide -lpthread"</pre>with the same caveat on multi-threading. (Thanks to Andy Liaw for theinformation.)<p>Note that the BLAS library will be used for several add-on packages aswell as for R itself. This means that it is better to use a sharedBLAS library, as most of a static library will be compiled into the Rexecutable and each BLAS-using package. In any case, the BLAS librarymust be usable with dynamically-loadable code: this can be a problemwith ATLAS that is not by default built with position-independent code.<p>You will need double-precision and double-complex versions of the BLAS,but not single-precision nor complex routines.<p>Provision is made for using an external LAPACK library, principally tocope with BLAS libraries which contain a copy of LAPACK (such as<code>libsunperf</code> on Solaris and <code>vecLib</code> on Mac OS X).However, the likely performance gains are thought to be small (and maybe negative), and the default is not to search for a suitable LAPACKlibrary. You can specify a specific LAPACK library or a search for ageneric library by the configuration option <code>--with-lapack</code>. Thedefault for <code>--with-lapack</code> is to check the BLAS library and thenlook for an external library <code>-llapack</code>. Sites searching for thefastest possible linear algebra may want to build a LAPACK library usingthe ATLAS-optimized subset of LAPACK. To do so specify something like<pre class="smallexample"> --with-lapack="-L/path/to/libs -llapack -lcblas"</pre><p>since the ATLAS subset of LAPACK depends on <code>libcblas</code>. A valuefor <code>--with-lapack</code> can be set <em>via</em> the environment variable<code>LAPACK_LIBS</code>, but this will only be used if <code>--with-lapack</code>is specified (as the default value is <code>no</code>) and the BLAS librarydoes not contain LAPACK.<p>If you do use <code>--with-lapack</code>, be aware of potential problemswith bugs in the LAPACK 3.0 sources (or in the posted corrections to thosesources). In particular, bugs in <code>DGEEV</code> and <code>DGESDD</code> haveresulted in error messages such as<pre class="smallexample"> DGEBRD gave error code -10</pre><p>(from the Debian <code>-llapack</code> which was current in late 2002). Otherpotential problems are incomplete versions of the libraries: for example<code>libsunperf</code> from Sun Forte 6.x was missing the entry point for<code>DLANGE</code> and <code>vecLib</code> has omitted the BLAS routine<code>LSAME</code>.<p>As with all libraries, you need to ensure that they and R werecompiled with compatible compilers and flags. For example, this meansthat on Sun Sparc using the native compilers the flag <code>-dalign</code>is needed so <code>libsunperf</code> can be used.<p>An ATLAS `tuned' BLAS can also be used on Windows: see<code>src/gnuwin32/INSTALL</code> for how to enable this when building fromsource, and <a href="http://cran.r-project.org/bin/windows/rw-FAQ.html">R Windows <small>FAQ</small></a> for adding pre-compiled support to binary versions.Goto's BLAS can also be used when building from source.<p>Note that under Unix (but not under Windows) if R is compiledagainst a non-default BLAS, then all BLAS-using packages must also be.So if R is re-built after ATLAS is installed, then packages such as<strong>quantreg</strong> will need to be re-installed.<a name="Configuration%20on%20Unix"></a><h2 class="appendix">Appendix B Configuration on Unix</h2><a name="Configuration%20options"></a><h3 class="section">B.1 Configuration options</h3><p><code>configure</code> has many options: running<pre class="smallexample"> ./configure --help</pre><p>will give a list. Probably the most important ones not coveredelsewhere are (defaults in brackets)<dl><dt><code>--with-x</code><dd>use the X Window System<br><dt><code>--x-includes=</code><var>DIR</var><code></code><dd>X include files are in <var>DIR</var><br><dt><code>--x-libraries=</code><var>DIR</var><code></code><dd>X library files are in <var>DIR</var><br><dt><code>--with-readline</code><dd>use readline library (if available) [yes]<br><dt><code>--enable-R-profiling</code><dd>attempt to compile support for <code>Rprof()</code> [yes]<br><dt><code>--enable-R-shlib</code><dd>build R as a shared library [no]</dl><p>You can use <code>--without-foo</code> or <code>--disable-foo</code> for thenegatives.<p>You will want to use <code>--disable-R-profiling</code> if you are buildinga profiled executable of R (e.g. with <code>-pg)</code>.<p>Flag <code>--enable-R-shlib</code> causes the make process to build R asa dynamic (shared) library, typically called <code>libR.so</code>, and linkthe main R executable <code>R.bin</code> against that library. This canonly be done if all the code (including system libraries) can becompiled into a dynamic library, and there may be a small performancepenalty. So you probably only want this if you will be using anapplication which embeds R. Note that C code in packages installedon a R system linked with <code>--enable-R-shlib</code> are linkedagainst the dynamic library and so such packages cannot be used from aR system built in the default way.<a name="Configuration%20variables"></a><h3 class="section">B.2 Configuration variables</h3><p>If you need or want to set certain configure variables to somethingother than their default, you can do that by either editing the file<code>config.site</code> (which documents all the variables you might want toset) or on the command line as<pre class="smallexample"> ./configure VAR=<var>value</var></pre><p>If you are building in a directory different from the sources, there canbe copies of <code>config.site</code> in the source and the build directories,and both will be read (in that order). To force a single file to beread, set the environment variable <code>CONFIG_SITE</code> to the location ofthe file.<p>These variables are <em>precious</em>, implying that they do not have tobe exported to the environment, are kept in the cache even if notspecified on the command line and checked for consistency between twoconfigure runs (provided that caching is used), and are kept duringautomatic reconfiguration as if having been passed as command linearguments, even if no cache is used.<p>See the variable output section of <code>configure --help</code> for a list ofall these variables.<p>One common variable to change is <code>R_PAPERSIZE</code>, which defaults to<code>a4</code>, not <code>letter</code>. (Valid values are <code>a4</code>,<code>letter</code>, <code>legal</code> and <code>executive</code>.)<p>If you have libraries and header files, e.g., for GNU readline, innon-system directories, use the variables <code>LDFLAGS</code> (for libraries,using <code>-L</code> flags to be passed to the linker) and <code>CPPFLAGS</code>(for header files, using <code>-I</code> flags to be passed to the C/C++preprocessors), respectively, to specify these locations. These defaultto <code>/usr/local/lib</code> and <code>/usr/local/include</code> to catch the mostcommon cases. If libraries are still not found, then maybe yourcompiler/linker does not support re-ordering of <code>-L</code> and<code>-l</code> flags (this has been reported to be a problem on HP-UX withthe native <code>cc</code>). In this case, use a different compiler (or afront end shell script which does the re-ordering).<p>Another precious variable is <code>R_BROWSER</code>, the default browser, whichshould take a value of an executable in the user's path or specifya full path.<p>If you find you need to alter configure variables, it is worth notingthat some settings may be cached in the file <code>config.cache</code>, and itis 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 lineoption <code>--config-cache</code> (or <code>-C</code>) to enable caching.<a name="Using%20make"></a><h3 class="section">B.3 Using make</h3><p>To compile R, you will most likely find it easiest to use GNU<code>make</code>. On Solaris 2.6/7/8 in particular, you need a version ofGNU <code>make</code> different from 3.77; 3.79.1 works fine, as does the Sun<code>make</code>. The native <code>make</code> is reported to fail on SGIIrix 6.5 and Alpha/OSF1 (aka Tru64).<p>To build in a separate directory you need a <code>make</code> that uses the<code>VPATH</code> variable, for example GNU <code>make</code>, or Sun<code>make</code> on Solaris 2.7/8/9 (but not earlier).<p>If you want to use a <code>make</code> by another name, for example if yourGNU <code>make</code> is called <code>gmake</code>, you need to set the variable<code>MAKE</code> at configure time, for example<pre class="smallexample"> ./configure MAKE=gmake</pre><a name="Using%20FORTRAN"></a><h3 class="section">B.4 Using FORTRAN</h3><p>To compile R, you need a FORTRAN compiler or <code>f2c</code>, theFORTRAN-to-C converter (<a href="http://www.netlib.org/f2c">http://www.netlib.org/f2c</a>). The defaultis to search for <code>g77</code>, <code>f77</code>, <code>xlf</code>,<code>frt</code>, <code>pgf77</code>, <code>fl32</code>, <code>af77</code>,<code>fort77</code>, <code>f90</code>, <code>xlf90</code>, <code>pgf90</code>,<code>epcf90</code>, <code>f95</code>, <code>fort</code>, <code>xlf95</code>,<code>lf95</code>, <code>g95</code>, and <code>fc</code> (in thatorder)<a rel="footnote" href="#fn-2"><sup>2</sup></a>, andthen for <code>f2c</code>, and use whichever is found first; if none isfound, R cannot be compiled. The search mechanism can be changedusing the configure variables <code>F77</code> and <code>F2C</code> which specifythe commands that run the FORTRAN 77 compiler and FORTRAN-to-Cconverter, respectively. If <code>F77</code> is given, it is used to compileFORTRAN; otherwise, if <code>F2C</code> is given, f2c is used even if aFORTRAN compiler would be be available. If your FORTRAN compiler is ina non-standard location, you should set the environment variable<code>PATH</code> accordingly before running <code>configure</code>, or use theconfigure variable <code>F77</code> to specify its full path.<p>If your FORTRAN libraries are in slightly peculiar places, you shouldalso look at <code>LD_LIBRARY_PATH</code> or your system's equivalent to makesure that all libraries are on this path.<p>You must set whatever compilation flags (if any) are needed to ensurethat FORTRAN <code>integer</code> is equivalent to a C <code>int</code> pointer andFORTRAN <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, whichis a FORTRAN 90 extension. This is checked for at configuretime<a rel="footnote" href="#fn-3"><sup>3</sup></a>, but you may need to avoidcompiler flags<a rel="footnote" href="#fn-4"><sup>4</sup></a> assertingFORTRAN 77 compliance.<p>For performance reasons<a rel="footnote" href="#fn-5"><sup>5</sup></a> you may want to choose a FORTRAN 90/95 compiler.<p>If you use <code>f2c</code> you may need to ensure that the FORTRAN type<code>integer</code> is translated to the C type <code>int</code>. Normally<code>f2c.h</code> contains <code>typedef long int integer;</code>, which will workon a 32-bit platform but not on a 64-bit platform.<a name="Compile%20and%20load%20flags"></a><h3 class="section">B.5 Compile and load flags</h3><p>A wide range of flags can be set in the file <code>config.site</code> or asconfigure variables on the command line. We have already mentioned<dl><dt><code>CPPFLAGS</code><dd>header file search directory (<code>-I</code>) and any other miscellaneousoptions for the C and C++ preprocessors and compilers<br><dt><code>LDFLAGS</code><dd>path (<code>-L</code>), stripping (<code>-s</code>) and any other miscellaneousoptions for the linker</dl><p>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 libraries<br><dt><code>FFLAGS</code><dd>debugging and optimization flags, FORTRAN<br><dt><code>MAIN_FFLAGS</code><dd>ditto, for compiling the main program<br><dt><code>SHLIB_FFLAGS</code><dd>for shared libraries<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 libraries</dl><p>Library paths specified as <code>-L/lib/path</code> in <code>LDFLAGS</code> arecollected together and prepended to <code>LD_LIBRARY_PATH</code> (or yoursystem's equivalent), so there should be no need for <code>-R</code> or<code>-rpath</code> flags.<p>To compile a profiling version of R, one might for example want touse <code>MAIN_CFLAGS=-pg</code>, <code>MAIN_FFLAGS=-pg</code>,<code>MAIN_LDFLAGS=-pg</code> on platforms where <code>-pg</code> cannot be usedwith 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: onepossible issue is the alignment of doubles, another is the waystructures are passed.<a name="Building%20the%20GNOME%20interface"></a><h3 class="section">B.6 Building the <small>GNOME</small> interface</h3><p>This interface is experimental and incomplete. It provides a consoleand two graphics devices named <code>gtk()</code> and <code>gnome()</code>. Theconsole offers a basic command line editing and history mechanism, alongwith tool and button bars that give a point-and-click interface to someR commands. Many of the features of the console are currentlystubs. The <code>gtk()</code> graphics device is a port of the <code>x11()</code>device to <small>GDK</small> (the GIMP Drawing Kit). The <code>gnome()</code>device uses the <small>GNOME</small> canvas.<p>Due to its experimental nature, the <small>GNOME</small> interface for Rwill not be built automatically. You must specify it by runningconfigure with the <code>--with-gnome</code> option. For example, you mightrun<pre class="smallexample"> ./configure --with-gnome</pre><p>but please check you have all the requirements first. You need at leastthe following libraries (or later) installed<pre class="smallexample"> audiofile-0.2.1esound-0.2.23glib-1.2.10gtk+-1.2.10imlib-1.9.10ORBit-0.5.12gnome-libs-1.4.1.2libxml-1.8.16libglade-0.17</pre><p>It is preferable to have a complete installation of the <small>GNOME</small>desktop environment. If you use Linux, then this should be providedwith your distribution. In addition, packaged binary distributions ofGNOME are available from <a href="http://www.ximian.com">http://www.ximian.com</a> for the mostpopular Linux distributions and for Solaris.<p>Remember that some package management systems (such as <small>RPM</small> anddeb) make a distinction between the user version of a package and thedeveloper version. The latter usually has the same name but with theextension <code>-devel</code>. If you use a pre-packaged version of<small>GNOME</small> then you must have the developer versions of the abovepackages in order to compile the R-GNOME interface.<p>The full list of <small>GNOME</small> options to configure is<dl><dt><code>--with-gnome</code><dd>use <small>GNOME</small>, or specify its prefix [no]<br><dt><code>--with-gnome-includes=</code><var>DIR</var><code></code><dd>specify location of <small>GNOME</small> headers<br><dt><code>--with-gnome-libs=</code><var>DIR</var><code></code><dd>specify location of <small>GNOME</small> libs<br><dt><code>--with-libglade-config=</code><var>LIBGLADE_CONFIG</var><code></code><dd>specify location of <code>libglade-config</code></dl><a name="Platform%20notes"></a><h3 class="section">B.7 Platform notes</h3><p>This section provides some notes on building R on different Unix-likeplatforms. These notes are based on tests run on one or two systems ineach case with particular sets of compilers and support libraries.Success in building R depends on the proper installation and functioningof support software; your results may differ if you have other versionsof compilers and support libraries.<a name="Linux"></a><h3 class="subsection">B.7.1 Linux</h4><p>Linux is the main development platform for R, so compilation from thesources is normally straightforward.<p>Remember that some package management systems (such as <small>RPM</small> anddeb) make a distinction between the user version of a package and thedeveloper version. The latter usually has the same name but with theextension <code>-devel</code> or <code>-dev</code>: you need both versionsinstalled. So please check the <code>configure</code> output to see if theexpected features are detected: if for example <code>readline</code> ismissing add the package containing its headers.<p>When R has been installed from a binary distribution there aresometimes problems with missing components such as the Fortrancompiler. Searching the <code>R-help</code> archives will normally revealwhat is needed.<p>It seems that the <code>gcc</code> compilers normally produce PIC code on<code>ix86</code> Linux but do not necessarily do so on 64-bit versions suchas that for AMD Opteron. So care can be needed with BLAS libraries andwhen building R as a shared library to ensure thatposition-independent code is used in any static libraries (such as theTcl/Tk libraries, <code>libpng</code>, <code>libjpeg</code> and <code>zlib</code>) whichmight be linked against. Fortunately these are normally built as sharedlibraries with the exception of the ATLAS BLAS libraries.<a name="Mac%20OS%20X"></a><h3 class="subsection">B.7.2 Mac OS X</h4><p>You can build R as a Unix application on Mac OS X using the AppleDeveloper Tools and <code>f2c</code> or <code>g77</code>. You will alsoneed to install an X sub-system or configure with<code>--without-x</code>. The X window manager is part of the standard MacOS X distribution since Mac OS X version 10.3 (Panther).<p>For more information on how to find these tools please read the<a href="http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html">R for Mac OS X <small>FAQ</small></a>.<p>If you use the X window manager and prefer <code>Terminal.app</code> to<code>xterm</code>, you should be aware that R, like many Unix tools,uses the existence of a <code>DISPLAY</code> environment variable todetermine whether an X system is running. This affects the defaultgraphics device for the commmand line version of R and the behaviourof the <code>png()</code> and <code>jpeg</code> devices.<p>The <code>vecLib</code> library of Mac OS X >= 10.2.2 can be used <em>via</em> theconfiguration options<pre class="smallexample"> --with-blas="-framework vecLib" --with-lapack</pre><p>to provide higher-performance versions of the BLAS and LAPACKroutines. With <code>gcc 3.1</code> that appears to be the only way tobuild R, as the Fortran support routines in <code>libg2c</code> cannot belinked into a dynamic library. (We have had reports of success and offailure with <code>gcc 3.3</code>.)<a name="Solaris"></a><h3 class="subsection">B.7.3 Solaris on Sparc</h4><p>R has been built successfully on Solaris 8 aka Solaris 2.8 aka SunOS5.8 using <code>gcc</code>/<code>g77</code> and the SunPro WorkShop 6 (akaForte 6) compilers and the `Sun ONE Studio 7 Compiler Suite' (aka Forte7), and less regularly on Solaris 2.5.1, 2.6, 2.7 and 9. GNU<code>make</code> is needed prior to Solaris 2.7 for building other than inthe source tree, and perhaps even then.<p>The Solaris versions of several of the tools needed to build R(e.g. <code>make</code>, <code>ar</code> and <code>ld</code>) are in<code>/usr/ccs/bin</code>, so if using those tools ensure this is in yourpath.<p><code>gcc</code> 3.2.1 and 3.2.2 generate incorrect code on 32-bit Solarisbuilds with optimization, but versions 3.1, 3.2, 3.2.3 and later workcorrectly. At least files <code>src/main/engine.c</code>,<code>src/main/graphics.c</code> and <code>src/modules/devX11.c</code> are affected.<p>If using <code>gcc</code>, do ensure that the compiler was compiled for theversion of Solaris in use. (This can be ascertained from <code>gcc-v</code>.) <code>gcc</code> makes modified versions of some header files, andso (for example) <code>gcc</code> compiled under Solaris 2.6 will notcompile R under Solaris 2.7. Also, do ensure that it was compiledfor the assembler/loader in use. If you download <code>gcc</code> from<a href="http://www.sunfreeware.com">http://www.sunfreeware.com</a> then you need to download<code>binutils</code> too. To avoid all these pitfalls we stronglyrecommended you compile <code>gcc</code> from the sources yourself.<p>When using the SunPro compilers do <em>not</em> specify <code>-fast</code>, asthis disables <small>IEEE</small> arithmetic and <code>make check</code> willfail. The maximal set of optimization options known to work is<pre class="smallexample"> -xlibmil -xO5 -dalign</pre><p>We have found little performance difference between <code>gcc</code> and<code>cc</code> but considerable benefit from using a SunPro Fortrancompiler: the <code>gcc</code>/<code>f77</code> combination works well. Formany C++ applications (e.g. package <strong>Matrix</strong>) Forte 7 requires<code>-lCstd</code>, which the configure script will add to<code>SHLIB_CXXLDFLAGS</code> if it identifies the compiler correctly.<p>To compile for a 64-bit target on Solaris (which needs an UltraSparcchip and for support to be enabled in the OS) with the Forte 6 and 7compilers we used<pre class="smallexample"> CC="cc -xarch=v9"CFLAGS="-xO5 -xlibmil -dalign"F77="f95 -xarch=v9"FFLAGS="-xO5 -xlibmil -dalign"CXX="CC -xarch=v9"CXXFLAGS="-xO5 -xlibmil -dalign"</pre><p>in <code>config.site</code>.<p>For 64-bit compilation with <code>gcc</code> 3.2.x and later we used<pre class="smallexample"> CC="gcc -m64"FFLAGS="-m64 -g -O2"CXXFLAGS="-m64 -g -O2"LDFLAGS="-L/usr/local/lib/sparcv9 -L/usr/local/lib"</pre><p>Note that <code>/usr/local/lib/sparcv9</code> will need to be in the<code>LD_LIBRARY_PATH</code> during configuration.<p>Note that using <code>f95</code> allows the Sun performance library<code>libsunperf</code> to be selected: it will not work with <code>f77</code>,nor with <code>g77</code>. <code>libsunperf</code> contains both BLAS and LAPACKcode, and <code>--with-lapack</code> is recommended for 32-bit builds using<code>f95</code>, but not for 64-bit builds where on our test system itfailed in both Forte 6U1 and 7, albeit in different ways. Ourexperience has been that ATLAS's BLAS is faster than <code>libsunperf</code>,especially for complex numbers.<p>Some care is needed to ensure that libraries found by<code>configure</code> are compatible with the R executable and modules, asthe testing process will not detect many of the possible problems. For32-bit builds under <code>cc</code> the flag <code>-dalign</code> is needed forsome of the Sun libraries: fortunately the equivalent flag for<code>gcc</code>, <code>-mno-unaligned-doubles</code>, is the default. Intheory, libraries such as <code>libpng</code>, <code>libjpeg</code>, <code>zlib</code> andthe ATLAS libraries need to be built with a <code>pic</code> or <code>PIC</code>flag, which could be a problem if static libraries are used. Inpractice this seems to give little problem for 32-bit builds.<p>For a 64-bit build, 64-bit libraries must be used. As the configurationprocess by default sets <code>LDFLAGS</code> to <code>-L/usr/local/lib</code>,you may need to set it to avoid finding 32-bit addons (as in the<code>gcc -m64</code> example above). It is possible to build Tcl/Tk as64-bit libraries with the configure option <code>--enable-64bit</code>, butonly with the Forte compiler (and not with <code>gcc</code>) as of Tcl/Tk 8.4.5.<a name="HP-UX"></a><h3 class="subsection">B.7.4 HP-UX</h4><p>R has been built successfully on HP-UX 10.2 and HP-UX 11.0 using bothnative compilers and <code>gcc</code>. However, 10.2 has not been testedsince R 1.4.0. By default, R is configured to use <code>gcc</code> and<code>g77</code> on HP-UX (if available). Some installations of<code>g77</code> only install a static version of the <code>g2c</code> librarythat cannot be linked into a shared library since its files have notbeen compiled with the appropriate flag for producing positionindependent code (<small>PIC</small>). This will result in <code>make</code>failing with a linker error similar to<pre class="smallexample"> ld: CODE_ONE_SYM fixup to non-code subspace in file foo.o -shared library must be position independent. Use +z or +Z to recompile.</pre><p>(<code>+z</code> and <code>+Z</code> are the <small>PIC</small> flags for the nativecompiler <code>cc</code>.) If this is the case you either need to modifyyour <code>g77</code> installation or configure with<pre class="smallexample"> F77=fort77</pre><p>to specify use of the native <small>POSIX</small>-compliant FORTRAN 77compiler.<p>You may find that <code>configure</code> detects other libraries that Rneeds to use as shared libraries but are only available as staticlibraries. If you cannot install shared versions you will need to tell<code>configure</code> not to use these libraries, or make sure they arenot in the library path. The symptom will the linker error shown in thelast paragraph. Static libraries that might be found and would causeproblems are<pre class="smallexample"> BLAS use --without-blasTcl/Tk use --without-tcltkGNOME not built by defaultlibpng use --without-libpngjpeg use --without-jpeglibzlib use --without-zlib</pre><p>and <code>bzip2</code> and <code>pcre</code> are problematic when building<code>libR.so</code>, only. These can be avoided by <code>--without-bzlib</code>and <code>--without-pcre</code> respectively, but these are the defaults.<p>Some versions of <code>gcc</code> may contain what appears to be a bug atthe <code>-O2</code> optimization level that causes<pre class="smallexample"> > 2 %/% 2[1] 1> 1:2 %/% 2[1] 0 0 # wrong!!</pre><p>which will cause <code>make check</code> to fail. If this is the case, youshould use <code>CFLAGS</code> to specify <code>-O</code> as the optimizationlevel to use.<p>Some systems running HP-UX 11.0 may have a <code>gcc</code> that wasinstalled under HP-UX 10.2. Between versions 10.2 and 11.0 HP-UXchanged its support functions for <small>IEEE</small> arithmetic from therecommended functions of the <small>IEEE</small> standard to the onesspecified in the C9x draft standard. In particular, this means that<code>finite</code> has been replaced by <code>isfinite</code>. A <code>gcc</code>configured for HP-UX 10.2 run on 11.0 will not find <code>isfinite</code>, andas a result <code>configure</code> does not recognize the machine as fullysupporting <small>IEEE</small> arithmetic and so will not complete. The bestsolution is to install a properly configured <code>gcc</code>. Analternative work-around is to add <code>-DIEEE_754</code> to the<code>CFLAGS</code> variable.<p>You can configure R to use both the native <code>cc</code> and<code>fort77</code> with<pre class="smallexample"> ./configure CC=cc F77=fort77</pre><p><code>f90</code> insists on linking against a static <code>libF90.a</code> whichtypically resides in a non-standard directory (e.g.,<code>/opt/fortran90/lib</code>). Hence, to use <code>f90</code> one needs toadd this directory to the linker path via the configure variable<code>LDFLAGS</code> (e.g., <code>./configure F77=f90LDFLAGS=/opt/fortran90/lib</code>).<a name="IRIX"></a><h3 class="subsection">B.7.5 IRIX</h4><p>R has been built successfully on IRIX64 6.5 using<code>gcc</code>/<code>f77</code> or <code>cc</code>/<code>f77</code> for 32-bitexecutables and the native compilers for a 64-bit executable. Thecommand<pre class="smallexample"> ./configure CC="cc -64" F77="f77 -64" --with-tcltk=no</pre><p>was used to create the 64-bit executable. It was necessary toexplicitly omit Tcl/Tk because <code>configure</code> would find the 32-bitversion but not detect that is was incompatible with a 64-bit build.<p>A 32-bit build using <code>gcc</code>/<code>g77</code> passed <code>makecheck</code> but failed <code>make test-all-extras</code> in the complex LAPACKtests.<p>George N. White III reports that the <code>strptime</code> tests in 1.9.0 failon IRIX 6.5 systems prior to 6.5.22m (e.g. 6.5.19m and 6.5.21m) unlessArthur Olson's timezone data <a href="ftp://elsie.nci.nih.gov/pub/">ftp://elsie.nci.nih.gov/pub/</a> (seealso <a href="http://cspry.co.uk/computing/Indy_admin/TIMEZONE.html">http://cspry.co.uk/computing/Indy_admin/TIMEZONE.html</a>) areinstalled and <code>-ltz</code> is added to the list of libraries (forexample, in environment variable <code>LIBS</code>).<a name="Alpha%2fOSF1"></a><h3 class="subsection">B.7.6 Alpha/OSF1</h4><p>R has been built successfully on an Alpha running OSF1 V4.0 using<code>gcc</code>/<code>g77</code> and <code>cc</code>/<code>f77</code>. Mixing<code>cc</code> and <code>g77</code> fails to configure. The<code>configure</code> option <code>--without-blas</code> was used since thenative blas seems not to have been built with the flags needed tosuppress <code>SIGFPE</code>'s. Currently R does not set a signal handler for<code>SIGFPE</code> on platforms that support <small>IEEE</small> arithmetic, sothese are fatal.<a name="Alpha%2fFreeBSD"></a><h3 class="subsection">B.7.7 Alpha/FreeBSD</h4><p>Attempts to build R on an Alpha with FreeBSD 4.3 have been onlypartly successful. Configuring with <code>-mieee</code> added to both<code>CFLAGS</code> and <code>FFLAGS</code> builds successfully, but tests fail with<code>SIGFPE</code>'s. It would appear that <code>-mieee</code> only defers theserather than suppressing them entirely. Advice on how to complete thisport would be greatly appreciated.<a name="AIX"></a><h3 class="subsection">B.7.8 AIX</h4><p>On AIX 4.3.3 and AIX 5.1, it was found that the use of "run timelinking" (as opposed to normal AIX style linking) was required. Forthis, the R main program must be linked to the runtime linker withthe <code>-brtl</code> linker option, and shareable objects must be enabledfor runtime linking with the <code>-G</code> linker option. Without theseoptions, the AIX linker would not automatically link to any sharedobject with a <code>.so</code> extension. Also, the R main program wouldbe unable to dynamically load modules (such as X11) with the<code>dlopen</code> call.<p>When setting <code>MAIN_LDFLAGS</code> and <code>SHLIB_LDFLAGS</code> accordingly,note that linker flags must be escaped using <code>-Wl,</code> if<code>gcc</code> is used for linking: use <code>MAIN_LDFLAGS="-Wl,brtl"</code>and <code>SHLIB_LDFLAGS="-Wl,-G"</code> in this case.<p>Harald Servat Gelabert <harald at cepba dot upc dot es> reportedsuccess building R 1.7.0 under AIX 5.1 with<pre class="smallexample"> CC=xlcF77=xlfCXX=xlCCFLAGS=-O3 -qstrict -qmaxmem=8192FFLAGS=-O3 -qstrict -qmaxmem=8192CXXFLAGS=-O2 -qmaxmem=8192MAIN_LDFLAGS=-Wl,-brtlSHLIB_LDFLAGS=-Wl,-G</pre><p>but was unable to use the X libraries or the native BLAS (ESSL) and soused <code>--without-x --without-blas</code>.<p>Tim Hoar <thoar at cgd dot ucar dot edu> reported success buildingR 1.9.0 under AIX 5.1 in 64-bit mode with<pre class="smallexample"> OBJECT_MODE=64CC=/usr/bin/xlc_rF77=/usr/bin/xlf_rCXX=/usr/bin/xlC_rLDFLAGS='-brtl'CFLAGS='-O -qstrict'FFLAGS='-O -qstrict'CXXFLAGS='-O -qstrict'</pre><p>and the <code>X11()</code> device worked. His system required the<code>Makeconf</code> file to be edited to replace <code>/lib/crt0.o</code> by<code>/lib/crt0_64.o</code> in <code>R_XTRA_LIBS</code>, and <code>configure</code> nowtries to detect this.<p>We understand that <code>--enable-R-shlib</code> does not work under AIX.<a name="Enabling%20search%20in%20HTML%20help"></a><h2 class="chapter">3 Enabling search in HTML help</h2><p>There is a search engine available from the front page of the<small>HTML</small> help system, the page that is displayed by<code>help.start()</code>. The search engine is written in Java and invokedby Javascript code, so the first thing to do is to ensure that both areenabled in your favourite browser. Then try it and see: with mostbrowsers you should see<pre class="smallexample"> Applet SearchEngine started</pre><p>displayed in the status bar. (Internet Explorer shows <code>Appletstarted</code>.) Then click on one of the keywords and after a short delay(several seconds) you should see a page of search results.<p>If this fails you should double-check that Java is enabled in yourbrowser by visiting a page such as<a href="http://www.java.com/en/download/help/testvm.jsp">http://www.java.com/en/download/help/testvm.jsp</a> (although thatwill fail for earlier versions of Java such as the Microsoft JVM whichdo work with R). You can check which version of Java is in use at<a href="http://java.sun.com/docs/books/tutorial/applet/practical/properties.html">http://java.sun.com/docs/books/tutorial/applet/practical/properties.html</a>.Java 1.1 is sufficent.<p>Many thanks to Marc Schwartz in tracking down many of these issues withenabling the Java search engine.<a name="Java%20Virtual%20Machines%20on%20Linux"></a><h3 class="section">C.1 Java Virtual Machines on Linux</h3><p>We are aware of problems with certain Java installations. Inparticular, Sun's Java Run-time Environment <code>j2re 1.4.2_02</code> doesnot work under Linux. Current browsers of the Mozilla family (includingMozilla >= 1.4, Netscape 7.1 and FireFox) are compiled under <code>gcc3.x</code> and <em>require</em> the <code>ns610-gcc32</code> version of the Javaplugin that was introduced with <code>j2re 1.4.2</code>, so the only Javaversion that we know to work is <code>j2re 1.4.2_01</code>. Marc Schwartz haskindly made Linux <code>i586</code> distributions available: see<pre class="smallexample"> http://www.MedAnalytics.com/INSTALL</pre><p>Other Java installations, for example those from Blackdown and IBM, havebeen used.<p>Other useful links are for Mozilla,<a href="http://plugindoc.mozdev.org/faqs/java.html">http://plugindoc.mozdev.org/faqs/java.html</a> and<a href="http://www.mozilla.org/releases/mozilla1.6/installation-extras.html">http://www.mozilla.org/releases/mozilla1.6/installation-extras.html</a>,for Konqueror <a href="http://www.konqueror.org/javahowto/">http://www.konqueror.org/javahowto/</a>, for Opera<a href="http://www.opera.com/support/search/supsearch.dml?index=459">http://www.opera.com/support/search/supsearch.dml?index=459</a> andfor Debian GNU/Linux<a href="http://www.debian.org/doc/manuals/debian-java-faq/">http://www.debian.org/doc/manuals/debian-java-faq/</a>.<a name="Java%20Virtual%20Machines%20on%20Unix"></a><h3 class="section">C.2 Java Virtual Machines on Unix</h3><p>We have much less experience, but we do know that Sun's Run-timeEnvironment <code>j2re 1.4.2_03</code> does not work under Solaris, whereas<code>j2re 1.4.2_01</code> and earlier do. Marc Schwartz kindly made Solarisdistributions of <code>j2re 1.4.2_01</code> available: see<pre class="smallexample"> http://www.MedAnalytics.com/INSTALL</pre><a name="Java%20Virtual%20Machines%20on%20Windows"></a><h3 class="section">C.3 Java Virtual Machines on Windows</h3><p>We have not seen any problems on Windows provided a Java Virtual Machinehas been installed and is operational: Sun's current <code>j2re1.4.2_04</code> works in Internet Explorer, Netscape 7.1, Mozilla 1.6 andMozilla FireFox 0.8 on Windows XP. Note that a recent Windows systemmay not have Java installed at all. For Netscape/Mozilla/FireFox visit<a href="http://java.sun.com/getjava/manual.html">http://java.sun.com/getjava/manual.html</a> to install a Sun JVM.Which (if any) JVM is enabled can be set in `Set Program Access andDefaults' in Windows XP (SP1 or later), and which JVM is used by browserplugins may also be controlled by the Sun Java applet in the ControlPanel.<a name="Java%20Virtual%20Machines%20on%20Mac%20OS%20X"></a><h3 class="section">C.4 Java Virtual Machines on Windows</h3><p>The HTML search engine does not work with Safari under Mac OS X, andSun's <code>j2re 1.4.x</code> is said not to work with Mozilla 1.6.<p>The Aqua GUI provides an interface to <code>help.search</code> that maysubstitute for the Java search.<a name="New%20platforms"></a><h2 class="appendix">Appendix D New platforms</h2><p>There are a number of sources of problems when installing R on a newhardware/OS platform. These include<p><strong>Floating Point Arithmetic</strong>: R supports the <small>POSIX</small>,SVID and <small>IEEE</small> models for floating point arithmetic. The<small>POSIX</small> and SVID models provide no problems. The <small>IEEE</small>model however can be a pain. The problem is that there is no agreementon how to set the signalling behaviour; Sun/Sparc, SGI/IRIX and ix86Linux require no special action, FreeBSD requires a call to (the macro)<code>fpsetmask(0)</code> and OSF1 requires that computation be done with a<code>-ieee_with_inexact</code> flag etc. On a new platform you must findout the magic recipe and add some code to make it work. This can oftenbe done via the file <code>config.site</code> which resides in the top leveldirectory.<p>Beware of using high levels of optimization, at least initially. Onmany compilers these reduce the degree of compliance to the<small>IEEE</small> model. For example, using <code>-fast</code> on the SolarisSunPro compilers causes R's <code>NaN</code> to be set incorrectly.<p><strong>Shared Libraries</strong>: There seems to be very little agreementacross platforms on what needs to be done to build shared libraries.there are many different combinations of flags for the compilers andloaders. GNU libtool cannot be used (yet), as it currently does notfully support FORTRAN (and will most likely never support <code>f2c</code>:one would need a shell wrapper for this). The technique we use is tofirst interrogate the X window system about what it does (using<code>xmkmf</code>), and then override this in situations where we knowbetter (for tools from the GNU Compiler Collection and/or platforms weknow about). This typically works, but you may have to manuallyoverride the results. Scanning the manual entries for <code>cc</code> and<code>ld</code> usually reveals the correct incantation. Once you know therecipe you can modify the file <code>config.site</code> (following theinstructions therein) so that the build will use these options.<p>It seems that <code>gcc 3.4.0</code> on <code>ix86</code> Linux defeats attempts bythe LAPACK code to avoid computations entirely in extended-precisionregisters, so file <code>src/modules/lapack/dlamc.f</code> may need tocompiled without optimization. If configure detects GNU Fortran it addsflag <code>-ffloat-store</code> which suffices, but it is possible that<code>src/modules/lapack/Makefile</code> will need to be edited to removeoptimization on other platforms.<p>If you do manage to get R running on a new platform please let usknow about it so we can modify the configuration procedures to includethat platform.<p>If you are having trouble getting R to work on your platform pleasefeel free to get in touch to ask questions. We have had a fair amountof practice at porting R to new platforms <small class="enddots">....</small><a name="Function%20and%20variable%20index"></a><h2 class="unnumbered">Function and variable index</h2><ul class="index-vr" compact><li><code>configure</code>: <a href="#Using%20make">Using make</a>, <a href="#Configuration%20variables">Configuration variables</a>, <a href="#Installation">Installation</a>, <a href="#Simple%20compilation">Simple compilation</a><li><code>install.packages</code>: <a href="#Installing%20packages">Installing packages</a><li><code>make</code>: <a href="#Using%20make">Using make</a><li><code>R_HOME</code>: <a href="#Simple%20compilation">Simple compilation</a><li><code>remove.packages</code>: <a href="#Removing%20packages">Removing packages</a><li><code>rsync</code>: <a href="#Using%20rsync">Using rsync</a><li><code>update.packages</code>: <a href="#Updating%20packages">Updating packages</a></ul><a name="Concept%20index"></a><h2 class="unnumbered">Concept index</h2><ul class="index-cp" compact><li>AIX: <a href="#AIX">AIX</a><li>BLAS library: <a href="#Solaris">Solaris</a>, <a href="#Mac%20OS%20X">Mac OS X</a>, <a href="#Using%20FORTRAN">Using FORTRAN</a>, <a href="#Linear%20algebra">Linear algebra</a><li>FORTRAN: <a href="#Using%20FORTRAN">Using FORTRAN</a><li>Help pages: <a href="#Simple%20compilation">Simple compilation</a><li>HP-UX: <a href="#HP-UX">HP-UX</a><li>Installation: <a href="#Installation">Installation</a><li>Installing R under Mac OS X: <a href="#Installing%20R%20under%20Mac%20OS%20X">Installing R under Mac OS X</a><li>Installing under Unix: <a href="#Installing%20R%20under%20Unix">Installing R under Unix</a><li>Installing under Windows: <a href="#Installing%20R%20under%20Windows">Installing R under Windows</a><li>IRIX: <a href="#IRIX">IRIX</a><li>LAPACK library: <a href="#Solaris">Solaris</a>, <a href="#Mac%20OS%20X">Mac OS X</a>, <a href="#Linear%20algebra">Linear algebra</a><li>Linux: <a href="#Linux">Linux</a>, <a href="#Installing%20R%20under%20Unix">Installing R under Unix</a><li>Mac OS X: <a href="#Mac%20OS%20X">Mac OS X</a>, <a href="#Installing%20R%20under%20Unix">Installing R under Unix</a><li>Manuals: <a href="#Making%20the%20manuals">Making the manuals</a><li>Manuals, installing: <a href="#Installation">Installation</a><li>Obtaining R: <a href="#Obtaining%20R">Obtaining R</a><li>Packages: <a href="#Add-on%20packages">Add-on packages</a><li>Packages, installing: <a href="#Installing%20packages">Installing packages</a><li>Packages, removing: <a href="#Removing%20packages">Removing packages</a><li>Packages, updating: <a href="#Updating%20packages">Updating packages</a><li>Solaris: <a href="#Solaris">Solaris</a><li>Sources for R: <a href="#Getting%20and%20unpacking%20the%20sources">Getting and unpacking the sources</a></ul><div class="footnote"><hr><h4>Footnotes</h4><ol type="1"><li><a name="fn-1"></a><p>Using the SunPro aka Forte aka Sun ONE <code>cc</code> and<code>f95</code> compilers</p><li><a name="fn-2"></a><p>On HP-UX <code>fort77</code> is the <small>POSIX</small>compliant FORTRAN compiler, and comes second in the search list.</p><li><a name="fn-3"></a><p>as well as its equivalence to the <code>Rcomplex</code>structure defined in <code>R_ext/Complex.h</code>.</p><li><a name="fn-4"></a><p>In particular, avoid <code>g77</code>'s<code>-pedantic</code>, which gives confusing error messages.</p><li><a name="fn-5"></a><p>e.g., to use an optimized BLAS onSun/Sparc</p></ol><hr></div></body></html>