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!
You will also need cvs command, which for some reason is gone in Mavericks.
Download http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13
- untar the file
- ./configure
- make all
- sudo make install
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
- Install most recent system
Install all system updates ((apple)->Software update…)
- Install Xcode from Apple Store
- 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"
- 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
- Install X11 (XQuartz-2.7.5.dmg)
- Install Qt4 (qt-opensource-mac-1.6.0-8-olnline.dmg)
- Install Boost (boost_1_56_0.tar.gz)
./bootstrap.sh --with-libraries=python ./bjam sudo ./bjam install
- Install GSL (gsl-1.15.tar.gz)
./configure make sudo make install
- Install FFTW (fftw-3.3.2.tar.gz)
./configure --enable-shared --enable-float make sudo make install
- Install Oracle Berkeley DB (db-5.3.21.NC.tar.gz)
cd build_unix ../dist/configure make sudo make install
- Freetype freetype-2.4.10.tar.gz)
./configure --enable-shared make sudo make install
- Install FTGL (ftgl-2.1.3-rc5.tar.gz)
./configure make sudo make install
- Install CMake (cmake-2.8.9-Darwin64-universal.dmg)
Symlinks
- 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
- Install SIP (sip-4.16.5.tar.gz)
python configure.py make sudo make install
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
- 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
- Install bsddb3 (bsddb3-5.3.0.tar.gz)
python setup.py build sudo python setup.py install
- Install PyOpenGL (PyOpenGL-3.0.2b2.tar.gz)
python setup.py build sudo python setup.py install
- Install iPython (ipython-1.2.1.tar.gz)
python setup.py build sudo python setup.py install
- 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
- Install HDF5 (hdf5-1.8.9.tar.gz)
./configure --prefix=/usr/local/ make sudo make install
- Install jpeg (jpegsrc.v8d.tar.gz)
./configure make sudo make install
- Install tiff (tiff-3.8.2.tar.gz)
./configure make sudo make install
Build EMAN2 using CMake
- 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, - Instead of downloading sources, CVS working copy may be used. In this case EMAN2 directory with subdirectories build and src must be created by hand:
mkdir ~/EMAN2 mkdir ~/EMAN2/build mkdir ~/EMAN2/src
Next, create CVS working copy at ~/EMAN2/src/eman2. - Run CMake in ~/EMAN2/build directory
cd ~/EMAN2/build ccmake ../src/eman2
- 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
- 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.
