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 essentials

You will need suitable versions of several Unix tools, and we have bundled a set at http://www.murdoch-sutherland.com/Rtools/tools.zip (sources). Beware that many other sets have problems: in particular cygwin 1.3.21 causes tar to malfunction.

You will need the Windows port of Perl 5 (preferably 5.8.0 or later) which is available from http://www.activestate.com/Products/ActivePerl/Download.html. Note carefully the dependencies shown.

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.

Compilers

If your package contains C and/or Fortran code you will need suitable compilers. We recommend that you use the MinGW port of gcc via http://www.mingw.org/.

The packaged version MinGW-3.1.0-1.exe is what is currently used to build and test R. It is a self-extracting installer: just install it and put its bin directory in your path after our tools. There may be updates available (see http://www.mingw.org/download.shtml) and we suggest you do install them, especially the mingw-runtime and w32api updates. The releases of gcc-3.3.1 have been tested and are used by the core developers, but the candidates of gcc-3.3.3 did not work when tested.

Earlier MinGW ports of gcc may work but are no longer tested. Those more than a year old probably will not work.

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

To build Windows help

If you want to make compiled html (.chm) files you will need the Microsoft HTML Help Workshop, at one time available for download at http://msdn.microsoft.com/library/en-us/htmlhelp/html/hwmicrosofthtmlhelpdownloads.asp or http://www.microsoft.com/office/ork/xp/appndx/appa06.htm.
In case these disappear again, we have put a copy here.

Building R itself

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-1.8.1.tgz

To build the documentation

To build the documentation you will need makeinfo, version 4.5 or later. We compiled one from the sources for our tools.zip. You will also need a working LaTeX system including pdftex. We recommend the fptex port, and have also successfully used MiKTeX. Recent versions of MiKTeX require some changes from the default setup; those are described here.

Tcl/Tk support

The binary distribution of R for Windows comes with a compiled version of Tcl/Tk 8.4.6. Currently we have only succeeded in building it with Visual C++, and the zip file mentioned in INSTALL is available from here. (We can build it under MinGW, but our build does not work correctly, nor does that on the MinGW site.)

Bitmap graphics devices

To build the DLL Rbitmap.dll for bit-mapped graphics devices you will need libpng and jpeg sources (available, e.g., from ftp://ftp.uu.net/graphics/[png,jpeg] and many mirrors). You will need files libpng-1.2.5.tar.gz and jpegsrc.v6b.tar.gz or later. Some currently active links are libpng and jpeg.

Building the installers

To build the installers you will need Inno Setup 4.1.5 or later from JR Software.

Extras

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