HowToBuildR ForSolaris: Difference between revisions

From BRF-Software
Jump to navigation Jump to search
imported>MichaelDondrup
No edit summary
imported>MichaelDondrup
No edit summary
Line 130: Line 130:


echo $CC
echo $CC
echo $CXX
echo $CXX
echo $F77
echo $F77
Line 227: Line 228:


== Installing additional Packages ==
== Installing additional Packages ==
* Note: each package must be installed for each architecture!
* You can install add on packages from inside R using install.packages()
* You can install add on packages from inside R using install.packages()
* This is for CRAN packages, Bioconductor packages are installed in a different way


<pre><nowiki>
<pre><nowiki>
Line 236: Line 239:


* If you got problems installing the package, you can download it from CRAN and install it manually
* If you got problems installing the package, you can download it from CRAN and install it manually
* The RSPerl package and other ''locally optimized'' packages (e.g. amap) must be installed this way:


<pre><nowiki>
<pre><nowiki>
Line 247: Line 251:
# fix me
# fix me
azteca~> /vol/r-<version>/bin/R CMD INSTALL package/
azteca~> /vol/r-<version>/bin/R CMD INSTALL package/
</nowiki></pre>
* If there is a problem report the problem to the package maintainer or author first, look into the DESCRIPTION file for the email
== Installing RSPerl ==
see the RSPerl installation page
== Other Packages ==
The following packages should not be installed from the repository because they contain patches for our system, which the authors did not apply
* vioplot (use version 0.3)
* amap
* RSPerl (use our version 0.92)
== Installing Bioconductor Packages ==
* /!\ Some Bioconductor packages currently require [[TheMeanPthreadHack]] on our system
* Bioconductor packages are found on: http://www.bioconductor.org/
* Follow the installation instructions from the Bioconductor site
* Report problems to the Bioconductor mailing list
* To install biobase run in R:
<pre><nowiki>
source("http://bioconductor.org/biocLite.R")
biocLite()
</nowiki></pre>
* To install more packages:
<pre><nowiki>
biocLite(c('biobla1','bioblubb'))
</nowiki></pre>
* You can also download bioconductor packages from
== Installing all packages from the previous version ==
* Often you want to have all the packages from the old version in the new one
* This is a tip to simplify this a bit:
* You can do this in R:
* Open the old R binary
<pre><nowiki>
azteca~>/vol/old-r/bin/R
allp <- installed.packages()
save(allp, file='~/rpackages.rda')
q()
</nowiki></pre>
* in the new R excute the following script:
<pre><nowiki>
azteca~>/vol/new-r/bin/R
load ('~/rpackages.rda')
# do not reinstall already installed packages
allp = setdiff(allp[,1], installed.packages()[,1])
cranpackages = intersect(allp, available.packages()[,1])
install.packages(cranpackages)
# install bioconductor basepackage
source("http://bioconductor.org/biocLite.R")
biocLite()
rest = setdiff(allp, installed.packages()[,1])
biocLite(rest)
# this could give an error for some packages not contained in both
# repositories e.g RSPerl, so install that first
</nowiki></pre>
</nowiki></pre>

Revision as of 11:19, 9 April 2009

Tips how to build R and Bioconductor using the SunPro 12 Compiler Suite

Synopsis

This pages gives some hints on how R and Boioconductor can be compiled using the Sun Compilers. This works at the CeBiTec. If you try that somwhere else your milage may vary. Using gcc everything might be different. Most tips are given as shell commands. Note: a simple


 configure
 make
 make install


will not work. You have to set more options, that's what this page is for.

Preconditions

Checking the versions of the compilers, yours should be same or higher:


dizzy~> which cc
/opt/SUNWspro/bin/cc
dizzy:~> cc -V
cc: Sun C 5.8 Patch 121015-06 2007/10/03
dizzy:~> which CC
/opt/SUNWspro/bin/CC
dizzy:~> CC -V
CC: Sun C++ 5.8 Patch 121017-17 2008/11/12
dizzy:~> which f95
/opt/SUNWspro/bin/f95
dizzy:~> f95 -V
f95: Sun Fortran 95 8.2 Patch 121019-10 2008/04/16
dizzy:~> uname -a
SunOS dizzy 5.10 Generic_118833-03 sun4u sparc SUNW,Sun-Fire-V440 Solaris


