Follow these instructions to build a basic Framework stack built with the GNU Compiler Suite on Intel Based Macs running Macintosh OS X.
To verify you currently, or correctly have installed CMake, perform the following:
If a path returns, you have CMake.
Next we need to have a complete and sane environment. Copy the following to the end of your ~/.bash_profile:
# Compiler Variables export CC=mpicc export CXX=mpicxx export F77=mpif77 export FC=mpif90 # Library location export PACKAGES_DIR=/opt/moose # Helper variables export GCC_HOME=$PACKAGES_DIR/gcc_6.2.0 export CLANG_HOME=$PACKAGES_DIR/clang_3.9.0 export MPI_HOME=$PACKAGES_DIR/mpich/mpich_3.2 export PETSC_DIR=$PACKAGES_DIR/petsc/mpich_petsc-3.7.5/clang-opt # PATH export PATH=$GCC_HOME/bin:$MPI_HOME/bin:$CLANG_HOME/bin:$PATH # JOB Count (the number of cores available on this machine) export MOOSE_JOBS=4 # Peacock specific (optional) if [ -d $PACKAGES_DIR/miniconda ]; then export PATH=$PACKAGES_DIR/miniconda/bin:$PATH export QT_API='pyside' fi
Now close all of your open terminals and re-open them. This will allow the above information to be present in your environment.
Next make sure you have an area setup to download packages and a place to build packages that need to be built. We recommend using the normal Mac ~/Downloads folder for your downloads and ~/projects/src, for your build directory. Create the build directory now:
mkdir -p ~/projects/src
Be sure you have an up to date version of Xcode Command Line tools installed. Having Xcode alone is not enough. To install (or verify) the latest version of Command Line Tools, open a terminal and run the following command:
Either a window will prompt you allowing to install command line tools, or the above command will error, explaining that you already have command line tools.
Because Apple does not include a Fortran compiler, it will be necessary to build the GNU compiler suite. This step can be avoided if you already have a working GNU compiler suite from MacPorts, Homebrew etc...
Download the following tarball: gcc-6.2.0.tar.gz. Please note, Safari may decompress the tarball and strip the '.gz' from it automatically. So you may need to strip the '.gz' in the following instructions as well. Also note, this is a modified version of GCC. Basically, its GCC with the prereqs included in the tarball. If that is a concern to you (that this tarball is not a true GNU GCC tarball), then please proceed to the gnu.org web site and obtain a true copy of the gcc 6.2 tarball and perform the prereq steps as listed in their HOWTO. Again, the only difference with our tarball copy, is that we have performed the 'prereqs' steps, and then re-packaged the tarball. This is the same tarball that is used when building GCC in our redistributable package.
Extract the tarball, configure and build GCC
cd ~/projects/src tar -xf ~/Downloads/gcc-6.2.0.tar.gz -C . mkdir ~/projects/src/gcc-build cd ~/projects/src/gcc-build unset CC unset CXX unset FC unset F90 unset F77 ../gcc-6.2.0/configure --prefix=$GCC_HOME --disable-multilib --enable-languages=c,c++,fortran --enable-lto make -j $MOOSE_JOBS sudo -E make install
Verify you have correctly built/installed GCC by performing the following command:
If the above command does not return
/opt/moose/gcc_6.2.0/bin/g++ then something went wrong and you should not proceed until this is fixed. Otherwise it will be a wast of time...
Clang is our preferred compiler. It was necessary to build GCC so we have a Fortran compiler. There are many components that go into the building of the LLVM compiler suite. It is important the following be completed in a very specific order.
Download all the necessary bits:
Extract and move the downloaded tarballs in the very precise and following order (copying and pasting this entire code block is recommended!):
cd ~/projects/src tar -xf ~/Downloads/llvm-3.9.0.src.tar.xz -C . tar -xf ~/Downloads/cfe-3.9.0.src.tar.xz -C .; mv cfe-3.9.0.src llvm-3.9.0.src/tools/clang tar -xf ~/Downloads/clang-tools-extra-3.9.0.src.tar.xz -C .; mv clang-tools-extra-3.9.0.src llvm-3.9.0.src/tools/clang/tools/extra tar -xf ~/Downloads/compiler-rt-3.9.0.src.tar.xz -C .; mv compiler-rt-3.9.0.src llvm-3.9.0.src/projects/compiler-rt tar -xf ~/Downloads/libcxx-3.9.0.src.tar.xz -C .; mv libcxx-3.9.0.src llvm-3.9.0.src/projects/libcxx tar -xf ~/Downloads/libcxxabi-3.9.0.src.tar.xz -C .; mv libcxxabi-3.9.0.src llvm-3.9.0.src/projects/libcxxabi tar -xf ~/Downloads/openmp-3.9.0.src.tar.xz -C .; mv openmp-3.9.0.src llvm-3.9.0.src/projects/openmp
With all the packages downloaded and moved to their proper locations, we can configure LLVM:
mkdir ~/projects/src/llvm-build cd ~/projects/src/llvm-build cmake -DCMAKE_INSTALL_PREFIX=$CLANG_HOME \ -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \ -DCLANG_DEFAULT_OPENMP_RUNTIME=libomp \ -DCMAKE_BUILD_TYPE="Release" \ ../llvm-3.9.0.src
As long as no problems were detected during configure, proceed to building LLVM:
cd ~/projects/src/llvm-build make -j $MOOSE_JOBS
Sill no problems? Then proceed to installing LLVM:
cd ~/projects/src/llvm-build sudo -E make install
Verify you have correctly built/installed Clang by performing the following command:
If the above command does not return
/opt/moose/clang_3.9.0/bin/clang then something went wrong and you should not proceed until this is fixed. Otherwise it will be a wast of time...
There is one final step that needs to take place now that Clang has been installed properly. Due to Mac OSX Yosemite (and later) removing the ability for us to set DYLD_LIBRARY_PATHs, we need to create a symbolic link to the OpenMP library that was built:
sudo mkdir -p /usr/local/lib cd /usr/local/lib sudo ln -s $CLANG_HOME/lib/libomp.dylib .
We recommend compiling and using MPICH for your MPI needs.
Download mpich-3.2. Once downloaded, perform the following:
cd ~/projects/src tar -xf ~/Downloads/mpich-3.2.tar.gz -C . mkdir ~/projects/src/mpich-3.2/clang-opt cd ~/projects/src/mpich-3.2/clang-opt ../configure --prefix=$MPI_HOME --enable-shared --enable-sharedlibs=clang --enable-fast=03 \ --enable-debuginfo --enable-totalview --enable-two-level-namespace CC=clang CXX=clang++ \ FC=gfortran F77=gfortran F90='' CFLAGS='' CXXFLAGS='' FFLAGS='' FCFLAGS='' F90FLAGS='' F77FLAGS='' make -j $MOOSE_JOBS sudo -E make install
Verify you have correctly built/installed MPICH by performing the following command:
If the above command does not return
/opt/moose/mpich/mpich_3.2/bin/mpicc then something went wrong and you should not proceed until this is fixed. Otherwise it will be a wast of time...
PETSc is our preferred linear and nonlinear solver package for MOOSE. If you are on a Linux system avoid getting a package distribution of PETSc because it may not come configured the way we want. Specifically it will most likely NOT be compiled with HYPRE support and will likely be tied to a different MPI installation.
Download petsc-3.7.5.tar.gz. Once downloaded, perform the following:
tar -xf ~/Downloads/petsc-3.7.5.tar.gz -C ~/projects/src cd ~/projects/src/petsc-3.7.5
Note: If you downloaded PETSc via Safari, it is possible Safari extracted the petsc-3.7.5.tar file within it. If you receive a 'file not found error', try the same command above again, but with out the '.gz' suffix.
./configure \ --prefix=$PETSC_DIR \ --download-hypre=1 \ --with-ssl=0 \ --with-debugging=no \ --with-pic=1 \ --with-shared-libraries=1 \ --with-cc=mpicc \ --with-cxx=mpicxx \ --with-fc=mpif90 \ --download-fblaslapack=1 \ --download-metis=1 \ --download-parmetis=1 \ --download-superlu_dist=1 \ --download-mumps=1 \ --download-scalapack=1 \ CC=mpicc CXX=mpicxx FC=mpif90 F77=mpif77 F90=mpif90 \ CFLAGS='-fPIC -fopenmp' \ CXXFLAGS='-fPIC -fopenmp' \ FFLAGS='-fPIC -fopenmp' \ FCFLAGS='-fPIC -fopenmp' \ F90FLAGS='-fPIC -fopenmp' \ F77FLAGS='-fPIC -fopenmp' \ PETSC_DIR=`pwd`
Note: If you follow these instructions, know that your Python environment will change. Only follow step 6, if you would like to use Peacock, the MOOSE GUI.
Download the Miniconda installer and install it:
cd ~/projects/src curl -L -O http://mooseframework.org/source_packages/Miniconda2-4.3.11-MacOSX-x86_64.sh sudo -E bash Miniconda2-4.3.11-MacOSX-x86_64.sh -b -p $PACKAGES_DIR/miniconda export PATH=$PACKAGES_DIR/miniconda/bin:$PATH
Install the following conda applications:
sudo -E conda update conda sudo -E conda install -c idaholab python=2.7 matplotlib pandas numpy scikit-image mock scipy coverage yaml pyyaml pyqt pyflakes vtk=7.1.0 --yes
Close any running terminals (really just the one you were performing all of the above instructions from) and re-open them. This allow everything we just did, do be available for use.
That's it! We recommend that you browse your $PACKAGE_DIR directory and make sure that you see each of the library directories in there (GCC, clang, mpich, PETSc and miniconda if you choose to do Step 6). If not then you've probably done something wrong. Take a look back at the directions above and see what steps you may have missed. Otherwise you are set to continue on with Step #2 in the Getting Started Instructions