TubeTK/Build Instructions: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
 
(21 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Stand-Alone =
There are two ways of building TubeTK:


In this build format, TubeTK produces a set of libraries and command-line programs that can be used to process images from the command line and to build other applications.
* (Option 1) Slicer-Dependent Build
* (Option 2) Stand-Alone Build
 
If you are going to use TubeTK as a library for building your own C++ programs or for processing data using the command-line or scripts, it is sufficient to build TubeTK as a (Option 2) Stand-Alone Build.
 
If you want a graphical user interface (albeit to a limited subset of TubeTK's methods), you should follow the (Option 1) Slicer-Dependent Build instructions.
 
= (Option 1) Slicer-Dependent Build =
 
It uses a compiled version of Slicer to provide its dependencies. 
 
In this build format,  
# TubeTK produces a set of libraries and command-line programs that can be used to process images from the command line and to build other applications.
# TubeTK methods are available from within the Slicer application against which it is built.


This build format is tested nightly on Windows, OS X, and Linux machines.
This build format is tested nightly on Windows, OS X, and Linux machines.
Line 13: Line 26:
== Install Requirements and Options ==
== Install Requirements and Options ==


=== CMake (Requirement) ===
=== CMake ===
CMake 3.4 or greater is required.
* The Mac/Windows binaries can be downloaded from [http://cmake.org http://cmake.org]
* The linux installation from source is easiest.  Assuming an older version of cmake is already installed, and you want to install v3.4.1, do the following:
sudo apt-get build-dep cmake
sudo apt-get install libgtkmm-2.4-dev glade-gtk2 libglademm-2.4-dev
git clone http://github.com:/Kitware/CMake.git
cd CMake
git checkout v3.4.1
cd ..
mkdir CMake-Release
cd CMake-Release
cmake ../CMake -DCMAKE_BUILD_TYPE=Release
make -j8


Install the latest stable release.
=== Slicer ===
* http://www.cmake.org


=== GIT (Requirement) ===
* If you are building the Stand-Alone version of TubeTK, you do not need to build Slicer.


Install the latest stable release.
* If you are building the Slicer-Dependent version of TubeTK, you must build Slicer from source:
* Windows
** Source: http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/Build_Instructions
** http://msysgit.github.io/
* Linux
** <code> sudo apt-get install git </code>


=== Qt ===
<b>Notes:</b>
* To address the multiple dependencies required (and optional) for VTK, we recommend installing the build dependencies of ParaView prior to building Slicer:
sudo apt-get build-dep paraview


Install version 4.8.6
* Windows
** You will want the 64-bit version of Qt, which must be compiled from source.
** http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/Build_Instructions/Prerequisites/Qt#Windows_3
* Linux
** Qt is included with most versions of Linux
* Mac
** Download the installer from
*** http://download.qt.io/archive/qt/4.8/


=== Boost (optional) ===
=== Boost (optional) ===
Line 43: Line 58:
* http://www.boost.org/
* http://www.boost.org/


Oddities
<b>Notes:</b>
* Linux: TubeTK creates dynamic libraries that have static links to Boost libraries.  Since Boost static libraries on Linux are not compiled with fPIC, you must compile Boost from source to use it with TubeTK.
* Linux: TubeTK creates dynamic libraries that have static links to Boost libraries.  Since Boost static libraries on Linux are not compiled with fPIC, you must compile Boost from source to use it with TubeTK.
** <code> ./bootstrap.sh <br> </code>
** <code> ./bootstrap.sh <br> </code>
** <code> ./bjam -j14 </code>
** <code> ./bjam -j14 </code>
** <code> ./bjam cxxflags=-fPIC cflags=-fPIC -a link=static -j14 </code>
** <code> ./bjam cxxflags=-fPIC cflags=-fPIC -a link=static -j14 </code>
 
* Mac: if compiling for compatibility with older versions of MacOS, you may need to build boost using the following command:
=== Python (optional) ===
** <code> ./b2 toolset=clang cxxflags="-stdlib=libstdc++" linkflags="-stdlib=libstdc++" link=static install -a </code>
 
** Slicer and TubeTK matches its build environment with the environment used to build qmake.   This means that all code build using Slicer and TubeTK must also build using that environment. So, on some systems you will need to specify stdlib=libstdc++ (for 10.8) or stdlib-libc++ (for 10.9 and beyond).  See the comments starting in line 103 of https://github.com/Slicer/Slicer/blob/master/CMake/SlicerBlockSetCMakeOSXVariables.cmake
Versions 2.7.x is supported at this time.
 
Download and install per system instructions at:
* https://www.python.org/downloads/
** Note that python is already installed in most Linux and Mac variants.


== Download Source ==
== Download Source ==


Download the source via git
Download the source via git
git clone https://github.com/KitwareMedical/TubeTK TubeTK
* <code> git clone https://github.com/KitwareMedical/TubeTK TubeTK </code>


== Configure ==
== Configure ==


Create a directory, outside of the source directory, to hold the compilation
Create a directory, outside of the source directory, to hold the compilation
mkdir TubeTK-Release
* <code> mkdir TubeTK-Release </code>
cd TubeTK-Release
* <code> cd TubeTK-Release </code>


Within that compilation directory, run cmake and point it to where the source is located
Within that compilation directory, run cmake and point it to where the source is located. We recommend using a cmake with a GUI configuration editor.  This is the default on Windows and Mac.  On Linux (or from Mac command-line) type:
cmake ../TubeTK
* <code> cmake-gui ../TubeTK </code>
 
Set the following CMake variables
* TubeTK_USE_SLICER = On
* Slicer_DIR = <Path to your Slicer build directory>
* Linux and Mac only, also set:
** CMAKE_BUILD_TYPE = <same build type as Slicer installation: Debug or Release>


== Build ==
== Build ==
Line 75: Line 91:
=== Windows ===
=== Windows ===
Load the TubeTK solution file in Visual Studio
Load the TubeTK solution file in Visual Studio
* Select File -> Open -> Project/Solution -> open TubeTK-Release/TubeTK.sln
* <code> Select File -> Open -> Project/Solution -> open TubeTK-Release/TubeTK.sln </code>
Perform the initial build using your compiler at the top-level of TubeTK-Release.  This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
** INITIAL BUILD: Perform the initial build using the TubeTK.sln file at the top-level of TubeTK-Release.  This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
* Right click on the "ALL_BUILD" project and select "Build".
** SUBSEQUENT BUILDS: Subsequent builds <b>MUST</b> be initiated using the TubeTK.sln file in the subdir <b>TubeTK-Release/TubeTK-build</b>.  This will build TubeTK only.  You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
Subsequent builds should be initiated in the subdir TubeTK-Release/TubeTK-build to save time.  This will build TubeTK only.  You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
* Choose your build type: Release, Debug, etc.  It MUST match the build type chosen for Slicer.
* Right click on the "TubeTK" project and select "Build".
* <code> Right click on the "ALL_BUILD" project and select "Build". </code>
 
==== Linux and OS X ====
Perform the initial build using your compiler at the top-level of TubeTK-Release.  This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
cd $HOME/TubeTK-Release
make
Subsequent builds should be initiated in the subdir TubeTK-Release/TubeTK-build to save time.  This will build TubeTK only.  You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
cd $HOME/TubeTK-Release/TubeTK-build
make


= Slicer-dependent build =
=== Linux and OS X ===
* INITIAL BUILD: Perform the initial build using your compiler at the top-level of TubeTK-Release.  This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
** <code> cd TubeTK-Release </code>
** <code> make -j8 </code>
* SUBSEQUENT BUILDS: Subsequent builds <b>MUST</b> be initiated in the subdir TubeTK-Release/TubeTK-build.  This will build TubeTK only.  You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
** <code> cd TubeTK-Release/TubeTK-build </code>
** <code> make -j8 </code>


This is the recommended build process.
= (Option 2) Stand-Alone Build =


It uses a compiled version of Slicer to provide its dependencies. 
In this build format, TubeTK produces a set of libraries and command-line programs that can be used to process images from the command line and to build other applications.
 
In this build format,  
# TubeTK produces a set of libraries and command-line programs that can be used to process images from the command line and to build other applications.
# TubeTK methods are available from within the Slicer application against which it is built.


This build format is tested nightly on Windows, OS X, and Linux machines.
This build format is tested nightly on Windows, OS X, and Linux machines.
Line 109: Line 119:
== Install Requirements and Options ==
== Install Requirements and Options ==


=== Slicer (Required for Slicer-Dependent Build) ===
=== GIT ===


* If you are building the Stand-Alone version of TubeTK, you do not need to build Slicer.
Install the latest stable release.
* Windows
** http://msysgit.github.io/
* Linux
** <code> sudo apt-get install git </code>
* Mac
** git is included with MacOS


* If you are building the Slicer-Dependent version of TubeTK, you must build Slicer from source:
=== Qt ===
** Source: http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/Build_Instructions
QT version 4.8.6 or 4.8.7 is REQUIRED.
* Windows
** You will want the 64-bit version of Qt, with WebKIT support.  See details at:
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/Build_Instructions/Prerequisites/Qt#Windows_3
* Linux
** Qt is included with most versions of Linux
* Mac
** Download the installer from
*** http://download.qt.io/archive/qt/4.8/


Oddities
=== CMake ===
* There is a bug in Slicer v4.4.0 that prevents it from compiling on OSX 10.9The simple fix is pending integration into MasterYou can apply it manuallySee https://github.com/Slicer/Slicer/pull/189/files
CMake 3.0 or greater is required.
* The Mac/Windows binaries can be downloaded from http://cmake.org
* The linux installation from source is easiestAssuming an older version of cmake is already installed, and you want to install v3.4.1, do the following:
  sudo apt-get build-dep cmake
sudo apt-get install libgtkmm-2.4-dev glade-gtk2 libglademm-2.4-dev
  git clone http://github.com:/Kitware/CMake.git
cd CMake
git checkout v3.4.1
cd ..
mkdir CMake-Release
cd CMake-Release
cmake ../CMake -DCMAKE_BUILD_TYPE=Release
make -j8


=== Boost ===
=== Boost (optional) ===


Download and build Boost:
Download and build Boost:
* http://www.boost.org/
* http://www.boost.org/


Oddities
<b>Notes:</b>
* Linux: TubeTK creates dynamic libraries that have static links to Boost libraries.  Since Boost static libraries on Linux are not compiled with fPIC, you must compile Boost from source to use it with TubeTK.
* Linux: TubeTK creates dynamic libraries that have static links to Boost libraries.  Since Boost static libraries on Linux are not compiled with fPIC, you must compile Boost from source to use it with TubeTK.
** <code> ./bootstrap.sh <br> </code>
** <code> ./bootstrap.sh <br> </code>
** <code> ./bjam -j14 </code>
** <code> ./bjam -j14 </code>
** <code> ./bjam cxxflags=-fPIC cflags=-fPIC -a link=static -j14 </code>
** <code> ./bjam cxxflags=-fPIC cflags=-fPIC -a link=static -j14 </code>
=== Python (optional) ===
Versions 2.7.x is supported at this time.
Download and install per system instructions at:
* https://www.python.org/downloads/
* Windows
** Pre-compiled version of numpy, scipy, etc are available as wheels at:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
** Using these wheels is recommended over Anaconda and other installation packages, because they also include and expose versions of Qt (for example) that are incompatible with Slicer and TubeTK.
* Linux and Mac
** Python is already included with most Linux and Mac variants.


== Download Source ==
== Download Source ==
Line 136: Line 185:


== Configure ==
== Configure ==
Before starting the configuration, make sure that you have <code>virtualenv</code> installed ('''Linux Only''').
If not, just install it with :
* <code> sudo apt-get install pyton-pip </code>
* <code> pip install virtualenv </code>


Create a directory, outside of the source directory, to hold the compilation
Create a directory, outside of the source directory, to hold the compilation
Line 141: Line 197:
* <code> cd TubeTK-Release </code>
* <code> cd TubeTK-Release </code>


Within that compilation directory, run cmake and point it to where the source is located
Within that compilation directory, run cmake and point it to where the source is located. We recommend using a cmake with a GUI configuration editor.  This is the default on Windows and Mac.  On Linux (or from Mac command-line) type:
* <code> cmake ../TubeTK </code>
* <code> cmake-gui ../TubeTK </code>


Set the following CMake variables
Linux and Mac only, set the CMake variables:
* Build_TYPE = <same build type as Slicer installation: Debug or Release>
* CMAKE_BUILD_TYPE = <same build type as Slicer installation: Debug or Release>
* TubeTK_USE_SLICER = On
* Slicer_DIR = <Path to your Slicer build directory>


== Build ==
== Build ==
Line 159: Line 213:
*** <code> Right click on the "TubeTK" project and select "Build". </code>
*** <code> Right click on the "TubeTK" project and select "Build". </code>


==== Linux and OS X ====
=== Linux and OS X ===
Perform the initial build using your compiler at the top-level of TubeTK-Release.  This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
Perform the initial build using your compiler at the top-level of TubeTK-Release.  This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
* <code> cd $HOME/TubeTK-Release </code>
* <code> cd $HOME/TubeTK-Release </code>
Line 166: Line 220:
* <code> cd $HOME/TubeTK-Release/TubeTK-build </code>
* <code> cd $HOME/TubeTK-Release/TubeTK-build </code>
* <code> make </code>
* <code> make </code>
= Build Using Slicer =




[[Category:TubeTK|Build Instructions]]
[[Category:TubeTK|Build Instructions]]

Latest revision as of 12:11, 1 November 2016

There are two ways of building TubeTK:

  • (Option 1) Slicer-Dependent Build
  • (Option 2) Stand-Alone Build

If you are going to use TubeTK as a library for building your own C++ programs or for processing data using the command-line or scripts, it is sufficient to build TubeTK as a (Option 2) Stand-Alone Build.

If you want a graphical user interface (albeit to a limited subset of TubeTK's methods), you should follow the (Option 1) Slicer-Dependent Build instructions.

(Option 1) Slicer-Dependent Build

It uses a compiled version of Slicer to provide its dependencies.

In this build format,

  1. TubeTK produces a set of libraries and command-line programs that can be used to process images from the command line and to build other applications.
  2. TubeTK methods are available from within the Slicer application against which it is built.

This build format is tested nightly on Windows, OS X, and Linux machines.

This build format has the following steps:

  • Install requirements and options
  • Download source
  • Configure using CMake
  • Build

Install Requirements and Options

CMake

CMake 3.4 or greater is required.

  • The Mac/Windows binaries can be downloaded from http://cmake.org
  • The linux installation from source is easiest. Assuming an older version of cmake is already installed, and you want to install v3.4.1, do the following:
sudo apt-get build-dep cmake
sudo apt-get install libgtkmm-2.4-dev glade-gtk2 libglademm-2.4-dev
git clone http://github.com:/Kitware/CMake.git
cd CMake
git checkout v3.4.1
cd ..
mkdir CMake-Release
cd CMake-Release
cmake ../CMake -DCMAKE_BUILD_TYPE=Release
make -j8

Slicer

  • If you are building the Stand-Alone version of TubeTK, you do not need to build Slicer.

Notes:

  • To address the multiple dependencies required (and optional) for VTK, we recommend installing the build dependencies of ParaView prior to building Slicer:
sudo apt-get build-dep paraview


Boost (optional)

Download and build Boost:

Notes:

  • Linux: TubeTK creates dynamic libraries that have static links to Boost libraries. Since Boost static libraries on Linux are not compiled with fPIC, you must compile Boost from source to use it with TubeTK.
    • ./bootstrap.sh
    • ./bjam -j14
    • ./bjam cxxflags=-fPIC cflags=-fPIC -a link=static -j14
  • Mac: if compiling for compatibility with older versions of MacOS, you may need to build boost using the following command:
    • ./b2 toolset=clang cxxflags="-stdlib=libstdc++" linkflags="-stdlib=libstdc++" link=static install -a
    • Slicer and TubeTK matches its build environment with the environment used to build qmake. This means that all code build using Slicer and TubeTK must also build using that environment. So, on some systems you will need to specify stdlib=libstdc++ (for 10.8) or stdlib-libc++ (for 10.9 and beyond). See the comments starting in line 103 of https://github.com/Slicer/Slicer/blob/master/CMake/SlicerBlockSetCMakeOSXVariables.cmake

Download Source

Download the source via git

Configure

Create a directory, outside of the source directory, to hold the compilation

  • mkdir TubeTK-Release
  • cd TubeTK-Release

Within that compilation directory, run cmake and point it to where the source is located. We recommend using a cmake with a GUI configuration editor. This is the default on Windows and Mac. On Linux (or from Mac command-line) type:

  • cmake-gui ../TubeTK

Set the following CMake variables

  • TubeTK_USE_SLICER = On
  • Slicer_DIR = <Path to your Slicer build directory>
  • Linux and Mac only, also set:
    • CMAKE_BUILD_TYPE = <same build type as Slicer installation: Debug or Release>

Build

Windows

Load the TubeTK solution file in Visual Studio

  • Select File -> Open -> Project/Solution -> open TubeTK-Release/TubeTK.sln
    • INITIAL BUILD: Perform the initial build using the TubeTK.sln file at the top-level of TubeTK-Release. This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
    • SUBSEQUENT BUILDS: Subsequent builds MUST be initiated using the TubeTK.sln file in the subdir TubeTK-Release/TubeTK-build. This will build TubeTK only. You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
  • Choose your build type: Release, Debug, etc. It MUST match the build type chosen for Slicer.
  • Right click on the "ALL_BUILD" project and select "Build".

Linux and OS X

  • INITIAL BUILD: Perform the initial build using your compiler at the top-level of TubeTK-Release. This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
    • cd TubeTK-Release
    • make -j8
  • SUBSEQUENT BUILDS: Subsequent builds MUST be initiated in the subdir TubeTK-Release/TubeTK-build. This will build TubeTK only. You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
    • cd TubeTK-Release/TubeTK-build
    • make -j8

(Option 2) Stand-Alone Build

In this build format, TubeTK produces a set of libraries and command-line programs that can be used to process images from the command line and to build other applications.

This build format is tested nightly on Windows, OS X, and Linux machines.

This build format has the following steps:

  • Install requirements and options
  • Download source
  • Configure using CMake
  • Build

Install Requirements and Options

GIT

Install the latest stable release.

Qt

QT version 4.8.6 or 4.8.7 is REQUIRED.

  • Windows
    • You will want the 64-bit version of Qt, with WebKIT support. See details at:

http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/Build_Instructions/Prerequisites/Qt#Windows_3

CMake

CMake 3.0 or greater is required.

  • The Mac/Windows binaries can be downloaded from http://cmake.org
  • The linux installation from source is easiest. Assuming an older version of cmake is already installed, and you want to install v3.4.1, do the following:
sudo apt-get build-dep cmake
sudo apt-get install libgtkmm-2.4-dev glade-gtk2 libglademm-2.4-dev
git clone http://github.com:/Kitware/CMake.git
cd CMake
git checkout v3.4.1
cd ..
mkdir CMake-Release
cd CMake-Release
cmake ../CMake -DCMAKE_BUILD_TYPE=Release
make -j8

Boost (optional)

Download and build Boost:

Notes:

  • Linux: TubeTK creates dynamic libraries that have static links to Boost libraries. Since Boost static libraries on Linux are not compiled with fPIC, you must compile Boost from source to use it with TubeTK.
    • ./bootstrap.sh
    • ./bjam -j14
    • ./bjam cxxflags=-fPIC cflags=-fPIC -a link=static -j14

Python (optional)

Versions 2.7.x is supported at this time.

Download and install per system instructions at:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

    • Using these wheels is recommended over Anaconda and other installation packages, because they also include and expose versions of Qt (for example) that are incompatible with Slicer and TubeTK.
  • Linux and Mac
    • Python is already included with most Linux and Mac variants.

Download Source

Download the source via git

Configure

Before starting the configuration, make sure that you have virtualenv installed (Linux Only).

If not, just install it with :

  • sudo apt-get install pyton-pip
  • pip install virtualenv


Create a directory, outside of the source directory, to hold the compilation

  • mkdir TubeTK-Release
  • cd TubeTK-Release

Within that compilation directory, run cmake and point it to where the source is located. We recommend using a cmake with a GUI configuration editor. This is the default on Windows and Mac. On Linux (or from Mac command-line) type:

  • cmake-gui ../TubeTK

Linux and Mac only, set the CMake variables:

  • CMAKE_BUILD_TYPE = <same build type as Slicer installation: Debug or Release>

Build

Windows

Load the TubeTK solution file in Visual Studio

  • Select File -> Open -> Project/Solution -> open TubeTK-Release/TubeTK.sln
    • Perform the initial build using your compiler at the top-level of TubeTK-Release. This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
  • Right click on the "ALL_BUILD" project and select "Build".
    • Subsequent builds should be initiated in the subdir TubeTK-Release/TubeTK-build to save time. This will build TubeTK only. You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
      • Right click on the "TubeTK" project and select "Build".

Linux and OS X

Perform the initial build using your compiler at the top-level of TubeTK-Release. This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.

  • cd $HOME/TubeTK-Release
  • make

Subsequent builds should be initiated in the subdir TubeTK-Release/TubeTK-build to save time. This will build TubeTK only. You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.

  • cd $HOME/TubeTK-Release/TubeTK-build
  • make