PREFACE
This page contains instructions on compiling EMAN for OS X for use on a single machine. Instructions for a distributable build, that includes all dependencies inside a single package, are here: EMAN_COMPILE_MacOS_X_for_Distribution
Building on 10.5 is highly recommended over 10.4 because of compilation problems, old version of built-in python, and less included dependencies. These instructions will only cover 10.5. Building on x86 and ppc should both be supported. For 64 bit support, either use one of the prebuilt packages or follow the instructions for distribution; getting all dependencies working correctly on 64 bit requires patches in many cases.
DEPENDENCIES TO INSTALL
- boost (1.34.1)
- cmake (2.4.8)
- fftw (2.1.5)
- gsl (1.8)
- hdf5 (1.6.6)
- jpeg (6b)
- Qt/X11 (3.3.8)
- szip (2.1)
- tiff (3.8.2)
- zlib (1.2.1)
(verisons I have used in my own builds. I have placed copies of all srcs in MacOSXBuildFiles)
Building manually is recommended over using a package manager such as fink or macports, which cause significant difficulties by compiling and linking against their own python distributions. It is preferred to use the system built-in python.
BUILDING DEPENDENCIES
CMAKE
./configure --disable-dependency-tracking --disable-static --enable-shared make sudo make install
SZIP
./configure --disable-dependency-tracking --disable-static --enable-shared make sudo make install
GSL
./configure --disable-dependency-tracking --disable-static --enable-shared make sudo make install
BOOST
./configure --with-toolset=darwin --with-libraries=python make sudo make install
JPEG
libjpeg is very old (1998) and needs much work to compile properly on a modern system. Patches from MacPorts (http://trac.macports.org/browser/trunk/dports/graphics/jpeg/files ) or download from MacOSXBuildFiles page.
for i in patch-*;do patch < $i;done
./configure --prefix=$PREFIX --disable-dependency-tracking --disable-static --enable-shared make make install
TIFF
./configure --prefix=$PREFIX --disable-dependency-tracking --disable-static --enable-shared CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" make make install
HDF5
./configure --disable-dependency-tracking --disable-static --enable-shared make sudo make install
FFTW2
./configure --enable-float --disable-fortran --disable-dependency-tracking --disable-static --enable-shared --prefix=/usr/local make sudo make install
EMAN expects srfftw.h, sfftw.h. After install, go to the include directory ( /usr/local/include ) and make these links:
ln -s fftw.h sfftw.h ln -s rfftw.h srfftw.h
Qt3/X11
This is a major pain to install... I'll finish these instructions real soon once I actually get Qt3/X11 to compile again on Mac.
If you want to skip Qt3/X11, you can turn the GUI to off in the cmake options.
BUILD EMAN
Run cmake with the EMAN source directory as the argument. Press "c" to do an initial configuration. Use default options except those below. You may need to enter advanced mode ('t' key) to set some. Note: set EMAN_INSTALL_PREFIX to your home directory, or /usr/local/EMAN, or similar. When done, press "c" again, then "g" to generate Makefiles.
BOOST_INCLUDE_PATH /usr/local/include/boost-1_34_1 BOOST_LIBRARY /usr/local/lib/libboost_python-1_34_1.dylib CMAKE_BACKWARDS_COMPATIBILITY 2.4 CMAKE_CXX_FLAGS -mmacosx-version-min=10.5 CMAKE_C_FLAGS -mmacosx-version-min=10.5 CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk CMAKE_VERBOSE_MAKEFILE ON EMAN_INSTALL_PREFIX /Users/irees/EMAN FFTW_INCLUDE_PATH /usr/local/include FFTW_LIBRARY /usr/local/lib/libfftw.dylib GSL_CBLAS_LIBRARY /usr/local/lib/libgslcblas.dylib GSL_INCLUDE_PATH /usr/local/include GSL_LIBRARY /usr/local/lib/libgsl.dylib HDF_INCLUDE_PATH /usr/local/include HDF_LIBRARY /usr/local/lib/libhdf5.dylib JPEG_LIBRARY /usr/local/lib/libjpeg.dylib PNG_INCLUDE_PATH /Developer/SDKs/MacOSX10.5.sdk/usr/X11/include/ PNG_LIBRARY /Developer/SDKs/MacOSX10.5.sdk/usr/X11/lib/libpng.dylib PYTHON_INCLUDE_PATH /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Python.framework/Versions/2.5/Headers PYTHON_LIBRARY /Developer/SDKs/MacOSX10.5.sdk/usr/lib/libpython.dylib QT_INCLUDE_DIR /usr/local/qt3/include QT_MOC_EXECUTABLE /usr/local/qt3/bin/moc QT_QT_LIBRARY /usr/local/lib/libqt.dylib QT_UIC_EXECUTABLE /usr/local/qt3/bin/uic RFFTW_LIBRARY /usr/local/lib/librfftw.dylib TIF_INCLUDE_PATH /usr/local/include TIF_LIBRARY /usr/local/lib/libtiff.dylib X11_X11_INCLUDE_PATH /Developer/SDKs/MacOSX10.5.sdk/usr/X11/include/ X11_X11_LIB /Developer/SDKs/MacOSX10.5.sdk/usr/X11/lib/libX11.dylib X11_Xext_LIB /Developer/SDKs/MacOSX10.5.sdk/usr/X11/lib/libXext.dylib X11_Xlib_INCLUDE_PATH /Developer/SDKs/MacOSX10.5.sdk/usr/X11/include/ X11_Xutil_INCLUDE_PATH /Developer/SDKs/MacOSX10.5.sdk/usr/X11/include/ Z_LIBRARY /Developer/SDKs/MacOSX10.5.sdk/usr/lib/libz.dylib
Compile and install EMAN
make make install
EMAN POST-INSTALL
Python dylib links
The python dylib loader seems to only look for .so files instead of .dylib files.
cd /Users/irees/EMAN; \ for i in *.dylib; do \ test=`echo $i | sed s/dylib/so/`; \ ln -sv $i $test; \ done;
EMAN environment variables script
Add the following to your .bashrc to add EMAN to your PATH and PYTHONPATH:
export EMANDIR=/Users/irees/EMAN export PATH=$PATH:$EMANDIR/bin export PYTHONPATH=$PYTHONPATH:$EMANDIR/lib
And .cshrc if you are a tcsh user:
setenv EMANDIR /Users/irees/EMAN set path=($path ${EMANDIR}/bin) if ( $?PYTHONPATH ) then else setenv PYTHONPATH endif setenv PYTHONPATH ${PYTHONPATH}:${EMANDIR}/lib
Contact Information
If you have any difficulties, you may email me: Ian Rees, ian.rees at bcm edu.
Enjoy.