HowToBuildR ForSolaris

From BRF-Software
Revision as of 15:15, 8 April 2009 by imported>MichaelDondrup
Jump to navigation Jump to search

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