Skip to content

Instantly share code, notes, and snippets.

@leeper
Last active July 25, 2021 02:36
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save leeper/aabec46d3d1e4d298c4e to your computer and use it in GitHub Desktop.
Save leeper/aabec46d3d1e4d298c4e to your computer and use it in GitHub Desktop.
Building R from source on Windows
# Outline for building R from source on Windows (7)
# http://cran.r-project.org/doc/manuals/r-release/R-admin.html#Building-from-source
# Pre-built Windows R-Devel binary: http://cran.r-project.org/bin/windows/base/rdevel.html
# possibly helpful: http://stackoverflow.com/questions/25451705/build-r-source-code-from-windows
# install Rtools
# http://cran.r-project.org/bin/windows/Rtools/
# install Inno Setup (Unicode version)
# http://jrsoftware.org/
# obtain source tarball
# save to R_HOME directory
# decompress (using correct file name):
tar --no-same-owner -xf R-3.1.1.tar.gz
# set TMPDIR ENVIRONMENT VARIABLE
set TMPDIR=C:/Windows/Temp
# tcl/tk support
# install tcl from here: http://www.stats.ox.ac.uk/pub/Rtools/R30x.html
# graphics libraries
cd C:/Program Files/R/R-devel/src/gnuwin32/bitmap/
# get sources from:
# http://www.libpng.org/
# http://www.ijg.org/
# http://download.osgeo.org/libtiff/
tar -zxf libpng-1.6.12.tar.gz
mv libpng-1.6.12 libpng
tar -zxf jpegsrc.v9a.tar.gz
tar -zxf tiff-4.0.3.tar.gz
mv tiff-4.0.3/libtiff .
rm -rf tiff-4.0.3
# compile
cd ../
make all recommended
# graphics
make bitmapdll
make cairodevices
# checks
make check
make check-recommended
# manuals
make manuals
# finish
make distribution
make check-all
# 32-bit build
make 32-bit
# then building 64-bit R with the macro HOME32 set in file MkRules.local to the top-level directory of the 32-bit build
# 64-bit build
make rinstaller
# test build
Rterm --vanilla
# in Rterm:
Sys.setenv(LC_COLLATE = "C", LANGUAGE = "en")
library("tools")
testInstalledBasic("both")
testInstalledPackages(scope = "base", errorsAreFatal = FALSE)
testInstalledPackages(scope = "recommended", errorsAreFatal = FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment