Skip to content

Building Mantid on OS X 10.9 using clang and macports

Marina Ganeva edited this page May 20, 2015 · 3 revisions

Disclaimer

This instruction considers that you either use macports or need them for your other development projects. It also considers that you need to compile Mantid by yourself. In other cases please either [download a Mantid dmg package] (http://download.mantidproject.org/) or follow the instructions how to build Mantid with homebrew. Warning: it is not recommended to have both, homebrew and macports installed simultaneously on one mac.

Instruction

  1. Install Xcode and macports following the instructions on https://guide.macports.org/chunked/installing.html if needed.

  2. Install Mantid prerequisites via sudo port install package_name Mantid prerequisites can be found for example [here] (https://github.com/mantidproject/mantid/wiki/Building-Mantid-on-OS-X-10.9-&-10.10-using-clang-and-Xcode).

  3. Things to take care about:

    • By default, POCO libraries in macports are missing libCrypto and libNetSSL. If you have the POCO libraries already installed, uninstall them: sudo port uninstall poco, then install as: sudo port install poco +ssl
    • Install OpenCascade libraries as: sudo port install oce -tbb
    • libNeXus: macports do not contain libNeXus.
      1. Download the source code from the [developers website] (http://download.nexusformat.org/kits/)
      2. Build and install it:
      % ./configure --prefix=/opt/local
      % make
      % sudo make install
      
      You may need to install additional packages to be able to build libNeXus. 3. Warning: libNeXus must be recompiled after update of the macports if it's dependencies have been updated. Otherwise it may depend on some non-existent libraries.
    • jsoncpp: mantid/Code/Mantid/Framework/DataObjects/src/NoShape.cpp line 3 contains:
      #include <jsoncpp/json/json.h>
      but in macports there is no ‘jsoncpp’ folder in the /opt/local/include, json.h is located in /opt/local/include/json. As a temporary solution, you may create a symbolic link:
      % sudo mkdir /opt/local/include/jsoncpp
      % cd /opt/local/include/jsoncpp
      % sudo ln -s ../json
  4. Run cmake. It may be needed to specify the compiler as well as the path to include files. I use the following cmake options: cmake -DCMAKE_C_COMPILER=/usr/bin/clang \
    -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -G 'Unix Makefiles' \
    -DCMAKE_PREFIX_PATH=/opt/local \
    -DCMAKE_BUILD_TYPE=Release \
    -DENABLE_CPACK=True \
    -DPOCO_INCLUDE_DIR=/opt/local/include \
    -DQWTPLOT3D_INCLUDE_DIR=/opt/local/include/qwtplot3d \
    -DJSONCPP_INCLUDE_DIR=/opt/local/include \
    -DOPENCASCADE_INCLUDE_DIR=/opt/local/include/oce \
    -DPYTHON_INCLUDE_DIR=/opt/local/Library/Frameworks/Python.framework/Headers \
    -DSIP_INCLUDE_DIR=/opt/local/Library/Frameworks/Python.framework/Headers \
    -DPYTHON_NUMPY_INCLUDE_DIR=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include \
    -DPYTHON_EXECUTABLE=/opt/local/bin/python \
    -DPYLINT_EXECUTABLE=/opt/local/bin/pylint-2.7 \
    -DSPHINX_EXECUTABLE=/opt/local/bin/sphinx-build-2.7 \
    -DPACKAGE_DOCS=FALSE \
    -DDOCS_HTML=TRUE \
    -DPYQT4_PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyQt4 \
    -DSITEPACKAGES_PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages \
    -DOPENSSL_ROOT_DIR=/opt/local \
    -DMAKE_VATES=FALSE \
    -DMACPORTS=TRUE \
    -DCMAKE_INSTALL_PREFIX=path_where_to_install_mantid /path_to_repository/mantid/Code/Mantid

  5. Pay attention that packaging of the documentation is switched off. I did not manage to build it for the moment.

  6. Build mantid running make or make -j number_of_threads

  7. You may create the dmg package running the make package command

  8. You may also install Mantid using the make install command. Warning: if you do not want to install Mantid in /Applications, correct the CMAKE_INSTALL_PREFIX in the cmake_install.cmake file in your build directory.

Building VATES

Starting from Mantid 3.4, it is possible to build it with VATES support using macports.

  1. Build Paraview using the [following instruction] (http://www.mantidproject.org/Building_VATES).

  2. Set cmake option -DMAKE_VATES=TRUE

  3. Set path to the paraview build directory: -DParaView_DIR=/put_your_path_here

  4. Run steps 6-7(8) to build/install Mantid