Feel++ on MacOS

Difficulty: difficulty average average!
For beginners, you can skip this section and go directly to containers section.

Feel++ is supported on Mac OSX, starting from OS X 10.9 Mavericks to OS X 10.12 Sierra using Homebrew or MacPorts.

1. First Step: Install Xcode

Xcode is required on Mac OSX to install Feel++.

The easiest way to do so is to go through the Apple Store application and to search for Xcode. Xcode will provide the programming environment, e.g clang, for the next steps.

2. Homebrew

2.1. Introduction to HomeBrew

Homebrew is a free/open source software introduced to simplify the installation of other free/open source software on MacOS X. Homebrew is distributed under the BSD 2 Clause (NetBSD) license. For more information, visit their website.

2.1.1. Installation

To install the latest version of Homebrew, simply visit their website and follow the instructions. Each new package Homebrew installs is built into an intermediate place called the Cellar (usually /usr/local/Cellar) and then the packages are symlinked into /usr/local (default).

2.1.2. Key commands

Homebrew base command is brew. Here is a list of base available commands:

  • brew doctor: Check if the system has any problem with the current installation of Homebrew;

  • brew install mypackage: This command installs the package mypackage;

  • brew install [--devel|--HEAD] mypackage: These options respectively installs either the development version or the HEAD version of the package mypackage, if such versions are specified in the Formula file;

  • brew uninstall mypackage: This command allows to uninstall the package mypackage.

2.1.3. Formulas

A Formula is a Ruby script format specific to Homebrew. It allows to describe the installation process of a package. Feel++ uses specific Formulae that you can get in the Feel++ github repository: feelpp/homebrew-feelpp.

2.2. Installation

This section is aimed at users that do not have Homebrew already installed.
In order to build Feel++ from Homebrew, you have to do the following steps:

First install Homebrew

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

then check your Homebrew installation and fix warnings/errors if necessary

$ brew doctor

Install Homebrew-science tap to get the scientific software recommended or suggested for Feel++.

$ brew tap homebrew/homebrew-science

you should see something like

==> Tapping homebrew/science
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-science'...
remote: Counting objects: 661, done.
remote: Compressing objects: 100% (656/656), done.
remote: Total 661 (delta 0), reused 65 (delta 0), pack-reused 0
Receiving objects: 100% (661/661), 591.93 KiB | 0 bytes/s, done.
Tapped 644 formulae (680 files, 1.9M)

Next you install Feel++ tap with

brew tap feelpp/homebrew-feelpp

you should read something like

==> Tapping feelpp/feelpp
Cloning into '/usr/local/Homebrew/Library/Taps/feelpp/homebrew-feelpp'...
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 4 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
Tapped 1 formula (30 files, 60.7K)

The final step is to either install Feel++

$ brew install feelpp

or just Feel++ dependencies if you plan to build Feel++ from sources yourself

$ brew install --only-dependencies feelpp

Note If you encounter problems, you can fix them using brew doctor. A frequent issue is to force open-mpi with brew link --overwrite open-mpi

2.3. Advanced usage

If Homebrew is already installed on your system, you might want to customize your installation for the correct dependencies to be met for Feel++.

2.3.1. Feel++ Dependencies

You can browse Feel++ dependencies using the following command:

$ brew deps feelpp | column

you get the list of formulas Feel++ depends on for its installation

ann		fftw		libtool		slepc
arpack		gcc		metis		suite-sparse
autoconf	glpk		mumps		sundials
automake	gmp		netcdf		superlu
boost		gmsh		open-mpi	superlu_dist
cln		hdf5		parmetis	szip
cmake		hwloc		petsc		tbb
eigen		hypre		scalapack	veclibfort

2.3.2. Customizing builds

If you want to customize the compilation process for a dependency (Set debug mode, Remove checking steps, Remove the link with certain libraries, etc.), you can access to the building options with the info flag. For exemple, with open-mpi:

$ brew info open-mpi

You get various information about the open-mpi formula

