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

With the change to gcc 4.2.1, some of the tools are no longer compatible with obsolete versions of R. We are now maintaining 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.

Download R compatibility Frozen?
Rtools28.exe R 2.7.0 or later No
Rtools27.exe R 2.6.x or R 2.7.x Yes
Rtools26.exe R 2.6.x, R 2.5.x or (untested) earlier Yes

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.

Inno Setup 5.2.3 is now used.

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.

Less recent changes are collected below.

Downloads

There are a number of downloads described in the "Windows Toolset" appendix.

To build packages:

Optional additions:

For building R, all of the above, plus:

After running the Rtools installer, follow the instructions in Rtools.txt to complete your installation.

Special situations

Windows 95

If you have a vanilla Windows 95 system you may need MSVCRT.dll from ftp://ftp.microsoft.com/softlib/mslfiles/msvcrt.exe, but it is very likely that some other software has installed it for you. (Not included in the Rtools installer.)

Cross-Compilers

Prof. Ripley will continue to maintain the ix86 Linux cross-compiler as time permits. For requirements and instructions please see his web page http://www.stats.ox.ac.uk/pub/Rtools/.

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.) As of this writing, you could obtain the current release using
    svn checkout https://svn.R-project.org/R/tags/R-2-4-0 [R-2-4-0-HOME]

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.5.0.tar.gz

Extras

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

Change History

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 MinGW run-time has been updated to version 3.13.

Inno Setup has been updated to version 5.1.14.

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].