This information must as minimum be provided when reporting build problems.

Reporting Problems

  • read "R Installation and Administration" document from "CRAN"
  • report build or compilation errors of R to the R-devel mailing list not to R-help
  • report error in Bioconductor errors to the bioconductor mailing list not to R
  • before reporting an error you must download and try to build the latest R-patched from the R-homepage
  • search first for a related problem using search terms Sun Pro, Sun C, Solaris
  • add the output of the compiler including the error message
  • try to analyse the problem in depth before making any complaint, try to be helpful

Download sources

  • http://cran.r-project.org/mirrors.html and choose a mirror
  • if having problems with building, use R-patched: ftp://ftp.stat.math.ethz.ch/Software/R/
  • check the md5 sums to verify package integrity
  • unpack the sources to your build directory: tar xvzf R-<rversion>.tar.gz
  • for multiple architectures it's best to have a build dir for each platform
  • use a separate sparc and i386 directory
  • see the R Installation and Administration from CRAN document for more details

Building

  • R must be built for each architecture individually: sparc and opteron, i386
  • If building a new version start on the faster one, aka. opteron, use qxterm86 to get a build machine use azteca
  • Use qxterm for a sparc machine
  • change to your source directory cd R-version-i386

Configure

  • To enable configure to find all the libraries, you need to configure environment variables
  • Use a little script, save this in your source directory:
#!/usr/bin/sh

# Set the prefic to your versioned architecture specific volume
# If you just want to test building use a local directory
PREFIX=/vol/r-<version>

# use this per:
PERL_PREFIX=/vol/perl-5.8.8
TCL_PREFIX=/vol/tcl-8.4.13


CC="cc -xc99"
CPPFLAGS="-I/opt/SUNWspro/include/"
CPPFLAGS="$CPPFLAGS -I$TCL_PREFIX/include -I/vol/local/include -I/vol/graphics/include -I/vol/gnu/include"
CFLAGS="-O -xlibmieee"
F77=f95
FFLAGS=-O4
CXX=CC
CXXFLAGS=-O
FC="f95  -xO2"
FCFLAGS=$FFLAGS
LDFLAGS="-lCstd -lCrun -L/opt/SUNWspro/lib -R/opt/SUNWspro/lib"
LDFLAGS="$LDFLAGS -L$TCL_PREFIX/lib -R$TCL_PREFIX/lib -L/vol/local/lib -R/vol/local/lib -L/vol/graphics/lib -R/vol/graphics/lib  -L/vol/gnu/lib -R/vol/gnu/lib -R$PREFIX/lib/R/library/RSPerl/libs -R$PREFIX/lib/R/bin"

SHLIB_CXXLDFLAGS="-G -lCstd -lCrun -L/opt/SUNWspro/lib -R/opt/SUNWspro/lib"

# to help finding gnome-config
PATH=/vol/gnu/bin:/vol/graphviz-2.8/bin:/vol/graphics/bin:/vol/perl-5.8.8/bin:/vol/java-1.5.0/bin:/vol/mysql-5.0.45/bin:/vol/qt-3.3.8/bin:/vol/subversion-1.3.0/bin:/vol/gtk-1.2.10/bin:/vol/emboss-2.9.0/bin:/vol/biotools/bin:/vol/thunderbird-2.0/bin:/vol/firefox-3.0/bin:/vol/gnu/bin:/vol/local/bin:/vol/cups/bin:/opt/staroffice9/bin:/vol/X11/bin:/usr/dt/bin:/usr/openwin/bin:/vol/tex-2008/bin:/vol/studio-12/bin:/usr/bin:/usr/ccs/bin:/usr/ucb:/usr/local/bin:/vol/codine-6.0/bin/sol-x86

# use the THIS perl
PATH=$PERL_PREFIX/bin:$TCL_PREFIX/bin:$PATH
export PATH

echo `type perl`

# no architecture specific options needed any more

case `isainfo -k` in
  i386|amd64)

    ;;
  sparc*)

    ;;
  *)
    echo Plattform not supported.
    exit 1
    ;;
esac



export CPPFLAGS
export LDFLAGS

export CC
export CXX
export F77
export FC

echo $CC

echo $CXX
echo $F77

R_PAPERSIZE=A4

