SST Build and Install Procedures for Mac OSX using MacPorts

Warning: These instructions are outdated for recent versions of SST. Refer to current SST release instructions for up-to-date information.

Building SST using MacPorts tools on Mac OSX

With the release of Xcode 5, Apple has fully deprecated the GNU compilers that were supplied with previous versions of Xcode. Apple has instead chosen to promote the CLANG/LLVM compiler toolset for all future development. Unfortunately, certain elements of SST are incompatible with CLANG/LLVM. Until SST becomes fully compatible with the CLANG/LLVM, this guide presents an interim solution for Mac OS X users who have migrated to Xcode 5 who wish to use SST.

NOTE: MacPorts provides ports of software packages that are constantly changing, these instructions are a description of the process for specific versions. These ports may have different names and versions in the future.

NOTE: This will install not only the requested software, but also any dependencies for the requested software.

Prerequisites


Install XCode and MacPorts

XCode

Xcode is a mandatory prerequisite for MacPorts.

  1. Using the Apple App Store, install Xcode 6
  2. Run Xcode 6
  3. From within Xcode 6, select the “Xcode -> Preferences” pull-down
  4. In the pop-up window, click on “Downloads”
  5. Select the down-arrow icon in “Components -> Command Line Tools” to download and install.


MacPorts



Install Autotools using MacPorts

automake

$ sudo port install automake
$ which aclocal
/opt/local/bin/aclocal
$ which automake
/opt/local/bin/automake

autoconf

$ sudo port install autoconf
$ which autoconf
/opt/local/bin/autoconf
$ which autoheader
/opt/local/bin/autoheader
$ which autom4te
/opt/local/bin/autom4te
$ which autoreconf
/opt/local/bin/autoreconf

libtool

$ sudo port install libtool
$ which glibtool
/opt/local/bin/glibtool
$ which glibtoolize
/opt/local/bin/glibtoolize


Install GNU gcc 4.8 Compiler using MacPorts

This will be the compiler used to build SST and its dependencies.

$ sudo port install gcc48
$ sudo port select --set gcc mp-gcc48
$ sudo port select --summary
$ sudo port select --set gcc none
$ sudo port select --summary
$ which c++-mp-4.8
/opt/local/bin/c++-mp-4.8
$ which cpp-mp-4.8
/opt/local/bin/cpp-mp-4.8
$ which g++-mp-4.8
/opt/local/bin/g++-mp-4.8
$ which gcc-mp-4.8
/opt/local/bin/gcc-mp-4.8
$ which gcov-mp-4.8
/opt/local/bin/gcov-mp-4.8
$ which gfortran-mp-4.8
/opt/local/bin/gfortran-mp-4.8
$ which gcc
/opt/local/bin/gcc


Install Other Build Support Tools using MacPorts

Python 2.7

$ sudo port install python27
$ sudo port select --set python python27
$ sudo port select --summary
$ sudo port select --set python none
$ sudo port select --summary
$ which python2.7
/opt/local/bin/python2.7
$ which python
/opt/local/bin/python
$ ls -l `which python`
lrwxr-xr-x  1 root  admin  24 May 28 13:11 /opt/local/bin/python -> /opt/local/bin/python2.7

SWIG (Simplified Wrapper and Interface Generator)

$ sudo port install swig swig-python
$ which swig
/opt/local/bin/swig

SCons (software construction tool)

$ sudo port install scons
$ which scons
/opt/local/bin/scons


Install OpenMPI and Boost using MacPorts

It is important to maintain runtime library consistency in order to ensure buildability. Therefore, OpenMPI, Boost, and SST should be built with the same compiler. However, in its default configuration, MacPorts assumes that new software ports to be installed be built with the Xcode compiler. Fortunately, in certain cases, it is possible to specify an alternative compiler to MacPorts for it to use in building a new software item.

More information on MacPorts compiler selection can be found here:

Note: The repository on MacPorts is always changing to keep up with OpenMPI and Boost releases. Occasionally, some combinations of Compiler with OpenMPI and Boost may not compile correctly. If this occurs, it is recommended that the user follow the build instructions described at Detailed SST Build and Install Instructions

OpenMPI

Tailored OpenMPI installation

Install the latest default version of OpenMPI (clang)
$ sudo port install openmpi-clang
$ sudo port select --set mpi openmpi-clang-fortran
$ sudo port select --summary
$ sudo port select --set mpi none
$ sudo port select --summary
$ which mpicc
/opt/local/bin/mpicc
$ ls -l `which mpicc`
lrwxr-xr-x  1 root  admin  34 Jun 24 08:38 /opt/local/bin/mpicc -> /opt/local/bin/mpicc-openmpi-clang

$ which mpicxx
/opt/local/bin/mpicxx
$ ls -l `which mpicxx`
lrwxr-xr-x  1 root  admin  35 Jun 24 08:38 /opt/local/bin/mpicxx -> /opt/local/bin/mpicxx-openmpi-clang