open-mpi: stable 2.0.1 (bottled), HEAD
High performance message passing library
Conflicts with: lcdf-typetools, mpich
/usr/local/Cellar/open-mpi/2.0.1 (688 files, 8.6M) *
  Built from source on 2016-09-26 at 10:36:46 with: --c++11 --with-mpi-thread-multiple
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/open-mpi.rb
==> Dependencies
Required: libevent ✔
==> Requirements
Recommended: fortran ✔
Optional: java ✔
==> Options
    Build using C++11 mode
    Enable C++ MPI bindings (deprecated as of MPI-3.0)
    Build with java support
    Build without fortran support
    Install HEAD version

Then, you then just have to pass the needed flags, when installing the dependency.

Important: boost has to be installed with mpi and c++11 support and mumps needs to be installed with the following scotch5 support.

3. MacPorts

3.1. Introduction

MacPorts is an open-source community projet which aims to design an easy-to-use system for compiling, installing and upgrading open-source software on Mac OS X operating system. It is distributed under BSD License and facilitate the access to thousands of ports (software) without installing or compiling open-source software. MacPorts provides a single software tree which includes the latest stable releases of approximately 20000 ports targeting the current Mac OS X release (10.13). If you want more information, please visit their website.

3.1.1. MacPorts Installation

To install the latest version of MacPorts, please go to Installing MacPorts page and follow the instructions. The simplest way is to install it with the Mac OS X Installer using the pkg file provided on their website. It is recommended that you install X11 (X Window System) which is normally used to display X11 applications.
If you have installed with the package installer (MacPorts-2.x.x.pkg) that means MacPorts will be installed in /opt/local. From now on, we will suppose that macports has been installed in /opt/local which is the default MacPorts location. Note that from now on, all tools/libraries installed by MacPorts will be installed in /opt/local/.

3.1.2. Key commands

In your command-line, the software MacPorts is called by the command port. Here is a list of key commands for using MacPorts, if you want more informations please go to MacPorts Commands.

  • sudo port -v selfupdate: This action should be used regularly to update the local tree with the global MacPorts ports. The option -v enables verbose which generates verbose messages.

  • port info mypackage: This action is used to get information about a port. (description, license, maintainer, etc.)

  • sudo port install mypackage: This action install the port mypackage.

  • sudo port uninstall mypackage: This action uninstall the port mypackage.

  • port installed: This action displays all ports installed and their versions, variants and activation status. You can also use the -v option to also display the platform and CPU architecture(s) for which the ports were built, and any variants which were explicitly negated.

  • sudo port upgrade mypackage: This action updgrades installed ports and their dependencies when a Portfile in the repository has been updated. To avoid the upgrade of a port’s dependencies, use the option -n.

3.1.3. Portfile

A Portfile is a TCL script which usually contains simple keyword values and TCL expressions. Each package/port has a corresponding Portfile but it’s only a part of a port description. The Feel++ git repository provides some additional Portfiles for its compilation which are either not available in MacPorts or not adapated to Feel++ or not to the desired version. These Portfiles are installed in ports/macosx/macports-<os-version>, where <os-version> correspond to high_sierra, sierra, elcapitan, …​

3.2. Installation

To be able to install Feel++ and its dependencies, add the following line in /opt/local/etc/macports/sources.conf at the top of the file before any other sources:

file:///<path to feel++ top directory>/ports/macosx/macports-<os-version>

Once it’s done, type in a command-line:

 $ cd <your path to feel++ top directory>/ports/macosx/macports
 $ sudo portindex -f

You should have an output like this:

Creating port index in <path to feel++ top directory>/ports/macosx/macports-high_sierra
Adding port math/atlas
Adding port math/cln
Adding port math/ml
Adding port math/petsc
Adding subport petsc-devel
Adding port math/slepc
Adding port science/feelpp
Adding port science/gmsh

Total number of ports parsed:	8
Ports successfully parsed:	8
Ports failed:			0
Up-to-date ports skipped:	0

Your are now able to type

$ sudo port install feel++ +clang60 +openmpi +atlas +hdf5 +ml +mumps +hypre +parmetis +suitesparse +python36

It might take some time (possibly several hours) to compile all the requirements for Feel++.