Building R for Windows

This document is a collection of resources for building packages for R
under Microsoft Windows, or for building R itself (version 1.9.0 or later). The original
collection was put together by Prof. Brian Ripley; it is currently being maintained by
Duncan Murdoch.

The authoritative source of information for tools to work with the current release of R is the
"R Administration and Installation" manual. In particular, please read the
"Windows Toolset" appendix.

Rtools Downloads

Some of the tools are incompatible with obsolete versions of R.
We maintain one actively updated version of the tools, and other "frozen" snapshots
of them. We recommend that users use the latest release of Rtools with the latest release of R.

Tools for 64 bit Windows builds

Most of the tools used for 32 bit builds work fine as well for 64 bit builds,
but the gcc version may be different, and it has changed a number of times.

R-devel temporarily used a new toolchain based on 4.9.2 gcc, put
together by Duncan Murdoch using build scripts written by a contractor. However, there were too many
incompatibilities with existing code, and this toolchain will not be used for R 3.2.0. See notes
for details on building and testing the new toolchain.

R-patched subsequent to Jan 22, 2012, R-devel, and releases after 2.14.1 will use a new toolchain based on pre-4.6.3 gcc, put
together by Prof. Brian Ripley and available as multi.zip on his web page.
Rtools 2.15 includes this toolchain. It uses the same gcc version for both 32 and 64 bit builds. Separate versions of the gdb
debugger are also included for each archtecture.

Currrent builds of R 2.13.x and R 2.14.{0,1} use a release based on pre-4.5.2 gcc. Rtools 2.14 includes
binaries put together by Prof. Brian Ripley and available from
his web page. To install these, select the "MinGW64"
component when installing Rtools.

R 2.11.0 used
http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/mingw-w64-1.0-bin_i686-mingw_20100322.zip, but this is apparently no longer available
for download.

Special situations

Obtaining the R source code

There are two ways to obtain the R source code: from the Subversion repository, and from CRAN in a
compressed tar file.

Subversion is an open source version control system. After
obtaining and installing it, you can obtain the latest development source using

svn checkout https://svn.R-project.org/R/trunk [RDEVEL-HOME]

which will install it into the specified directory. (Normally you would use a different home directory
for this unstable development code than you would use for a released version of R.)

Alternatively, compressed tar files containing the source may be
downloaded from CRAN.
Do remember to unpack the sources by using our tar: WinZip will not
respect the symbolic links in the file. A typical tar command line would be:

tar xzvf R-2.14.1.tar.gz

Extras

Modified sources of gdbm-1.8.3 are available
for experiments with Luke Tierney's gdbm package.

Changes since R 3.1.3

The version number has been updated to 3.3.x.y.

Rtools33 has been started. Due to test failures with gcc 4.9.2, it will not be used
in R 3.2.0, and gcc 4.6.3 is included in Rtools33. We expect that gcc 4.9.2 or later
will be included in a future release.

The 32 and 64 bit builds of the gdb debugger have been copied into the Rtools/bin
directory as gdb.exe and gdb64.exe respectively. The copies in the gcc-4.6.3 remain, but
will not be included when that compiler is dropped.

The scripts and cross-compiler used to build gcc 4.9.2 are available on CRAN and its mirrors
in the bin/windows/Rtools/scripts directory, along with notes on the build.

The bitmap libraries have been removed; they are now downloaded and installed when building R by using
make rsync-extsoft.

The Cygwin "cygpath.exe" utility has been added to Rtools/bin;
this allows conversion between Cygwin-style paths
used in shell scripts and native Windows-style paths.

Changes since R 3.1.2

The version number has been updated to 3.2.x.y.

The Cygwin tools have been updated to versions current as of January 7, 2015.

R version 3.2.0 will require texinfo 5.2 to build the manuals, and it has been added to the tools.
It will also require a copy of Perl, which is NOT included
in the tools. By default the manuals will no longer be built; follow the instructions
in src/gnuwin32/MkRules.dist if you would like to build them.

Changes since R 3.0.2

The Cygwin tools have been updated to versions current as of
November 19, 2013. Cygwin now builds separate 32 bit and 64 bit
versions; we include 32 bit versions of the tools. If your system only has 64
bit Cygwin DLLs installed, you will need to add our Cygwin DLLs to your path
(or install the 32 bit Cygwin DLLs into Cygwin).

The bitmap library libpng has been updated to version 1.6.9.

Changes since R 3.0.0

The version number has been updated to 3.1.x.y.

