Difference between revisions of "Tutorial:Getting started: Compiling MSL with external libraries"

From MSL-Libraries
Jump to navigationJump to search
(GLPK)
(To compile GSL)
Line 110: Line 110:
 
  >cd gsl-1.14
 
  >cd gsl-1.14
 
  >make
 
  >make
  >cp .libs/libgsl.a ~/software/mslib/extlibs/
+
  >cp .libs/libgsl.a ~/software/mslib/ext_libs/
  >cp cblas/.libs/libgslcblas.a ~/software/mslib/extlibs/
+
  >cp cblas/.libs/libgslcblas.a ~/software/mslib/ext_libs/
  > cp -r gsl ~/software/mslib/extlibs/
+
  > cp -r gsl ~/software/mslib/ext_includes/
  
 
=== GLPK ===
 
=== GLPK ===

Revision as of 22:15, 29 September 2011

Certain functions of MSL require the installation of some open-source external libraries.

  • BOOST (portable C++ source libraries) [[1]]
  • GSL (GNU Scientific Library) [[2]]
  • GLPK (GNU linear programming kit) [[3]]
  • R (R statistical and graphics project) [[4]]


How to enable inclusion of the external libraries

By default MSL will be compiled without the support of the external libraries and some functionality won't be available. To include the libraries, you need to set some environmental variables.

If you use bash, add the following lines to your .bashrc

#  $MSL_GSL    set to "T" if GSL is installed or else to "F" (default)
#  $MSL_BOOST  set to "T" if BOOST is installed or else to "F" (default)
#  $MSL_GLPK   set to "T" if GLPK is installed or else to "F" (default)
#  $MSL_R  set to "T" if R is installed or else to "F" (default)
export MSL_GSL=T
export MSL_GLPK=T
export MSL_BOOST=T
export MSL_R=T
#export EXTERNAL_LIB_DIR=/usr/lib

If you use tcsh, add the following lines to your .cshrc

#  $MSL_GSL    set to "T" if GSL is installed or else to "F" (default)
#  $MSL_BOOST  set to "T" if BOOST is installed or else to "F" (default)
#  $MSL_GLPK   set to "T" if GLPK is installed or else to "F" (default)
#  $MSL_R  set to "T" if R is installed or else to "F" (default)
setenv MSL_GSL T
setenv MSL_GLPK T
setenv MSL_BOOST T
setenv MSL_R T
#setenv EXTERNAL_LIB_DIR /usr/lib

The default location of the libraries is /usr/lib. If you have installed them in a custom location set the $EXTERNAL_LIB_DIR environmental variable to the correct location.

BOOST

The following libraries from the Boost C++ Libraries are used in some MSL objects and programs

Note: if boost is included, version 1.40 (???) or later is required.

If BOOST is enabled, you should see -D__BOOST__ -DBOOST_DISABLE_THREADS in the compilation command when using make.

To Compile BOOST

>tar xzvf boost-VERSION.tar.gz
>cd boost-VERSION
>./bootstrap.sh --prefix=~/software/mslib/extlibs
>./b2
> cp ./stage/lib/libboost_*.a ~/software/mslib/extlibs/

> cp -r boost ~/software/mslib/extlibs/

GSL

The [GNU Scientific library] is required by the following objects:

If GSL is enabled, you should see -D__GSL_ in the compilation command when using make.


To compile GSL

>tar xzvf gsl-1.14.tar.gz 
>cd gsl-1.14
>make
>cp .libs/libgsl.a ~/software/mslib/ext_libs/
>cp cblas/.libs/libgslcblas.a ~/software/mslib/ext_libs/
> cp -r gsl ~/software/mslib/ext_includes/

GLPK

The GNU linear programming kit is required by the LinearProgrammingOptimization object.

If GLPK is enabled, you should see -D__GLPK__ in the compilation command when using make.

./configure --prefix=/usr/lib --disable-dl --disable-odbc --disable-mysql --enable-static --without-gmp --without-zlib
 make
 make install
 cp /usr/lib/libglpk.a MSLHOME/ext_libs/
 cp /usr/include/glpk.h MSLHOME/ext_includes/

R

The R project is used by the getDihedrals program.

If R is enabled, you should see -D__R__ in the compilation command when using make.

To Compile R

MAC OS

Install R and copy headers into MSL_EXTERNAL_INCLUDE_DIR

 cp -r /Library/Frameworks/R.framework/Resources/include/ $MSL_EXTERNAL_INCLUDE_DIR

Download Rcpp

R CMD INSTALL Rcpp_0.8.5.tar.gz
cp /Library/Frameworks/R.framework/Resources/library/Rcpp/lib/x86_64/libRcpp.a $MSL_EXTERNAL_LIB_DIR/
cp -r /Library/Frameworks/R.framework/Resources/library/Rcpp/include $MSL_EXTERNAL_INCLUDE_DIR/
R CMD INSTALL RInside_0.2.3.tar.gz
cp /Library/Frameworks/R.framework/Resources/library/RInside/lib/x86_64/libRInside.a $MSL_EXTERNAL_LIB_DIR/
cp -r /Library/Frameworks/R.framework/Resources/library/RInside/include $MSL_EXTERNAL_INCLUDE_DIR/


If the above install does not work, one can install from source here is a good resource:

http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#Quick-start
LINUX OS

Currently no success in installing these packages on a linux machine, in theory something like the below commands should work First try using the 'apt' system in linux:

sudo apt-get install r-base

If the 'apt' version is not the latest version that you need, then install latest version of R:

sudo apt-get build-dep r-base
tar xvzf R-2.11.1.tar.gz
cd R-2.11.1
./configure
make
sudo make install


Install Rcpp:

sudo /usr/local/bin/R CMD INSTALL Rcpp_0.8.5.tar.gz
cp /Library/Frameworks/R.framework/Resources/library/Rcpp/lib/x86_64/libRcpp.a $MSL_EXTERNAL_LIB_DIR/
cp -r /Library/Frameworks/R.framework/Resources/library/Rcpp/include $MSL_EXTERNAL_INCLUDE_DIR/


Install RInside:

R CMD INSTALL RInside_0.2.3.tar.gz

cp /Library/Frameworks/R.framework/Resources/library/RInside/lib/x86_64/libRInside.a $MSL_EXTERNAL_LIB_DIR/
cp -r /Library/Frameworks/R.framework/Resources/library/RInside/include $MSL_EXTERNAL_INCLUDE_DIR/
 

Copy headers into MSL_EXTERNAL_INCLUDE_DIR

 cp -r /Library/Frameworks/R.framework/Resources/include/ $MSL_EXTERNAL_INCLUDE_DIR

Back to the tutorial page