Bio3D in R

 

WinNotes

Page history last edited by barry Grant 1 yr ago

Building bio3d for Windows

This page describes the rather infurating process of building R packages under Windows; or Building for Windows on Windows

I work mostly in a unix/linux/macosx enviroment and find the process of package construction and instatltion rather simple. However, performing the same tasks on a PC can be something of a pain.

 


On your UNIX box

If you have a working installed version of your source only package on a UNIX box then try these easy steps.

  • build the package for Unix in the usuall way
  • install on Unix
  • then go to your package library dir: /net/home/bgrant/software/R/lib/R/library
  • run zip -r bio3d_1.0-5.zip bio3d
  • cp zip file to web space or windows box for testing

If this did not help or you don't have access to a unix box then try the steps below.

 

Fingers crossed

To build a package that can be run in Windows, copy your package directory to your Windows machine and try the following command:

> RCMD build --force --binary mypackage

 

To enter this command, open a DOS command Window. That is, click on Run from the Start Menu and type cmd and then click on OK. Next, cd to the directory where mypackage exists (something like: > cd ..\..\temp) and type the above command. Note that it is RCMD and not R CMD.

 

If the above worked, then your finger crossing worked and you should have produced a file called mypackage_1.0.zip or similar.

 

Check your PATH

If this does not work, then there are many possible reasons why. First, check that the directory where the RCMD function exists is in your PATH. To do this (Windows 2000):

 

  • go to the Control Panel; usually double click on My Computer and then on Control Panel.
  • Double click on System.
  • Click on the Advanced tab.
  • Click on the Environment Variables button.
  • Find the variable Path (note that Windows is generally NOT case sensitive).
  • Click on the Path variable and then click on the **Edit* button.
  • Add the path to where RCMD exists.
  • After editing this variable, close your DOS command Window and open a new one.

 

Try again

Now try again:

> RCMD build --force --binary mypackage

 

If that did not work then you probably need some more items installed on your system and/or you need to tell Windows where to find them by editing the Path variable again.

 

All of the items you need are found on the Rtools website. Specifically, you must have installed and in your Path:

  • Perl (version >= 5)
  • Rtools: a bunch of programs that allow you to use unix commands in Windows, but NOT Cygwin! Although, the latest version of Cygwin may work. Also, the directory where you put these tools must be at the very beginning of your Path variable. So, something like: Path="c:\Rtools;c:\Perl;c:\Other" Do not put the Rtools in a path that has folders with spaces in the name (like Program Files). Remember, the idea is to force Windows to act a little more like unix/linux.
  • If you have Help files that you want included in your package then there are some additional requirements (see below).
  • If you have Fortran or C code in your package, then there are additional things you need.
  • Check through the readme.packages file included with your version of R to see if there is anything else you need.

 

The readme.packages file should found somewhere like:

(the path to your R installation) .../R/rw2000/README.packages

 

Once all of the above are installed and in your Path (in the correct manner) then you should be able to run "RCMD build" from your DOS command prompt. Remember to open a new DOS command prompt after making any changes to the Path variable because the changes will not take affect for any command prompt that had been opened before the changes.

 

Getting addational software

 

Unix tools

make, sh, cat, cp, diff, echo, mkdir, mv, rm, sed

These unix tools can be found here: http://www.murdoch-sutherland.com/Rtools/tools.zip

You'll need the WinZip program to extract them.

Make sure that you have execute permission on all the files in the extracted tools/bin directory.

 

Perl

Need a Windows port of Perl 5 (5.8.4 or later) which is available from http://www.activestate.com/Products/ActivePerl/Download.html.

 

HTML Help Workshop

To make compiled html (.chm) files you will need the Microsoft HTML Help Workshop, available here: http://www.murdoch-sutherland.com/Rtools/htmlhelp.exe

 

MiKTeX

Need a working LaTeX system including pdftex, such as the MiKTeX port: http://www.miktex.org/

 

Compilers

If your package contains C and/or Fortran code you will need suitable compilers, such as the MinGW port of gcc via http://www.mingw.org/.

 

 

Add software to your PATH

 

Add R, tools, MinGW and HTML HELP to your PATH.

The subdirectories to add are something like:

...\R\rw2000\bin

...\tools\bin

...\MinGW\bin

...\HTML HELP WORKSHOP

ActiveState adds Perl\bin to your path automatically docs says you should put tools\bin at the front of your path

 

To Add a directory to you PATH on Windows select:

Control Panel -> System -> Advanced -> Environment Variables

 

Install package

Make a .zip file of the package's source code. On a Mac, install zip using fink, then

zip -r source_code_dir

 

To install the package, type at the Windows command prompt (Run... cmd):

R CMD INSTALL MyPkg

 

References

This section is largely abstracted from:

 

Usefull Links

Comments (0)

You don't have permission to comment on this page.