Skip to content

Development environment for R extentions on Windows

7 messages · Jeffrey Horner, Duncan Murdoch, Dirk Eddelbuettel

#
Hi all,

I'm setting up a development environment on Windows as the subject
implies. I've downloaded and installed Rtools211.exe (will upgrade
later when necessary) and I've also downloaded and installed mingw
with the help of mingw-get.exe.

I come from a UNIX development background, so I'm at the bash shell
prompt for just about every step in R extenstion development. Question
is what is an appropriate environment for Windows development. What
shell do you use? Do you use cmd.exe with the PATH variable set up by
Rtools? Do you use the sh.exe that comes with Rtools? I've found the
bash shell from MinGW to be a pretty close equivalent to bash on UNIX.
Do you use something else?

Jeff
#
On 08/09/2010 1:21 PM, Jeffrey Horner wrote:
I've used the bash shell in Cygwin for quite a few years, but I've been 
planning a switch to MSYS sometime.  Cygwin seems to have made some bad 
decisions lately that make it harder and harder to work with.

Duncan Murdoch
#
On Wed, Sep 8, 2010 at 12:37 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
This is great news! I don't know how I could survive without bash's vi
style editing and command completion...

Here's my PATH variable which sets the Rtools paths first, then MinGW:

hornerj at hornerj-win ~
$ echo $PATH
/c/Rtools/bin:/c/Rtools/perl/bin:/c/Rtools/MinGW/bin:/c/localbin:/mingw/bin:/bin:/usr/bin:/usr/lo
cal/bin:/c/Program Files (x86)/R/R-2.11.1/bin:/c/Program Files
(x86)/CollabNet/Subversion Client:
/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.
0/:/c/Program Files (x86)/MiKTeX 2.8/miktex/bin

I'm going to follow the "R Installation ..." manual to compile R on
Windows and learn a bit about the build process. From there, I intend
to "port" some open source libraries that have support for being
compiled with MS VC++ over to MinGW.

Aside from my PATH variable, are there other things about my
development environment I should be aware of?

Jeff
#
On 8 September 2010 at 13:01, Jeffrey Horner wrote:
| This is great news! I don't know how I could survive without bash's vi
| style editing and command completion...
| 
| Here's my PATH variable which sets the Rtools paths first, then MinGW:
| 
| hornerj at hornerj-win ~
| $ echo $PATH
| /c/Rtools/bin:/c/Rtools/perl/bin:/c/Rtools/MinGW/bin:/c/localbin:/mingw/bin:/bin:/usr/bin:/usr/lo
| cal/bin:/c/Program Files (x86)/R/R-2.11.1/bin:/c/Program Files
| (x86)/CollabNet/Subversion Client:
| /c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.
| 0/:/c/Program Files (x86)/MiKTeX 2.8/miktex/bin
| 
| I'm going to follow the "R Installation ..." manual to compile R on
| Windows and learn a bit about the build process. From there, I intend
| to "port" some open source libraries that have support for being
| compiled with MS VC++ over to MinGW.
| 
| Aside from my PATH variable, are there other things about my
| development environment I should be aware of?

FWIW I always add rxvt (taken from Cygwin's repos) so that I can launch an
'xterm' alike from the usual shortcut by having this as the command in 
Cygwin.bat:

  rxvt -sr -sl 2500 -sb -geometry 90x30 -fg wheat -bg gray10 -tn rxvt \
     -fn 'Lucida Console-14' -e /usr/bin/bash --login -i

The last time I set that up I left myself a note that I got hints from 

  http://blasphemousbits.wordpress.com/2007/02/12/rxvt-solves-many-cygwin-woes/

and

  also see http://www.saltycrane.com/blog/tag/cygwin/

Those links may by now be stale.

Hth, Dirk
#
On Wed, Sep 8, 2010 at 1:01 PM, Jeffrey Horner <jeffrey.horner at gmail.com> wrote:
did run into trouble with temporary files. I got around it by
specifying TMPDIR like so:

$ cd R_HOME/src/gnuwin32
$ TMPDIR=. /c/Rtools/bin/make all

If I didn't set TMPDIR, it would default to /tmp and the failure would
occur within the mkR target of R_HOME/share/make/basepkg.mk. For
reasons beyond me, the shell environment that's entered within the mkR
target has no notion of a root directory. Anyone else seen this?

Jeff

  
    
  
#
On 08/09/2010 5:37 PM, Jeffrey Horner wrote:
I don't know if anything would go wrong, but I'd avoid putting your temp 
dir into the source tree.  On my home machine I normally set R_USER to a 
Windows-style path (with backslashes), and that seems to work.  On my 
work machine I think I set TMPDIR explicitly, but I forget what value I 
used.
I'm not sure you're using the write make procedure.  Are you running 
make from within src/gnuwin32, so you get the Makefile there?  It 
shouldn't try to use /tmp (but things might have changed recently).

Duncan Murdoch
1 day later
#
On Wed, Sep 8, 2010 at 6:39 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
I was (see above), and I think I've found the culprit.
R_HOME/share/make/basepkg.mk is utilized by both the UNIX and Windows
build, and its target mkR will expand the shell variable f to a
suitable path under /tmp if TMPDIR is not set. Rtools' shell (forked
by make) has no notion of a root file system at /, so /tmp is never
found. The solution is to, of course, always set TMPDIR to a suitable
directory before invoking make. Surprisingly, setting TMPDIR=/tmp
actually works since make expands it to the user's temporary folder.
On my windows laptop, that's:

/cygdrive/c/Users/hornerj/AppData/Local/Temp

Jeff