2. Configuring and Building Packages

Compilation of SMR packages requires a number of system packages to be installed before launching the build process, see sections Build with cmake and Python3 and Build with autotools and Python2. SMR packages do not require to be built with admin privileges. However, system packages installation may require admin privileges

The following environment variables are referred to in this chapter and are also checked by the cmake scripts:

  • SMR_SRC: Path to the directory containing all packages checked out from the git repository. Required for package doc build. Example (bash shell):

    export SMR_SRC=$HOME/src/git
    
  • SMR_PREFIX: Path to the installation directory (“prefix” directory). In a virtual environment SMR_PREFIX``=``VIRTUAL_ENV. $VIRTUAL_ENV is defined by the virtual environment activation script (see Python Virtual Environments).

  • SMR_CMAKEMODULES: Path to the CMakeModules directory as checked out from CmakeModules.git Example (bash shell):

    export SMR_CMAKEMODULES=$SMR_SRC/CMakeModules
    

The cmake scripts will recognize SMR_PREFIX and SMR_CMAKEMODULES. Thus, to configure a package and compile and install it:

  1. Create a build directory and go to that build directory. Example: Compile MemCom (package memcom):

    mkdir -p $HOME/_build/memcom
    cd $HOME/build/memcom
    
  2. Configure and build with make:

    cmake $SMR_SRC/memcom
    make # or make -j njobs
    make install
    

2.1. Build with cmake and Python3

All third party installation package instruction examples listed in this chapter pertain to the Ubuntu (Debian) distribution’s installation tools. Third party packages names listed herein are Ubuntu package names. The test environment is Ubuntu 20.04.

It is heavily recommended to build packages in a Python Virtual environment, see Python Virtual Environment for SMR Packages.

2.1.1. System packages

Please install all system packages as described in Ubuntu 18+.

Install all required Python modules in your virtual environment (see Python Virtual Environments).

Install the following 3rd party packages system wide:

sudo apt-get install python3 python3-dev swig flex bison gfortran m4 \
autoconf automake autotools-dev libtool openssh-server libxpm-dev \
libnlopt-dev liblapack-dev libarpack2-dev libatlas-base-dev libtbb-dev \
libssl-dev libmpfr-dev \
libmumps libmumps-dev libmumps-seq libmumps-seq-dev \
libscotch-dev libptscotch-dev libmumps-scotch-dev libmumps-ptscotch \
libpangocairo-1.0-0 libgirepository1.0-dev libmumps-seq-dev \
libmumps-seq-5.2.1

The MUMPS``packages should install ``openmpi. If not install

sudo apt-get install openmpi-bin openmpi-common openssh-client \
openssh-server libopenmpi1.10 libopenmpi-dev

2.1.2. Build

All Python3 packages are built with cmake. Unless package-specific build options are required, The command is (in a virtual environment):

cmake -DCMAKE_INSTALL_PREFIX=$VIRTUAL_ENV \
      -DCMAKE_MODULE_PATH=<src>/CMakeModules<src>/<package>

2.2. Build with autotools and Python2

Prior to any build process please make sure that all system packages are installed under your distribution. Refer to Chapter Distribution Specific Information.

All third party installation package instructions listed in this chapter pertain to Ubuntu 20.4 (Debian) installation tools. Third party packages names listed herein are Ubuntu package names.

It is heavily recommended to build packages in a python2 Virtual environment, see Install Python2 Virtual Environment.

2.2.1. System packages

Compilation and execution of the SMR python2 based packages requires a number of system packages to be installed. Install the following Debian packages for building B2000++:

sudo apt install python2 python2-dev python-numpy docbook \
docbook-xml

In addition to the above packages, install the following the Debian packages for building baspl++:

sudo apt install libgtk2.0-dev libglu1-mesa-dev freeglut3-dev \
mesa-common-dev libgl2ps-dev python-gtk2 python-gtk2-dev python-glade2 \
gtk2-engines-murrine gtk2-engines-pixbuf python-opengl

2.2.2. Build

Some python2 packages are built with cmake. Unless package-specific build options are required, The command is (in a virtual environment):

cmake -DCMAKE_INSTALL_PREFIX=$VIRTUAL_ENV \
      -DCMAKE_MODULE_PATH=<src>/CMakeModules<src>/<package>