We now record the minimum supported R version in the registry data in entry "MinRVersion"
within the Rtools/X.Y key. Earlier versions of R should use an earlier version of Rtools. This value
may be less than the minimum listed in the table above. The table is a promise to try to maintain
compatibility; this value is what we actually maintained.

We also record the full version number, e.g. 3.1.0.1935, in entry "FullVersion" in the registry.

Changes since R 2.15.2

The bitmap libraries have been updated to libpng 1.5.13, libtiff 4.0.3 and jpeg-9.
The version number has been changed from 2.16.x to 3.0.x, following the R renumbering.

Changes since R 2.15.1

The bitmap libraries have been updated to jpeg-8d, libpng 1.5.12, and libtiff 4.0.2.
The Cygwin tools have been updated to versions current as of July 13, 2012. NB: some of the
tools now require you to have a HOME environment variable, listing your home
directory. One way you can create it in a Windows command shell is by using

set HOME=%USERPROFILE%

Rtools 2.15 has been frozen.

Changes since R 2.14.1

The pre-4.6.3 toolchain has been updated to fix a bug in the sqrt() function.
R now uses pre-4.6.3 gcc for all current builds, and that is the only version included in Rtools 2.15.

Changes since R 2.14.0

The new toolchain based on gcc pre-4.5.4 has been added.

Changes since R 2.13.1

The Info-zip utilities have been updated: zip.exe is now version 3.0, unzip.exe is version 6.00.
Rtools 2.13 has been frozen.

Changes since R 2.12.2

We have updated all of the tools to current Cygwin versions as of March 25, 2011. We added
the "du" utility from Cygwin. We have dropped Vanilla Perl.
The libjpeg version has been updated to 8c, and libpng has been updated to 1.5.1.
Rtools 2.12 has been frozen.
We have added the Rtools version number to Rtools.txt and to a new file, VERSION.txt.

Changes since R 2.11.1

Prior to October 18, 2010, builds of Rtools212.exe did not correctly install the
"extras" required to build R. Version 2.12.0.1892 or later should fix this.
We have now updated all of the tools to current Cygwin versions, and have
updated the compilers, and included the 64 bit compilers into Rtools. See
Prof. Ripley's page
for the details. Perl is rarely needed in R since R 2.12.0, so it is by default
not installed.
Rtools 2.11 has been frozen.

Changes since R 2.11.0

The 32 bit version of R-devel (to become R 2.12.0 in fall, 2010) will be built with gcc 4.5.x, so Rtools212 contains a completely
new MinGW toolchain based on gcc 4.5.0. Current plans are to continue building R 2.11.x and patches to
it with Rtools211, based on gcc 4.2.1.

Changes since R 2.10.1

Rtools210 was frozen, and Rtools211 has been introduced containing the following changes:

We have updated Tcl/TK to version 8.5.8.

Versions 6b, 7 and 8 of libjpeg have been dropped, and version 8a has been added.

We have updated libpng to version 1.4.1

Changes since R 2.9.2

Rtools29 was frozen, and Rtools210 has been introduced containing the following changes.

We have updated tar to version 1.21.

We have updated the libpng library to libpng-1.2.40.

We have added version 7 of libjpeg.

We have updated to version 5.3.5 (Unicode) of Inno Setup

We have added the "file" command.

Changes since R 2.8.1

We have updated the Cygwin utilities and DLLs, the MinGW utilities, and the Tcl/Tk files
to current versions as of February 18, 2009.

Changes since R 2.8.0

We have frozen Rtools28.exe, and introduced Rtools29.exe.

Changes since R 2.7.2

We have updated the Cygwin utilities and DLLs to current versions as of September 5, 2008.

We have updated libpng (used in building R) to version 1.2.31.

Changes since R 2.7.0

We have updated the Cygwin utilities and DLLs to current versions as of May 21, 2008.

The installer no longer requires a reboot if the PATH is changed, and won't suggest
adding Rtools at the head of the PATH if it is already there.

We have started the 2.8 series of installers, dropping support for R 2.6.x and earlier.

The installer now sets registry entries like those of R, so that other tools can find it. Only fixes to
this code will affect Rtools27.exe, the contents are otherwise frozen.

Changes since R 2.6.2

The installer now includes versions 8.4.15 (for R up to 2.6.x) and 8.5.2 (for R 2.7.x or later)
of the TCL/TK bundle, and iconv.dll version 1.12.

The libtiff library 3.8.2 has been added (for TIFF support in 2.7.0), and the libpng library
has been updated to version 1.2.25.

Changes since R 2.6.1

The Win32 API files have been updated to version 3.11.

The MinGW run-time has been updated to version 3.14.

