A guide how to install source code of SPARX and EMAN2 in your home directory.

Preparation work for Mac OS

Mac OS X does not come with the C++ compiler and GNU make installed. You need to install them by yourself. Please Install Xcode which is the collection of development tools (g++, make, etc).

Download and install xcode. It will require registration as Mac developer!

Install some 3rd party libraries(fftw, etc.)

EMAN2 employs the following 3rd party libraries: fftw, gsl, boost, hdf5, jpeglib (optional), tifflib (optional). Below is a detail description of the installation process.

Please refer to the installation instruction from the NCMI lab. (http://blake.grid.bcm.edu/emanwiki/EMAN2/COMPILE_EMAN2_MAC_OS_X). Note that the download links and the installation procedures of 3rd party libraries may be changed.

This is the link to a detail version of installation. (sourcecodeinstallationsparxversion)Please note that it may not as up to date as the NCMI version.

Compiling EMAN2 on a Mac

NOTE: on multi-CPU machines all make commands can be replaced to make -j 4 where 4 is the number of CPUs available. It will significantly reduce the time of compilation.

Prerequisites

  1. Install most recent system
  2. Install all system updates ((apple)->Software update…)

  3. Install Xcode from Apple Store
  4. Install Command line tools from Xcode
    • run Xcode
    • install all updates Xcode ask for
    • old Xcode (from previous OS version) may be moved to trash (Xcode may ask for that)
    • from upper menu open Xcode->Preferences…->Downloads->Components and click button "Install" for option "Command line tools"

  5. If you are upgrading from previous version, you should also remove the old libraries to avoid strange errors:
    • Remove old EMAN2 binaries (or change the directory name)
    • Remove boost
      sudo rm -rf /usr/local/include/boost /usr/local/lib/libboost*   

Required Packages

  1. Install X11 (XQuartz-2.7.5.dmg)
  2. Install Qt4 (qt-opensource-mac-1.6.0-8-olnline.dmg)
  3. Install Boost (boost_1_56_0.tar.gz)
    ./bootstrap.sh --with-libraries=python
    ./bjam
    sudo ./bjam install
  4. Install GSL (gsl-1.15.tar.gz)
    ./configure
    make
    sudo make install
  5. Install FFTW (fftw-3.3.4.tar.gz)
    # This installs the single precision library
    ./configure --enable-shared  --enable-float
    make
    sudo make install
    
    
    # This installs the double precision library
    ./configure --enable-shared
    make
    sudo make install
  6. Install Oracle Berkeley DB (db-5.3.21.NC.tar.gz)
    cd build_unix
    ../dist/configure
    make
    sudo make install
  7. Freetype freetype-2.4.10.tar.gz)
    ./configure  --enable-shared
    make
    sudo make install
  8. Install FTGL (ftgl-2.1.3-rc5.tar.gz)
    ./configure
    make
    sudo make install
  9. Install CMake (cmake-2.8.9-Darwin64-universal.dmg)

  1. Create symlinks to png library (it allows to use png library installed along with X11)
    sudo ln -s /opt/X11/include/libpng15/*.h /usr/include
    sudo ln -s /opt/X11/lib/libpng.dylib /usr/lib

Required Python Modules

  1. Install SIP (sip-4.16.5.tar.gz)
    python configure.py
    make
    sudo make install
  2. Install PyQt4 (PyQt-mac-gpl-4.11.3.tar.gz)

    python ./configure.py --confirm-license -e QtCore -e QtGui -e QtOpenGL -q $HOME/Qt/5.4/clang_64/bin/qmake --verbose
    make
    sudo make install
  3. Install matplotlib (matplotlib-1.1.1.tar.gz)
    export CFLAGS="-I/usr/X11R6/include" (it is a bash command)
    export LDFLAGS="-L/usr/X11R6/lib/"   (it is a bash command)
    python setup.py build
    sudo python setup.py install
  4. Install bsddb3 (bsddb3-5.3.0.tar.gz)
    python setup.py build
    sudo python setup.py install
  5. Install PyOpenGL (PyOpenGL-3.0.2b2.tar.gz)
    python setup.py build
    sudo python setup.py install
  6. Install iPython (ipython-1.2.1.tar.gz)
    python setup.py build
    sudo python setup.py install
  7. Replace readline (readline-6.2.2-py2.7-macosx-10.7-intel.egg)
    sudo easy_install readline-6.2.2-py2.7-macosx-10.7-intel.egg
    sudo mv /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline_disable.so

Optional Dependencies

  1. Install HDF5 (hdf5-1.8.9.tar.gz)
    ./configure --prefix=/usr/local/
    make
    sudo make install
  2. Install jpeg (jpegsrc.v8d.tar.gz)
    ./configure
    make
    sudo make install
  3. Install tiff (tiff-3.8.2.tar.gz)
    ./configure
    make
    sudo make install

Build EMAN2 using CMake

  1. Download and unpack EMAN2 and sparx source code.

    The source code can be found at web page http://ncmi.bcm.edu/ncmi/software/counter_222/software_86, although you might need fill out a registration form. After you get the file (eman2.daily.source.tar.gz), move it to home directory and unpack it:

    tar -zxvf eman2.daily.source.tar.gz
    which would create directory EMAN2 under your home directory,
  2. Run CMake in ~/EMAN2/build directory
    cd ~/EMAN2/build
    ccmake ../src/eman2
  3. In ccmake menu do the following steps:
    • press 'c' to configure (some parameters should appear)
    • press 't' to toggle advance mode
    • set parameters:
      CMAKE_CXX_COMPILER  /usr/bin/g++ 
      CMAKE_C_COMPILER      /usr/bin/gcc 
    • press 'c' to configure (ccmake will close menu with parameters)
    • the press 'e' to return to menu with parameters
    • set the following parameters:
      BOOST_INCLUDE_PATH  /usr/local/include/boost 
      CMAKE_OSX_ARCHITECTURES  x86_64
      CMAKE_OSX_SYSROOT  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
      ENABLE_MOUNTAIN_LION  ON
      ENABLE_OPTIMIZE_MACHINE ON
    • press 'c' to configure
    • press 'g' to generate Makefiles
    • press 'q' to exit ccmake
  4. Build EMAN2
    make
    make install

Configure Shell

If you are using the bash shell, add the following lines to your .bash_profile or .bashrc file

export EMAN2DIR=$HOME/EMAN2
export PATH=${EMAN2DIR}/bin:${PATH}
export PYTHONPATH=${EMAN2DIR}/lib:${EMAN2DIR}/bin:${PYTHONPATH}

You have to restart tour terminal after that (or set these variables by hand)

Unit Tests

EMAN2 includes a unit test suite. It will help verify that all components are working correctly.

cd $EMAN2DIR/test/rt
chmod +x *.py
python ./rt.py

On my Mac 4 unit tests failed, both on Lion and Mountain Lion OS.

SourceCodeInstallation (last edited 2016-09-09 02:26:12 by penczek)