Build in Mac OSX

(Difference between revisions)
Jump to: navigation, search
Line 60: Line 60:
  
  
== Building CableSwig (needed for wrapITK) ==
+
== Building CableSwig (needed for WrapITK) ==
  
 
# Download CableSwig-ITK 3.20.0, http://voxel.dl.sourceforge.net/sourceforge/itk/CableSwig-ITK-3.20.0.tar.gz
 
# Download CableSwig-ITK 3.20.0, http://voxel.dl.sourceforge.net/sourceforge/itk/CableSwig-ITK-3.20.0.tar.gz
Line 74: Line 74:
  
  
== Building wrapITK (the long-lasting part) ==
+
== Building WrapITK (the long-lasting part) ==
  
# Create directory for wrapITK source
+
# Create directory for WrapITK source
 
# Go to directory and fetch sources using command 'svn checkout http://wrapitk.googlecode.com/svn/branches/maint .'
 
# Go to directory and fetch sources using command 'svn checkout http://wrapitk.googlecode.com/svn/branches/maint .'
# Create new build directory for building wrapITK
+
# Create new build directory for building WrapITK
 
# Go to build directory and issue command 'ccmake ${WRAPITK_SOURCE}'
 
# Go to build directory and issue command 'ccmake ${WRAPITK_SOURCE}'
 
# Set following settings (click 't' to toggle advanced mode on, and 'c' to configure, don't care about missing ITK_DIR error):
 
# Set following settings (click 't' to toggle advanced mode on, and 'c' to configure, don't care about missing ITK_DIR error):
Line 101: Line 101:
 
#: <code>PY_SITE_PACKAGES_PATH: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages</code>
 
#: <code>PY_SITE_PACKAGES_PATH: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages</code>
 
# Click 'c' to configure, nothing to set so click 'c' to configure again, and 'g' to generate and exit
 
# Click 'c' to configure, nothing to set so click 'c' to configure again, and 'g' to generate and exit
# Issue command 'make'. Since you have now drinked 3 cups of coffee you might not feel like having a lunch right now. Go for nice 30-60 minutes walk outside. After that you can have lunch or dinner. Then wait a while for building of wrapITK to finish. It will take about 3-5 hours.
+
# Issue command 'make'. Since you have now drinked 3 cups of coffee you might not feel like having a lunch right now. Go for nice 30-60 minutes walk outside. After that you can have lunch or dinner. Then wait a while for building of WrapITK to finish. It will take about 3-5 hours.
# Issue command 'make install' to install built wrapITK to directory defined in <code>CMAKE_INSTALL_PREFIX</code>
+
# Issue command 'make install' to install built WrapITK to directory defined in <code>CMAKE_INSTALL_PREFIX</code>
# Go into directory ${wrapITK_source}/ExternalProjects/ItkVtkGlue
+
# Go into directory ${WrapITK_source}/ExternalProjects/ItkVtkGlue
 
# Create build directory for ItkVtkGlue
 
# Create build directory for ItkVtkGlue
 
# Go to build directory and issue command 'ccmake ${ITKVTKGLUE_SOURCE}'
 
# Go to build directory and issue command 'ccmake ${ITKVTKGLUE_SOURCE}'
Line 109: Line 109:
 
#: <code>BUILD_WRAPPERS: ON</code>
 
#: <code>BUILD_WRAPPERS: ON</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
#: <code>CMAKE_INSTALL_PREFIX: Same as selected for wrapITK</code>
+
#: <code>CMAKE_INSTALL_PREFIX: Same as selected for WrapITK</code>
 
#: <code>ITK_DIR: Set to your ITK build directory</code>
 
#: <code>ITK_DIR: Set to your ITK build directory</code>
#: <code>LIBRARY_OUTPUT_PATH: Same as selected for wrapITK</code>
+
#: <code>LIBRARY_OUTPUT_PATH: Same as selected for WrapITK</code>
 
# Click 'c' to configure (don't care about possible errors) and set
 
# Click 'c' to configure (don't care about possible errors) and set
 
#: <code>VTK_DIR: Set to your VTK build directory</code>
 
#: <code>VTK_DIR: Set to your VTK build directory</code>
 +
#: <code>CableSwig_DIR: Set to your CableSwig build directory</code>
 
# Set the SWIG and PYTHON parameters as you set them for WrapITK. (In other words <code>SWIG_DIR</code>, <code>SWIG_EXECUTABLE</code>, <code>SWIG_VERSION</code>, <code>PYTHON_EXECUTABLE</code>, <code>PYTHON_INCLUDE_DIR</code>, <code>PY_SITE_PACKAGES_PATH</code>.)
 