Both versions 8.4.15 (for R up to 2.6.x) and 8.5.0 (for R 2.7.x or later)
of the TCL/TK bundle are now included in the installer.

The installer now detects incomplete Cygwin uninstalls, and removes the leftover
mount information that caused bugs in our build tools. It also allows manual editing
of the system PATH.

The Cygwin tools have been updated to current versions, as of January 18, 2008. Dates on
files have been reset to the original dates, rather than a build date of Rtools27.exe.

Changes since R 2.6.0

Support for gcc 3.4.5 has been dropped. For the life of R 2.6.x, both "GCC4_SUFF=-sjlj" and "GCC4_SUFF=" will be supported;
subsequently, the gcc 4.2.1 tools will not include the suffix.

The Win32 API files have been updated to version 3.10.

Changes since R 2.5.1

The Rtools installer now includes both MinGW
gcc versions 3.4.5 (used for R versions 2.5.x) and 4.2.1 (used for R 2.6.x and later), as well as Vanilla Perl.
See the Rtools.txt file for the latest information.

tools.zip and R_Tcl.zip are no longer being distributed, now that they have been merged into
the Rtools installer.

The binary tools have been updated to current Cygwin versions (except custom versions, as noted in the README.txt
file).

Changes since R 2.5.0

Inno Setup version 5.1.12 is now used (for Windows Vista compatibility).

The TCL/TK bundle has been updated to version 8.4.15, and now includes the manuals in CHM help format.

Changes since R 2.4.1

Warning: the current MinGW releases will not run in Microsoft Vista. See
this
discussion for possible solutions.

We have just put together an experimental
Rtools installer. This packages up the R tools bundle, the MinGW
tools, and the TCL/TK, Unicode and bitmap support.
It does not include Perl, LaTeX, the HTML Help Workshop, or the
Inno Setup installer.

We no longer recommend using the pre-packaged MinGW versions; it is
hard to keep track of which versions they package. Instead we recommend
using the installer above or downloading the components directly from the
versions on the Sourceforge download page.

<

Changes since R 2.4.0

MinGW run-time version 3.11
or higher is now required.

Inno Setup version 5.1.7 or higher is now required.

Changes since R 2.3.1

The iconv.zip internationalization library has been
updated to version 1.11.

The R_Tcl.zip files for Tcl/Tk support have been updated to version 8.4.13.

mingw-runtime >= 3.10 is required to build R (a bug fix in the handing
of MBCS code is required). This is enforced by a check in building
Rpwd.exe.

Our daily builds no longer use the patched version of ld.exe, we use a newer
version of the unpatched utility. We have not tested the new setup on Windows NT4. If you are using
that OS and the builds do not work, please let us know.

Changes since R 2.2.1

- The cmp utility is required to build R; a copy has been added to
tools.zip [NB: tools.zip is no longer distributed].

- There is a bug in the MinGW ld.exe linker utility version 2.16.91 20050827.
This bug does not affect the linking method used in R up to 2.2.x, but is likely to affect the method used
in R 2.3.x or higher, making such builds fail to run on Windows NT 4 systems. Our daily
builds are now using the patched version, but it is not included in the Rtools collection.
See the instructions below to obtain and install a copy of the patched version.

Changes since R 2.1.1

The following changes have been made since the release of R 2.1.1:

- The R_Tcl.zip files for tcl/tk support have been updated to version 8.4.11.

- Version 3.4.4 of the MinGW gcc compilers, 3.8 of the MinGW runtime, 2.15.94 of
the MinGW binutils, and 3.3 of the w32api are now used in builds.

- A broken version of tar.exe has finally been replaced in tools.zip [NB: tools.zip is no longer distributed].

- The MinGW tools are now available in a file named MinGW-5.0.0.exe on the MinGW website. Choose
the "candidate" packages. This will download and install mingw-runtime-3.8.tar.gz, w32api-3.3.tar.gz, binutils-2.16.91-20050827-1.tar.gz,
gcc-core-3.4.4-20050522-1.tar.gz, gcc-g++-3.4.4-20050522-1.tar.gz, and gcc-g77-3.4.4-20050522-1.tar.gz.

- Inno setup 5.1.5 or better is needed to build the installer.

Changes since R 2.1.0

The following changes have been made since the release of the R 2.1.0 Installation and Administration manual:

- Version 5.1.2 or better of the Inno Setup installer (currently in beta testing) is now
required for r-patched and r-devel, and is expected to be required for future releases.

- The head utility is now needed to build R; a copy has been added to
tools.zip [NB: tools.zip is no longer distributed].