./configure --prefix=$PREFIX \
		--with-blas=-lsunperf \
		--with-lapack=-lsunperf \
		--with-readline \
		--enable-R-shlib \
		--enable-shared \
		--with-X \
		--with-zlib \
		--with-pcre \
		--with-jpeglib \
		--with-libpng\
		--with-bzlib \
		--with-tcl-config=$TCL_PREFIX/lib/tclConfig.sh \
		--with-tk-config=$TCL_PREFIX/lib/tkConfig.sh


  • run the configure script:
 > sh CONFIGURE-R.sh
....

R is now configured for i386-pc-solaris2.10

  Source directory:          .
  Installation directory:    /vol/r-2.8.1

  C compiler:                cc -xc99  -g
  Fortran 77 compiler:       f95  -g

  C++ compiler:              CC  -g
  Fortran 90/95 compiler:    f95  -xO2 -g
  Obj-C compiler:            cc 

  Interfaces supported:      X11, tcltk
  External libraries:        readline, BLAS(SunPerf), LAPACK(SunPerf)
  Additional capabilities:   PNG, JPEG, TIFF, iconv, MBCS, NLS
  Options enabled:           shared R library, R profiling, Java

  Recommended packages:      yes

configure: WARNING: you cannot build info or HTML versions of the R manuals
azteca:~/compile/R-patched-i386> 


If something is wrong look into the file configure.log.

The warning comes from:


 
configure:4037: checking for makeinfo
configure:4055: found /vol/gnu/bin/makeinfo
configure:4067: result: /vol/gnu/bin/makeinfo
configure:4079: checking whether makeinfo version is at least 4.7
configure:4099: result: no
configure:4105: WARNING: you cannot build info or HTML versions of the R manuals


but we've got only 4.2 installed.

Make it

This will make the thing using 12 parallel processes, use less for small hosts

azteca> make -j12 


Check

make check

that should print *OK* for each test

Install

make install


Again

  • Repeat Configure, Make, Check, Install for each architecture

Installing additional Packages

  • Note: each package must be installed for each architecture!
  • You can install add on packages from inside R using install.packages()
  • This is for CRAN packages, Bioconductor packages are installed in a different way
> install.packages("sma")
# choose a mirror
> install.packages(c("sma", "vioplot")) # to install multiple packages
  • If you got problems installing the package, you can download it from CRAN and install it manually
  • The RSPerl package and other locally optimized packages (e.g. amap) must be installed this way:
azteca~> /vol/r-<version>/bin/R CMD INSTALL package.version.tar.gz
  • To debug a compilation problem, untar the package, try to fix it and install from a directory
azteca~> tar -xvzf package.tar.gz
# fix me
azteca~> /vol/r-<version>/bin/R CMD INSTALL package/
  • If there is a problem report the problem to the package maintainer or author first, look into the DESCRIPTION file for the email

Installing RSPerl

see the RSPerl installation page

Other Packages

The following packages should not be installed from the repository because they contain patches for our system, which the authors did not apply

  • vioplot (use version 0.3)
  • amap
  • RSPerl (use our version 0.92)

Installing Bioconductor Packages

  • /!\ Some Bioconductor packages currently require TheMeanPthreadHack on our system
  • Bioconductor packages are found on: http://www.bioconductor.org/
  • Follow the installation instructions from the Bioconductor site
  • Report problems to the Bioconductor mailing list
  • To install biobase run in R:
source("http://bioconductor.org/biocLite.R")
biocLite()
  • To install more packages:
biocLite(c('biobla1','bioblubb'))
  • You can also download bioconductor packages from

Installing all packages from the previous version

  • Often you want to have all the packages from the old version in the new one
  • This is a tip to simplify this a bit:
  • You can do this in R:
  • Open the old R binary
azteca~>/vol/old-r/bin/R
allp <- installed.packages()
save(allp, file='~/rpackages.rda')
q()
  • in the new R excute the following script:
azteca~>/vol/new-r/bin/R

load ('~/rpackages.rda')
# do not reinstall already installed packages
allp = setdiff(allp[,1], installed.packages()[,1]) 
cranpackages = intersect(allp, available.packages()[,1])
install.packages(cranpackages)
# install bioconductor basepackage
source("http://bioconductor.org/biocLite.R")
biocLite()
rest = setdiff(allp, installed.packages()[,1])
biocLite(rest)
# this could give an error for some packages not contained in both 
# repositories e.g RSPerl, so install that first