# Set the SWIG and PYTHON parameters as you set them for WrapITK. (In other words <code>SWIG_DIR</code>, <code>SWIG_EXECUTABLE</code>, <code>SWIG_VERSION</code>, <code>PYTHON_EXECUTABLE</code>, <code>PYTHON_INCLUDE_DIR</code>, <code>PY_SITE_PACKAGES_PATH</code>.)
 
# Click 'c' to configure and set
 
# Click 'c' to configure and set
#: <code>WrapITK_DIR: Set to root directory of wrapITK sources</code>
+
#: <code>WrapITK_DIR: Set to WrapITK build directory</code>
 
# Click 'c' to configure, and 'g' to generate and exit
 
# Click 'c' to configure, and 'g' to generate and exit
 
# Issue command 'make'
 
# Issue command 'make'
Line 131: Line 132:
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
 
#: <code>CMAKE_INSTALL_PREFIX: Same as selected for VTK</code>
 
#: <code>CMAKE_INSTALL_PREFIX: Same as selected for VTK</code>
#: <code>VTK_DIR: Set to root directory of VTK sources</code>
+
#: <code>VTK_DIR: Set to your VTK build directory</code>
 
# Click 'c' to configure, 'c' to configure, and 'g' to generate and exit
 
# Click 'c' to configure, 'c' to configure, and 'g' to generate and exit
 
# Issue command 'make'
 
# Issue command 'make'
Line 140: Line 141:
 
# Set following settings (click 't' to toggle advanced mode on, and 'c' to configure, don't care about possible errors):
 
# Set following settings (click 't' to toggle advanced mode on, and 'c' to configure, don't care about possible errors):
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
#: <code>CMAKE_INSTALL_PREFIX: Same as selected for wrapITK</code>
+
#: <code>CMAKE_INSTALL_PREFIX: Same as selected for WrapITK</code>
#: <code>ITK_DIR: Set to root directory of ITK sources</code>
+
#: <code>ITK_DIR: Set to your ITK build directory</code>
#: <code>WrapITK_DIR: Set to root directory of wrapITK sources</code>
+
#: <code>WrapITK_DIR: Set to your WrapITK build directory</code>
#: <code>LIBRARY_OUTPUT_PATH: Same as selected for wrapITK</code>
+
#: <code>LIBRARY_OUTPUT_PATH: Same as selected for WrapITK</code>
 
# Click 'c' to configure, 'c' to configure and 'g' to generate and exit
 
# Click 'c' to configure, 'c' to configure and 'g' to generate and exit
 
# Issue command 'make'
 
# Issue command 'make'

Revision as of 10:02, 9 July 2012

These instructions give details how we build all necessary libraries and setup BioImageXD in Mac OSX. In some cases there might be some libraries not installed that are needed to build VTK/ITK libraries. Those errors are reported by CMake. If you cannot find correct library to install, contact info@bioimagexd.net. In most cases, only packages mentioned in prerequisites are needed. Whole process takes full day (about 8h), but gladly computer will do most of the job.

Prerequisites:

Important note:

  • The source, build and install directories should be kept separate. Mixing source, build and install files in one or two directories can result in build and/or install errors.
  • If you need to rebuild a library, clean out (remove) the build directory files and start again.


Contents

Building VTK

  1. Download VTK 5.6.1 (or newer, might work, but no guarantees), http://www.vtk.org/files/release/5.6/vtk-5.6.1.tar.gz
  2. Extract package
  3. Create new build directory for building VTK
  4. Go to build directory and issue command 'ccmake ${VTK_SOURCE}'
  5. Set following settings (click 't' to toggle advanced mode on, and 'c' to configure):
    BUILD_SHARED_LIBS: ON
    BUILD_TESTING: OFF
    CMAKE_BUILD_TYPE: Release
    CMAKE_INSTALL_PREFIX: Change to some location where you have write access if you don't have admin rights
    VTK_USE_PARALLEL: ON
    VTK_WRAP_PYTHON: ON
  6. Click 'c' to configure and set
    VTK_USE_TK: OFF
  7. If you're running a version of OS X that doesn't include Python 2.7 by default (and you have to install it separately) set the following parameters:
    PYTHON_EXECUTABLE: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
    PYTHON_INCLUDE_DIR: /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/
    PYTHON_LIBRARY: /Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
  8. Click 'c' to configure and 'g' to generate and exit
  9. Issue command 'make', get a cup of coffee and wait about 30-60 minutes for VTK to get build
  10. Set ${VTK_INSTALL_DIR}/lib/python2.7/site-packages/ to PYTHONPATH so you can install VTK correctly, if you are installing VTK outside path
  11. Issue command 'make install' to install built VTK to directory defined in CMAKE_INSTALL_PREFIX
  12. If you experience a PYTHONPATH issue when installing VTK, you can try using the command sudo python setup.py install in your build directory's Wrapping/Python sub-directory.


