HowToBuildR ForSolaris: Difference between revisions
imported>StefanAlbaum No edit summary |
imported>StefanAlbaum No edit summary |
||
Line 51: | Line 51: | ||
* http://cran.r-project.org/mirrors.html and choose a mirror | * 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/ | * if having problems with building, use R-patched: ftp://ftp.stat.math.ethz.ch/Software/R/ or try R-latest: http://cran.r-project.org/src/base-prerelease/R-latest.tar.gz | ||
* check the md5 sums to verify package integrity <code><nowiki> Nope! Would be neat but no checksums provided! </nowiki></code> ;-) | * check the md5 sums to verify package integrity <code><nowiki> Nope! Would be neat but no checksums provided! </nowiki></code> ;-) | ||
* unpack the sources to your build directory: <code><nowiki> tar xvzf R-<rversion>.tar.gz </nowiki></code> | * unpack the sources to your build directory: <code><nowiki> tar xvzf R-<rversion>.tar.gz </nowiki></code> | ||
* for multiple architectures it's best to have a build dir for each platform | * for multiple architectures it's best to have a build dir for each platform (separate x86 and sparc directories) | ||
* see the '''R Installation and Administration''' from CRAN document for more details | * see the '''R Installation and Administration''' from CRAN document for more details | ||
== Building == | == Building == | ||
* R must be built for each architecture individually: sparc | * R must be built for each architecture individually: i386 (32bit), amd64 (64bit) and sparc | ||
* If building a new version start on the faster one, aka. opteron, use qxterm86 to get a build machine use azteca | * If building a new version start on the faster one, aka. opteron, use qxterm86 to get a build machine or use azteca | ||
* Use qxterm for a sparc machine | * Use qxterm for a sparc machine | ||
* change to your source directory <code><nowiki> cd R-version- | * change to your source directory <code><nowiki> cd R-version-x86 </nowiki></code> | ||
=== Configure === | === Configure === | ||
Line 74: | Line 73: | ||
# If you just want to test building use a local directory | # If you just want to test building use a local directory | ||
PREFIX=/vol/r-<version> | PREFIX=/vol/r-<version> | ||
# please note: this script was tested on r-2.11 | |||
# use this per: | # use this per: | ||
PERL_PREFIX=/vol/perl-5.8.8 | PERL_PREFIX=/vol/perl-5.8.8 | ||
TCL_PREFIX=/vol/tcl-8.4.13 | TCL_PREFIX=/vol/tcl-8.4.13 | ||
CSW_PREFIX=/vol/studio-12.1 | |||
CC="cc -xc99" | CC="cc -xc99" | ||
CPPFLAGS="-I | CPPFLAGS="-I$CSW_PREFIX/include/" | ||
CPPFLAGS="$CPPFLAGS -I$TCL_PREFIX/include -I/vol/local/include -I/vol/graphics/include -I/vol/gnu/include" | CPPFLAGS="$CPPFLAGS -I$TCL_PREFIX/include -I/vol/local/include -I/vol/graphics/include -I/vol/gnu/include -I/vol/gnu/include/readline" | ||
CFLAGS="-O -xlibmieee" | CFLAGS="-O -xlibmieee" | ||
F77=f95 | F77="f95" | ||
FFLAGS=-O4 | FFLAGS=-O4 | ||
CXX=CC | CXX="CC" | ||
CXXFLAGS=-O | CXXFLAGS="-O" | ||
FC="f95 -xO2" | #R recommendation (liberal interpretation): CXXFLAGS="-O -features=tmplrefstatic" | ||
#Michi recommended: FC="f95 -xO2" | |||
FC="f95" | |||
FCFLAGS=$FFLAGS | FCFLAGS=$FFLAGS | ||
LDFLAGS="-lCstd -lCrun -L | LDFLAGS="-lCstd -lCrun -L$CSW_PREFIX/lib -R$CSW_PREFIX/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" | 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="-lCstd -lCrun -G -L$CSW_PREFIX/lib -R$CSW_PREFIX/lib" | |||
# To build a 64 bit version of R (amd64) use the following options: | |||
# Suggestion: Add an architecture dependent flag to the configure arguments, both version can afterwards be installed into the same directory. | |||
# See below for further details... | |||
#CC="cc -xc99 -m64" | |||
#CPPFLAGS="-I$CSW_PREFIX/include/" | |||
#CPPFLAGS="$CPPFLAGS -I$TCL_PREFIX/include -I/vol/local/include -I/vol/graphics/include -I/vol/gnu/include -I/vol/gnu/include/readline" | |||
#CFLAGS="-O -xlibmieee" | |||
#F77="f95 -m64" | |||
#FFLAGS=-O4 | |||
#CXX="CC -m64" | |||
#CXXFLAGS="-O" | |||
#FC="f95 -m64" | |||
#FCFLAGS=$FFLAGS | |||
#LDFLAGS="-lCstd -lCrun -L$CSW_PREFIX/lib -R$CSW_PREFIX/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/amd64 -R/vol/gnu/lib/amd64 -R$PREFIX/lib/R/library/RSPerl/libs -R$PREFIX/lib/R/bin" | |||
#SHLIB_CXXLDFLAGS="-lCstd -lCrun -G -L$CSW_PREFIX/lib -R$CSW_PREFIX/lib" | |||
export CC | |||
export CPPFLAGS | |||
export CFLAGS | |||
export F77 | |||
export FFLAGS | |||
export CXX | |||
export CXXFLAGS | |||
export FC | |||
export FCFLAGS | |||
export LDFLAGS | |||
export SHLIB_CXXLDFLAGS | |||
# to help finding gnome-config | # 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 | #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 | # use the THIS perl | ||
PATH=$PERL_PREFIX/bin:$TCL_PREFIX/bin:$PATH | #PATH=$PERL_PREFIX/bin:$TCL_PREFIX/bin:$PATH | ||
export PATH | #export PATH | ||
# Set default paper size for R | |||
R_PAPERSIZE=A4 | |||
# | export R_PAPERSIZE | ||
export | |||
# For optimal performance, the Sun Performance library (libsunperf) as part of the Studio compiler suite should be used. | |||
# But - although compilation succeeded on both x86 and amd64 - tests failed on amd64. | |||
# Maybe this is fixed in a newer version of the Sun compiler? To try out append the following two configure flags: | |||
# --with-blas=-lsunperf | |||
# --with-lapack=-lsunperf | |||
# Architecture dependent directory to build both i386 and amd64 versions of R into the same directory. | |||
# Common files are shared between both versions, while architecture dependent files will be stored in a | |||
# appropriate sub-directories | |||
r_arch="amd64" | |||
export r_arch | |||
./configure --prefix=$PREFIX \ | ./configure --prefix=$PREFIX \ | ||
--with-recommended-packages \ | |||
--with-readline \ | --with-readline \ | ||
--enable-R-shlib \ | --enable-R-shlib \ | ||
--enable-shared \ | --enable-shared \ | ||
--with-jpeglib \ | --with-jpeglib \ | ||
--with-libpng\ | --with-libpng\ | ||
--with-tcl-config=$TCL_PREFIX/lib/tclConfig.sh \ | --with-tcl-config=$TCL_PREFIX/lib/tclConfig.sh \ | ||
--with-tk-config=$TCL_PREFIX/lib/tkConfig.sh | --with-tk-config=$TCL_PREFIX/lib/tkConfig.sh | ||
Line 156: | Line 164: | ||
<pre><nowiki> | <pre><nowiki> | ||
> sh | > sh buildR.sh | ||
.... | .... | ||
Line 162: | Line 170: | ||
Source directory: . | Source directory: . | ||
Installation directory: /vol/r-2. | Installation directory: /vol/r-2.11.1 | ||
C compiler: cc -xc99 -g | C compiler: cc -xc99 -g | ||
Line 178: | Line 186: | ||
Recommended packages: yes | Recommended packages: yes | ||
azteca:~/src/r/R-2.11.1.X86> | |||
azteca:~/ | |||
</nowiki></pre> | </nowiki></pre> | ||
Revision as of 14:00, 31 May 2010
Tips how to build R and Bioconductor using the SunPro 12.1 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:
azteca~> which cc /vol/studio-12.1/bin/cc azteca:~> cc -V cc: Sun C 5.10 SunOS_i386 Patch 142363-02 2009/09/21 azteca:~> which CC /vol/studio-12.1/bin/CC azteca:~> CC -V CC: Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21 azteca:~> which f95 /vol/studio-12.1/bin/f95 azteca:~> f95 -V CC: Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21 azteca:~> uname -a SunOS azteca 5.10 Generic_142901-03 i86pc i386 i86pc 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/ or try R-latest: http://cran.r-project.org/src/base-prerelease/R-latest.tar.gz
- check the md5 sums to verify package integrity
Nope! Would be neat but no checksums provided!
;-) - 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 (separate x86 and sparc directories)
- see the R Installation and Administration from CRAN document for more details
Building
- R must be built for each architecture individually: i386 (32bit), amd64 (64bit) and sparc
- If building a new version start on the faster one, aka. opteron, use qxterm86 to get a build machine or use azteca
- Use qxterm for a sparc machine
- change to your source directory
cd R-version-x86
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> # please note: this script was tested on r-2.11 # use this per: PERL_PREFIX=/vol/perl-5.8.8 TCL_PREFIX=/vol/tcl-8.4.13 CSW_PREFIX=/vol/studio-12.1 CC="cc -xc99" CPPFLAGS="-I$CSW_PREFIX/include/" CPPFLAGS="$CPPFLAGS -I$TCL_PREFIX/include -I/vol/local/include -I/vol/graphics/include -I/vol/gnu/include -I/vol/gnu/include/readline" CFLAGS="-O -xlibmieee" F77="f95" FFLAGS=-O4 CXX="CC" CXXFLAGS="-O" #R recommendation (liberal interpretation): CXXFLAGS="-O -features=tmplrefstatic" #Michi recommended: FC="f95 -xO2" FC="f95" FCFLAGS=$FFLAGS LDFLAGS="-lCstd -lCrun -L$CSW_PREFIX/lib -R$CSW_PREFIX/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="-lCstd -lCrun -G -L$CSW_PREFIX/lib -R$CSW_PREFIX/lib" # To build a 64 bit version of R (amd64) use the following options: # Suggestion: Add an architecture dependent flag to the configure arguments, both version can afterwards be installed into the same directory. # See below for further details... #CC="cc -xc99 -m64" #CPPFLAGS="-I$CSW_PREFIX/include/" #CPPFLAGS="$CPPFLAGS -I$TCL_PREFIX/include -I/vol/local/include -I/vol/graphics/include -I/vol/gnu/include -I/vol/gnu/include/readline" #CFLAGS="-O -xlibmieee" #F77="f95 -m64" #FFLAGS=-O4 #CXX="CC -m64" #CXXFLAGS="-O" #FC="f95 -m64" #FCFLAGS=$FFLAGS #LDFLAGS="-lCstd -lCrun -L$CSW_PREFIX/lib -R$CSW_PREFIX/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/amd64 -R/vol/gnu/lib/amd64 -R$PREFIX/lib/R/library/RSPerl/libs -R$PREFIX/lib/R/bin" #SHLIB_CXXLDFLAGS="-lCstd -lCrun -G -L$CSW_PREFIX/lib -R$CSW_PREFIX/lib" export CC export CPPFLAGS export CFLAGS export F77 export FFLAGS export CXX export CXXFLAGS export FC export FCFLAGS export LDFLAGS export SHLIB_CXXLDFLAGS # 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 # Set default paper size for R R_PAPERSIZE=A4 export R_PAPERSIZE # For optimal performance, the Sun Performance library (libsunperf) as part of the Studio compiler suite should be used. # But - although compilation succeeded on both x86 and amd64 - tests failed on amd64. # Maybe this is fixed in a newer version of the Sun compiler? To try out append the following two configure flags: # --with-blas=-lsunperf # --with-lapack=-lsunperf # Architecture dependent directory to build both i386 and amd64 versions of R into the same directory. # Common files are shared between both versions, while architecture dependent files will be stored in a # appropriate sub-directories r_arch="amd64" export r_arch ./configure --prefix=$PREFIX \ --with-recommended-packages \ --with-readline \ --enable-R-shlib \ --enable-shared \ --with-jpeglib \ --with-libpng\ --with-tcl-config=$TCL_PREFIX/lib/tclConfig.sh \ --with-tk-config=$TCL_PREFIX/lib/tkConfig.sh
- run the configure script:
> sh buildR.sh .... R is now configured for i386-pc-solaris2.10 Source directory: . Installation directory: /vol/r-2.11.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 azteca:~/src/r/R-2.11.1.X86>
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
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