Install third-party software

Required software:

  • Compiler with full C++-17 support
    • gcc >= 8
    • clang >= 7
  • cmake >= 3.14
  • gsl >= 1.15 (GNU scientific library)
  • fftw3 >= 3.3.1
  • libtiff >=4.0.2
  • libcerf >=1.14 (complex error function, maintained by us)
  • python3 python3-dev
  • python3-build python3-setuptools python3-wheel python3-numpy python3-matplotlib
  • python3-lmfit (optional, for some fit scripts)
  • boost >= 1.65 (see note below)
  • Qt5 >=5.5.1 (required modules are listed below)

From libboost, we need the library components iostreams and program_options. Internally, the CMake command to find boost::iostreams may add a dependence on boost::regex. Furthermore, we need a number of header-only components, including algorithm/string, bimap, geometry, numeric/interval, polymorphic_cast.

Recommended software:

  • For generating a man page:
    • perl
  • For Matplotlib usetex mode:
    • texlive-latex-extra (and dependencies)
    • dvipng
    • cm-super-minimal

All these can be easily installed on most Linux distributions using the system’s package manager. Below are a few examples for several selected operating systems. Please note, that other distributions (Fedora, Mint, etc) may have different commands for invoking the package manager and slightly different names of packages (like boost instead of libboost etc). Besides that, the installation should be very similar.

Debian / Ubuntu / …

Install required packages:

$ sudo apt-get install build-essential git cmake \
  libgsl-dev libfftw3-dev libtiff5-dev \
  python3 python3-dev python3-numpy python3-matplotlib python3-lmfit \
  libboost-dev libboost-iostreams-dev \
  libboost-program-options-dev libboost-regex-dev \
  qt5-default libqt5designercomponents5 qttools5-dev \
  libqt5svg5-dev libqt5opengl5-dev

OpenSuse

Install required packages:

$ sudo zypper install gcc-c++ git-core cmake gsl-devel \
  libboost_*-devel fftw3-devel python3-devel python3-numpy-devel \
  python3-matplotlib python3-lmfit libtiff-devel \
  libqt5-qtbase-devel libqt5-qttools-devel libqt5-qtsvg-devel

CentOS

CentOS 7 and Redhat 7 ship with gcc-4.8.5, which does not fully support C++ 14. This instruction thus also explains how to get a newer compiler on your system.

Install extra packages:

$ sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install BornAgain dependencies:

$ sudo yum -y install make cmake3 gcc-c++
$ sudo yum -y install fftw-devel boost-devel gsl-devel libtiff-devel
$ sudo yum -y install python3-devel numpy
$ sudo yum -y install qt5-qtbase-devel qt5-qttools-devel qt5-qtsvg-devel

Install ‘devtoolset’ with additional development tools. See Devtoolset-4 for more details.

$ sudo yum install centos-release-scl  # if you are on CentOS
or
$ sudo yum-config-manager –enable rhel-server-rhscl-7-rpms # if you are on RHEL

Install newer compiler:

$ sudo yum install devtoolset-4-gcc-c++

Enable the new compiler (you will have to run this command for every new terminal):

$ scl enable devtoolset-4 bash

Make sure, that gcc gives you version 9.0 or higher:

$ g++ –version

MacOS

MacOS comes with no package manager, but fortunately there are several free and well maintained package managers that significantly simplify the installation of third-party open-source software. Here, we provide recepies for Homebrew and MacPorts.

Homebrew

Note: Homebrew installs all packages in

/usr/local
, while MacPorts prefers the
/opt/local
folder. Depending on your package manager selection, the corresponding path has to be specified explicitly during the BornAgain CMake configuration as explained in the build instructions.

Install Homebrew as explained here and then install all BornAgain dependencies by running the following commands:

brew install git cmake fftw gsl python boost libtiff qt5
pip3 install matplotlib numpy

Finally, add Qt to your path environment variable:

export PATH=/usr/local/opt/qt5/bin/:$PATH

Macports

Install Macports by downloading and running the installer from here. Then install all BornAgain dependencies by running the following command:

sudo port install git cmake fftw-3 gsl py3-matplotlib py3-numpy\
 py3-lmfit tiff boost qt5-mac

Minimal Qt installation via command line

The Qt framework with arbitrary components can be installed via command line. To perform a minimal installation, first download a Qt installer for the platform from the official website.

Remember to set up a Qt account beforehand; this is required for any installation.

Define the following variables:

  • Path to the downloaded Qt installer
    qt_installer='/path/to/Qt-installer'
    
  • Root path for Qt installation
    qt_root='/Qt/installation/path'
    
  • Qt credentials
    qt_email='myemail@some.org'
    qt_passw='myPassWord'
    

For a minimal Qt installation (only the components for gcc 64bit), use

$qt_installer --root "$qt_root" --email "$qt_email" --pw "$qt_passw" \
  --auto-answer telemetry-question=No,AssociateCommonFiletypes=No --accept-licenses \
  --no-default-installations install qt.qt6.623.gcc_64

where qt.qt6.623.gcc_64 is the name of the component to install.

Note that during the installation some questions must be answered (e.g. with Accept or Yes).

For searching Qt components (e.g. search for Qt6 components qt.qt6), use

$qt_installer --email "$qt_email" --pw "$qt_passw" search qt.qt6

After the installation, under the Qt root directory one finds the detailed installation log, InstallationLog.txt, and Qt maintenance tool, MaintenanceTool.

Qt maintenance tool can be used to remove or update components; e.g. for removing Qt Creator, use

$qt_root/MaintenanceTool remove qt.tools.qtcreator

For further information, see the official guide to the Qt-installer command-line interface: