Cygwin and Rtools (Was: RE: [Rd] cygwin tar?)

Henrik Bengtsson hb at maths.lth.se
Wed Mar 17 14:25:52 MET 2004


If it helps anyone, below is the startup script I use in WinXP to get
an MSDOS prompt that give me access to R and Ripley's Rtools so that I
can run RCMD build etc without problems and at the same time keep my
Cygwin installation. This is pretty much what Ripley suggest. Note the
"NOTE: ..." below!

I'm sorry if mine or your email client cuts the lines. 

Henrik Bengtsson

-------------------------------------------------------------
Begin: RCMDprompt.bat
-------------------------------------------------------------
@echo off
rem
######################################################################
rem # Usage: RCMDprompt.bat [path]
rem #
rem # This script opens a MS-DOS prompt with a enviroment variables
rem # set such that R can be ran and packages can be build. 
rem # If 'path' is given, the working directory will be set
accordingly.
rem # 
rem # NOTE: This scripts works even if Cygwin is installed. HOWEVER,
you
rem # can not have any Cygwin applications running (not even a shell
or
rem # XEmacs for Cygwin) at the same time you try to run RCMD.
rem #
rem # Requires:
rem # To build and install packages two things must be installed, i.e.
rem # exists in the PATH. First, the Rtools compilation [1] by B.
Ripley 
rem # must exists. The path (R_TOOLS) to it is set below. Second, Perl

rem # (must not be Cygwin/Perl) must also exists. The path to it is
set
rem # below.
rem #
rem # Reference:
rem #  [1] http://www.stats.ox.ac.uk/pub/Rtools/
rem #
rem # Henrik Bengtsson, hb at maths.lth.se, March 2004.
rem
######################################################################

rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
rem # 1. "Global" environment variables
rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
rem # Short version of PROGRAMFILES, e.g. 'C:\Progra~1' instead of
rem # 'C:\Program Files\', which contains spaces that are BAD for R &
Co.
set PROGRAMFILES_SHORT=C:\Progra~1

rem # Directory where user directories are
set USERSDIR=C:\users

rem # Set the main R directory
set R_ROOT=%PROGRAMFILES_SHORT%\R

rem # Set the R_HOME directory
set R_HOME=%R_ROOT%\rw1081
rem set R_HOME=%R_ROOT%\rw1090alpha

rem # Set the HOME directory. This is the directory where R looks 
rem # for the .Rprofile and .Renviron files. See ?Startup.
set HOME=%USERSDIR%\%USERNAME%\

rem # Set TMPDIR to a temporary directory
set TMPDIR=%TEMP%


rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
rem # 2. Setup the PATH
rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
rem # Clear the PATH (making the main Cygwin installation "invisible")
path ;

rem # Set the LaTeX directory
rem # http://www.miktex.org/
path %PROGRAMFILES%\MikTeX\miktex\bin;%PATH%

rem # Set the Microsoft HTML Help Compiler directory
rem #
http://msdn.microsoft.com/library/tools/htmlhelp/chm/HH1Start.htm
path %PROGRAMFILES%\HTML Help Workshop;%PATH%

rem # Set the Perl directory
rem # http://www.activestate.com/Products/ActivePerl/Download.html
path C:\Perl\bin;%PATH%
 
rem # Set the Rtools [1] directory
rem # http://www.stats.ox.ac.uk/pub/Rtools/
path %R_ROOT%\Rtools;%PATH%

rem # Set the R_HOME directory
path %R_HOME%\bin;%PATH%


rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
rem # 3. Start the MSDOS prompt in the given directory
rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
rem # Change directory according to argument 1
cd %1%

rem # Start the MSDOS commando prompt
%SystemRoot%\system32\cmd.exe

-------------------------------------------------------------
End: RCMDprompt.bat
-------------------------------------------------------------


> -----Original Message-----
> From: r-devel-bounces at stat.math.ethz.ch 
> [mailto:r-devel-bounces at stat.math.ethz.ch] On Behalf Of Prof 
> Brian Ripley
> Sent: den 17 mars 2004 13:40
> To: Martyn Plummer
> Cc: Tony Plate; Jeff D. Hamann; r-devel at stat.math.ethz.ch
> Subject: Re: [Rd] cygwin tar?
> 
> 
> On Wed, 17 Mar 2004, Martyn Plummer wrote:
> 
> > I had the same problem as Tony with multiple copies of
cygwin1.dll. 
> > But doesn't this solution (renaming cygwin1.dll in the tools 
> > directory) just link the tools with the cygwin1.dll that comes
with 
> > cygwin? In which case will it work if the tools are linked 
> against a 
> > different version of the cygwin1 library?
> 
> It may or it may not.  At least some cygwin1.dll's are broken 
> and cause 
> tar to malfunction.
> 
> I don't uninstall cygwin, but I do ensure that its path is 
> not mounted, 
> since if it thinks there is a /bin/cygwin1.dll or 
> /usr/bin/cygwin1.dll it 
> complains, even if that is really 
> C:/packages/usr/bin/cygwin1.dll and not 
> in your path.
> 
> > To answer Jeff's question
> > > 
> > >  if($WINDOWS) {
> > >      ## workaround for paths in Cygwin tar
> > >      $filepath =~ s+^([A-Za-x]):+/cygdrive/\1+;
> > >  }
> > > 
> > > in the build script and don't think it needs to be there 
> since you 
> > > can use the tar utility that comes with mingw, yes?
> > 
> > You're talking about the tar that comes with MSYS. And no you
can't 
> > use it because it can't handle symbolic links, a problem that is 
> > discussed in the documentation.
> 
> That's not the only problem I have met with MSYS's tar, if 
> that is what 
> was meant.  It often had problems for me in the middle of 
> .tar.gz archives 
> that other systems are happy with.
> 
> I do know how to solve this, but I am not going to put the 
> effort in to do 
> so.  So the situation will remain
> 
> 	`follow the instructions or don't ask for help'.
> 
> -- 
> 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
> 
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailma> n/listinfo/r-devel
> 
>



More information about the R-devel mailing list