HowToInstallRSPerl

From BRF-Software
Jump to navigation Jump to search

Short Installation Instructions for RSPerl

NOTE

RSPerl -- The Omegahat interface for R and Perl.

Follow these instructions to install the RSPerl bidirectional interface for use with the EMMA 2 software.

The original RSPerl software is written and copyrighted by Duncan Temple Lang and distributed under the FreeBSD license. See the RSPerl homepage: http://www.omegahat.org/RSPerl/index.html

If you also want to use RSPerl for another purpose (e.g. Perl from R), you should also consider the original installation instructions.


! This page is meant for internal use at the CeBiTec. Any information in this document is provided without any warranty. !


Prerequisites

  • Perl >= 5.8.x
  • R >= 2.10.x

R needs to be configured with --enable-R-shlib switch (which is the case by default).

Obtaining the Sources

Changed: -- MichaelDondrup DateTime(2009-04-09T12:06:56Z)

/!\ Do not download the version from omegahat. The official version has not been updated since 2007. In the meantime we provide our own derived version which has an important new feature: It allows to create complex data structures as RReferences in Perl. Furthermore it contains several Bugfixes in addition. This package is released under the same license as the original (the BSD-license). EMMA is not compatible with the original version 0.9-1 any more! Report any problems with the derived package to the emma-devel mailing list.

See the Changes file: Media:HowToInstallRSPerl$Changes.html.

Use this version for general installation: Media:HowToInstallRSPerl$RSPerl_1.0-1.tar.gz The release RSPerl v.1.0 under a FreeBSD licence (see LICENCE). Fixes a bug in the intallation process on Ubuntu. Patch 1.0-1 should now also install under R 2.11, tested on Ubuntu 10.04 (lucid) with R 2.10.1 and 2.11.1


Older versions

Media:HowToInstallRSPerl$RSPerl_1.0.tar.gz (warnings turned to build errors between R 2.10 and R 2.11)

0.92:Media:HowToInstallRSPerl$RSPerl_0.92.tar.gz And the patch to view the code differences between the Omegahat version and 0.92: Media:HowToInstallRSPerl$rsperl0.91to0.92.patch

This version includes a patch that hardcodes ld_runpath, therefore reducing the need to set the LD_LIBRARY_PATH. ! Use this module with the CeBiTec infrastructure: Media:HowToInstallRSPerl$RSPerl_0.92_ldlibpathhack.tar.gz !

You can also he original package can be downloaded from: http://www.omegahat.org/RSPerl/index.html

Version 1.0-1 has been tested with:

  • Ubuntu 10.04 x86_64 (lucid)
  • R 2.10.1 & 2.11.1
  • Perl 5.10.1

Version 0.92 has been tested with

  • FreeBSD 5.4
  • Solaris 9 and 10 (sparc and i386)
  • R 2.7.2 (on sparc and i386 solaris using Sun Pro 12 compilers only)
  • Perl 5.8.8

(Versions of RSPerl prior to 0.9-1 had a bug that prevents EMMA to function with it)

Installation

You need to be a privileged user to install RSPerl in the standard location of R libraries and Perl modules. At the console, type:


radmin#  R CMD INSTALL -c --configure-args='--with-in-perl --with-modules=""' RSPerl_X.tar.gz 

(replace X with the actual version) or

somebody# R CMD INSTALL -l <whereever> -c --configure-args='--with-in-perl --with-modules=""' RSPerl_X.tar.gz 

to install to another directory. This is recommended, for a first test of the package, and if you do not want to or cannot become privileged user.

Setting up the Environment

For RSPerl to execute R commands from within Perl you have to set LD_LIBRARY_PATH, PERL5LIB, and R_HOME.


export R_HOME=/usr/local/lib/R 
# or wherever you installed it
RSPERLDIR=$R_HOME/library/RSPerl 
# or wherever you put RSPerl 

export LD_LIBRARY_PATH=$RSPERLDIR/libs:$R_HOME/lib

export PERL5LIB=$RSPERLDIR/share/lib/site_perl
# check, that this directory contains R.pm and RReferences.pm


To avoid having to set PERL5LIB you could also copy the content of $RSPERLDIR/share/lib/site_perl/ to the site_perl directory of your local perl installation.

  • this can be better done as root by installing RSPerl from a directory rather than the tarball and then:
> cd <builddir>/RSPerl/src
> make -f Makefile.perl install


  • Hint: If you are getting segmentation faults when loading the R module in perl, then this might be a version mismatch:

Most probably, Perl tries to load the wrong shared object which was compiled for a different version of perl or R. Try not to mess up versions, this will not work.

  • Any perl installation can only work together with one version of R and RSPerl.

Testing R from Perl

After setting up the environment, try to execute the perl scripts in the tests/ subdirectory of the RSPerl installation.

somebody# perl test.pl
[...no error message...] 
somebody# perl test1.pl; perl test2.pl; perl test3.pl; perl plot.pl


Issues

  • There are several compile warnings
  • The build system using Makefile.PL.in makes some invalid assumptions about paths
  • The build system will break if the R in your PATH is not the same R you want to install RSPerl to

System specific issues

Debian based Linux

The perl distribution in Debian-based Linux distributions (Debian, Ubuntu, ...) has been split in two. To build Rsperl you need the shared object libperl.so. Make sure you have the package libperl installed:

apt-get install libperl

Solaris

There is a patch kindly provided by Björn Fischer from the CeBiTec support group, that will remove the need to set the LD_LIBRARY_PATH. The patched package: Media:HowToInstallRSPerl$RSPerl_0.92_ldlibpathhack.tar.gz

FreeBSD

RSPerl uses GNU make features. To be able to install RSPerl on systems, where make is not GNU make by default, do the following prior to running R CMD INSTALL (provided you are using bash):


radmin#  export MAKE=gmake