Prof Brian Ripley
2007-Jul-16 08:48 UTC
[Rd] Progress report on 64-bit builds under Windows
We have been asked for a couple of years about builds of R for 64-bit Windows, e.g. at UserR 2006. Users of 64-bit Windows still seem very thin on the ground, but apparently 'Microsoft scraps 32-bit operating systems Microsoft has announced that Windows Server 2008 will be the last 32-bit system it releases, for servers or clients, as it makes its way fully into the world of 64-bit computing.' (http://www.pcpro.co.uk/news/113114/microsoft-scraps-32bit-operating-systems.html) I've not heard recently of any programmeR working on such a build. I have Vista 64 on my current Windows desktop, intending it to be my main Windows platform (the machine also has Windows XP). With the current Rtools.exe I am successfully doing R development on it (e.g. the only CRAN package that I can install under XP but not Vista 64 is RSQLite, an internal problem in dlltool). A 64-bit version of R could be just a sub-architecture: only the binaries in R_HOME/bin and DLLs in R_HOME/modules and library/*/libs need to be different. So in an ideal world we would be able to distribute binary packages that supported both 32- and 64-bit builds, and to build those on a single OS via 32/64-bit cross-compilers. Quite a number of packages need support software of course: one of those is Tcl/Tk. (That is built using VC++, so presumably could be built using a 64-bit edition of VC++: see below. Similarly iconv.dll.) 1) The good news is that under Vista 64 you get a 4GB address space for the current builds of R, rather than 2GB for most 32-bit versions of Windows, or 3GB if the /3GB switch was used. So there is a worthwhile gain in using a 64-bit OS even with a 32-bit build of R. 2) To make a 64-bit build of R we need a 64-bit toolchain. Kai Tietz has been working on versions of gcc and binutils, see http://www.nabble.com/64-bit-MinGW-on-64-bit-Windows-XP-tf4012895.html This is essentially a cross-compiler running under Cygwin. I didn't succeed in getting that to build, but did build a cross-compiler chain under x86_64 Linux and built simple C programs that run correctly. This enabled me to try building R. There were several problems: - most Fortran programs give an ICE (internal compiler error). - importing a variable from a DLL gives an ICE. - a couple of modules gave ICEs if optimization was used. - the headers have many problems, with broken attempts at inlining and missing declarations. - R itself will need some changes, as on Win64 'long' is 32-bit and cannot store a pointer. Given that the toolchain is a one-man effort, I do not see these getting resolved soon. 3) An alternative is to use a non-GNU toolchain, e.g. from Microsoft, Intel or PGI (formerly Portland). There seems no longer to be a Fortran compiler compatible with Microsoft Visual Studio (formerly from DEC/Compaq/HP), but Intel and PGI have Fortran compilers, at a price. Someone from Microsoft reported that he had built a 64-bit version of R, but gave an invalid return address and we have not been able to find out how he did it. There is a free (but not Free) version of Visual Studio 2005 that is said to be 32-bit only, but I have discovered that the free Vista Platform SDK contains a 64-bit toolchain. (I have full Visual Studio 2005, which has 64-bit and 64-bit on 32-bit and v.v. cross-compilers.) So I believe it should be possible to build a 64-bit version of R using Microsoft compilers and f2c, and may try to do so over the summer. Is there anyone working on (or interested in working on) these issue? -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595