Building ITK

  1. Download ITK 3.20.1 (ITK 4.x.x will not work, we'll update this guide when we move to ITK 4), http://sourceforge.net/projects/itk/files/itk/3.20/InsightToolkit-3.20.1.tar.gz/download
  2. Extract package
  3. Create new build directory for building ITK
  4. Go to build directory and issue command 'ccmake ${ITK_SOURCE}'
  5. Set following settings (click 't' to toggle advanced mode on, and 'c' to configure):
    BUILD_EXAMPLES: OFF
    BUILD_SHARED_LIBS: ON
    BUILD_TESTING: OFF
    CMAKE_BUILD_TYPE: Release
    CMAKE_INSTALL_PREFIX: Change to some location where you have write access if you don't have admin rights
    ITK_USE_OPTIMIZED_REGISTRATION: ON
    ITK_USE_REVIEW: ON
    ITK_USE_REVIEW_STATISTICS: ON
  6. Click 'c' to configure (don't care about attentions) and 'g' to generate and exit
  7. Issue command 'make', get another cup of coffee and wait about 10 minutes for ITK to get build
  8. Issue command 'make install' to install built ITK to directory defined in CMAKE_INSTALL_PREFIX


Building CableSwig (needed for WrapITK)

  1. Download CableSwig-ITK 3.20.0, http://voxel.dl.sourceforge.net/sourceforge/itk/CableSwig-ITK-3.20.0.tar.gz
  2. Extract package
  3. Create new build directory for building CableSwig
  4. Go to build directory and issue command 'ccmake ${CABLESWIG_SOURCE}'
  5. Set following settings (click 't' to toggle advanced mode on, and 'c' to configure):
    CMAKE_BUILD_TYPE: Release
    CMAKE_INSTALL_PREFIX: Change to some location where you have write access if you don't have admin rights
  6. Click 'c' to configure and 'g' to generate and exit
  7. Issue command 'make', get another cup of coffee and wait about 5 minutes for CableSwig to get build
  8. Issue command 'make install' to install built CableSwig to directory defined in CMAKE_INSTALL_PREFIX


Building WrapITK (the long-lasting part)

  1. Create directory for WrapITK source
  2. Go to directory and fetch sources using command 'svn checkout http://wrapitk.googlecode.com/svn/branches/maint .'
  3. Create new build directory for building WrapITK
  4. Go to build directory and issue command 'ccmake ${WRAPITK_SOURCE}'
  5. Set following settings (click 't' to toggle advanced mode on, and 'c' to configure, don't care about missing ITK_DIR error):
    BUILD_TESTING: OFF
    CMAKE_BUILD_TYPE: Release
    CMAKE_INSTALL_PREFIX: Change to some location where you have write access if you don't have admin rights
    ITK_DIR: Set to your ITK build directory
    WRAP_double: ON
    WRAP_unsigned_char: ON
    WRAP_unsigned_long: ON
  6. Click 'c' to configure (don't care about possible errors) and set
    CableSwig_DIR: Set to your CableSwig build directory
    WRAP_ITK_PYTHON: ON
    INSTALL_WRAP_ITK_COMPATIBILITY: OFF
  7. If you needed to install SWIG to comply with the prerequisites, set the following parameters to correspond to your installed version (here 1.3.38):
    SWIG_DIR: /usr/local/share/swig/1.3.38
    SWIG_EXECUTABLE: /usr/local/bin/swig
    SWIG_VERSION: 1.3.38
  8. If you're running a version of OS X that doesn't include Python 2.7 by default (and you have to install it separately) set the following parameters:
    PYTHON_EXECUTABLE: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
    PYTHON_INCLUDE_DIR: /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/
    PY_SITE_PACKAGES_PATH: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
  9. Click 'c' to configure, nothing to set so click 'c' to configure again, and 'g' to generate and exit
  10. Issue command 'make'. Since you have now drinked 3 cups of coffee you might not feel like having a lunch right now. Go for nice 30-60 minutes walk outside. After that you can have lunch or dinner. Then wait a while for building of WrapITK to finish. It will take about 3-5 hours.
  11. Issue command 'make install' to install built WrapITK to directory defined in CMAKE_INSTALL_PREFIX
  12. Go into directory ${WrapITK_source}/ExternalProjects/ItkVtkGlue
  13. Create build directory for ItkVtkGlue
  14. Go to build directory and issue command 'ccmake ${ITKVTKGLUE_SOURCE}'
  15. Set following settings (click 't' to toggle advanced mode on, and 'c' to configure, don't care about missing ITK_DIR error):
    BUILD_WRAPPERS: ON
    CMAKE_BUILD_TYPE: Release
    CMAKE_INSTALL_PREFIX: Same as selected for WrapITK
    ITK_DIR: Set to your ITK build directory
    LIBRARY_OUTPUT_PATH: Same as selected for WrapITK
  16. Click 'c' to configure (don't care about possible errors) and set
    VTK_DIR: Set to your VTK build directory
    CableSwig_DIR: Set to your CableSwig build directory
  17. Set the SWIG and PYTHON parameters as you set them for WrapITK. (In other words SWIG_DIR, SWIG_EXECUTABLE, SWIG_VERSION, PYTHON_EXECUTABLE, PYTHON_INCLUDE_DIR, PY_SITE_PACKAGES_PATH.)
  18. Click 'c' to configure and set
    WrapITK_DIR: Set to WrapITK build directory
  19. Click 'c' to configure, and 'g' to generate and exit
  20. Issue command 'make'
  21. Issue command 'make install'


Get BioImageXD sources and build vtkBXD and itkBXD

  1. Create directory for BioImageXD sources and fetch sources using command 'svn co https://bioimagexd.svn.sourceforge.net/svnroot/bioimagexd/bioimagexd/trunk .'
  2. Go into directory ${BXD_SOURCE}/vtkBXD
  3. Create new build directory for vtkBXD
  4. Go into build directory and issue command 'ccmake ${VTKBXD_SOURCE}'
  5. Set following settings (click 't' to toggle advanced mode on, and 'c' to configure, don't care about possible errors):
    CMAKE_BUILD_TYPE: Release
    CMAKE_INSTALL_PREFIX: Same as selected for VTK
    VTK_DIR: Set to your VTK build directory
  6. Click 'c' to configure, 'c' to configure, and 'g' to generate and exit
  7. Issue command 'make'
  8. Issue command 'make install'
  9. Go into directory ${BXD_SOURCE}/itkBXD
  10. Create new build directory for itkBXD
  11. Go into build directory and issue command 'ccmake ${ITKBXD_SOURCE}'
  12. Set following settings (click 't' to toggle advanced mode on, and 'c' to configure, don't care about possible errors):
    CMAKE_BUILD_TYPE: Release
    CMAKE_INSTALL_PREFIX: Same as selected for WrapITK
    ITK_DIR: Set to your ITK build directory
    WrapITK_DIR: Set to your WrapITK build directory
    LIBRARY_OUTPUT_PATH: Same as selected for WrapITK
  13. Click 'c' to configure, 'c' to configure and 'g' to generate and exit
  14. Issue command 'make'
  15. Issue command 'make install'


Final setup

Now you can go to root of BioImageXD source and launch BioImageXD by 'python BioImageXD.py'. Depending where you installed libraries, you might need to set PYTHONPATH and/or LD_LIBRARY_PATH. You might even want to set path to your shared libraries to /etc/ld.so.conf.d if your built libs aren't in path already, and you have permission to write to /etc/ld.so.conf.d. If you don't have any additional rights and you have built BioImageXD outside any previously defined paths, you can set PYTHONPATH and LD_LIBRARY_PATH as (notice building of VTK, part 8):
PYTHONPATH=${VTK_INSTALL_PATH}/lib/python2.6/site-packages/VTK-5.6.1-py2.6.egg/:${VTK_INSTALL_PATH}/lib/python2.6/site-packages/:${WRAPITK_SOURCE}/Languages/Python/:${WRAPITK_INSTALL_PATH}/lib/InsightToolkit/WrapITK/Python
LD_LIBRARY_PATH=${VTK_INSTALL_PATH}/lib/vtk-5.6/:${VTK_INSTALL_PATH}/lib/:${ITK_INSTALL_PATH}/lib/InsightToolkit

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox