- The build process is currently set up for Linux or Windows. Other platforms are being investigated.
- A recent version of R. R 3.0 or above is recommended as this is currently used for development and tests.
- Preferably, set your Path environmental variable to include the path to R.exe (architecture specific)
- building R packages on windows requires RTools, downloadable for instance from the page
R for windows. Information on building R packages on Windows and RTools can be found in
- A recent .NET framework SDK; this document uses the version 4.0. Recent .NET SDK seem to have been bundled with the Windows SDK, for Windows 7 http://www.microsoft.com/en-au/download/details.aspx?id=8279.
Contrary to instructions given in prior versions of this document, cygwin as such is NOT recommended; rely on RTools solely. I have nothing against cygwin, use it, love it, but some very weird stuff was going on on some machines for the rClr build.
This section was documented from a 'clean slate' If you are sure you have all the prerequisites, you may skip down to the later sections dealing with building rClr itself.
Setup on Windows
Building R packages on Windows can be a difficult endeavour. This section captures the setup performed on a Windows 7 machine, a relatively clean slate. It is reproduced in the hope that this is useful; however blindly following the following screen captures
may not lead to a working build environment, depending on the prior setup on your machine, notably depending on the cygwin packges you have and the environment variables you have. Please read the instructions at
R for windows
Depending on whether you have cygwin already installed or not, you will have a choice to install the cygwin DLL from RTools or not.
You may want to check that the version of gcc used is that of RTools. If building against Microsoft .NET, gcc is currently not used, but if you choose to build against Mono, gcc is the compiler used, and depending on what you have from your cygwin install it
may wall be troublesome for the R package compilation.
For reference if this helps:
Setup on Linux
It is recommended that you set up your R environment such that you can install additional packages to a directory in your home directory, otherwise you will likely need root priviledges. You can set up a .Renviron file in your home directory containing the
line R_LIBS=~/R and other potential settings.
The practice is drawn from the courses on R package development in
rClr.h:31:62: fatal error: glib-2.0/glib/gtypes.h: No such file or directory
installing libgtk2.0 to try to get gtypes.h
Clone the rClr (r2Clr) repository, as per the instructions provided by the Codeplex site.
As of September 2013, the package building process tries to adapt to the local machine as much as feasible.
open a windows command prompt (start-run 'cmd')
go to the subdirectory packages, in which you should find the folder for the rClr
As of September 2013 the following commands should be enough to build and install:
set R="c:\Program Files\R\R-3.0.1\bin\x64\R.exe"
:: use this to build in debug mode
:: set BuildConfiguration=Debug
:: set MonoBuildConfiguration=MonoInstallDebug
%R% CMD check rClr
%R% CMD REMOVE rClr
%R% CMD INSTALL rClr
The end of a successful build and installation should look like the following screen capture;
If for some reasons the paths needed for rClr.props failed to be found, you are likely to meed the following problem:
A common issue is also that you need to create library files (.lib). The configure script should however have taken care of that.
You may use the batch file rebuildRlibExports.cmd under the build folder, to facilitate the generation process.
A successful build and install:
Generating the package documentation
The latest version package devtools tries to rebuild the package to document the R functions; however it forces the use of gcc, and overrides the use of Makefile.win. Pending issue.
The package documentation generation currently works on Linux. This is a stop-gap solution.
For reference, current issues with the documentation process on Windows:
Building on Windows against Mono
Mono is currently distributed for Windows only as a 32bits application.
Makefile: show how to specify MonoDebugInstall as a target. Explain that it is only 32 bits then.