$ mpicc --showme
/usr/bin/clang -I/opt/local/include/openmpi-clang -L/opt/local/lib/openmpi-clang -lmpi


Install the gcc48 (gcc 4.8) variant of OpenMPI built with the MacPorts gcc 4.8 compiler. Be sure to verify that the MacPorts gcc 4.8 compiler is installed before issuing this command.
$ sudo port install openmpi
$ sudo port select --set mpi openmpi-gcc48-fortran
$ sudo port select --summary
$ sudo port select --set mpi none
$ sudo port select --summary

$ which mpicc
/opt/local/bin/mpicc
$ ls -l `which mpicc`
lrwxr-xr-x  1 root  admin  34 May 28 15:34 /opt/local/bin/mpicc -> /opt/local/bin/mpicc-openmpi-gcc48

$ which mpicxx
/opt/local/bin/mpicxx
$ ls -l `which mpicxx`
lrwxr-xr-x  1 root  admin  35 May 28 15:34 /opt/local/bin/mpicxx -> /opt/local/bin/mpicxx-openmpi-gcc48

$ mpicc --showme
/opt/local/bin/gcc-mp-4.8 -I/opt/local/include/openmpi-gcc46 -Wl,-flat_namespace -L/opt/local/lib/openmpi-gcc48 -lmpi


Boost

Install the clang version of Boost

$ sudo port install boost
$ ls -l /opt/local/lib/libboost_mpi-mt.dylib
-rwxr-xr-x  1 root  admin  326752 May 28 15:10 /opt/local/lib/libboost_mpi-mt.dylib

Install the gcc48 (gcc 4.8) variant of Boost built with the MacPorts gcc 4.8 compiler and MacPorts OpenMPI. Be sure to verify that the MacPorts gcc 4.8 compiler is installed before issuing this command.

$ sudo port install boost +openmpi +gcc48  configure.compiler=macports-gcc-4.8
$ ls -l /opt/local/lib/libboost_mpi-mt.dylib
-rwxr-xr-x  1 root  admin  326752 May 28 15:10 /opt/local/lib/libboost_mpi-mt.dylib


MacPorts Post-Configuration

After the initial installation of MacPorts, the following environment variables will need to be adjusted to reflect the use of MacPorts software.

Environment Variables

PATH

The PATH environment variable should include the directory where the MacPorts executable software is installed. By default, this is /opt/local/bin and /opt/local/sbin. These directories should be included early in the path in order to allow MacPorts software to have a higher precedence than the equivalent Xcode versions.

Note: The PATH environment variable may have automatically been configured in the .profile, .bash_login, .bash_profile, .tcshrc, or .cshrc files when MacPorts was installed.

$ export PATH=/opt/local/bin:/opt/local/sbin:$PATH
CC

The CC environment variable should point to the MacPorts GNU gcc 4.6 C compiler, which is /opt/local/bin/gcc (The MacPorts GNU gcc 4.6 compilers are set to be the default gcc compilers via the port select... command).

$ export CC=/opt/local/bin/gcc
CXX

The CC environment variable should point to the MacPorts GNU gcc 4.6 C++ compiler, which is /opt/local/bin/g++ (The MacPorts GNU gcc 4.6 compilers are set to be the default gcc compilers via the port select... command).

$ export CXX=/opt/local/bin/g++
MPICC, MPICXX, and MPIHOME

Many components that require the MPI compiler wrappers at build time respect the setting of the MPICC, MPICXX, and MPIHOME environment variables to obtain the location of critical MPI files. Set the MPICC and MPICXX environment variables to reference the MacPorts-installed MPI executables. Set the MPIHOME environment variable to reference the location where the MPI lib and include file directories are installed.

$ export MPICC=/opt/local/bin/mpicc
$ export MPICXX=/opt/local/bin/mpicxx
$ export MPIHOME=/opt/local
ACLOCAL_FLAGS

The ACLOCAL_FLAGS environment variable should define the location of the 3rd party autoconf macros as installed by MacPorts.

$ export ACLOCAL_FLAGS="-I/opt/local/share/aclocal $ACLOCAL_FLAGS"
LD_LIBRARY_PATH and DYLD_LIBRARY_PATH

In order for the linker to resolve symbols found in MacPorts-installed dynamic libraries, set this environment variable to include the location of MacPorts libraries. Mac OSX locates .so libraries via LD_LIBRARY_PATH and .dylib libraries via DYLD_LIBRARY_PATH.

$ export LD_LIBRARY_PATH=/opt/local/lib:$LD_LIBRARY_PATH
$ export DYLD_LIBRARY_PATH=/opt/local/lib:$DYLD_LIBRARY_PATH
MANPATH

In order to access the additional manual pages provided by MacPorts, set this environment variable to reference the location of MacPorts manpage directories.

$ export MANPATH=/opt/local/man:$MANPATH


Building other SST dependencies using MacPorts toolset

Once the MacPorts software has been installed and configured, SST and its associated components can be built per the standard instructions.