Difference between revisions of "Build instructions"
Line 155: | Line 155: | ||
# [http://www.itk.org ITK 2.8] | # [http://www.itk.org ITK 2.8] | ||
# [http://www.kwwidgets.org KWWidgets CVS head] | # [http://www.kwwidgets.org KWWidgets CVS head] | ||
− | # [http://teem.sf.net Teem] from http:// | + | # [http://teem.sf.net Teem] from http://svn.slicer.org/Slicer3-lib-mirrors/trunk/teem |
== Build Steps == | == Build Steps == |
Revision as of 20:14, 27 June 2008
Home < Build instructionsContents
Building Slicer3: Getting Started (All-in-One Script to Checkout)
There's a script called getbuildtest.tcl that makes the support libraries (VTK, ITK, teem, etc) and also builds slicer and does a dashboard submission. Just do the following two commands (see for Windows users below):
svn co http://svn.slicer.org/Slicer3/trunk Slicer3 ./Slicer3/Scripts/getbuildtest.tcl
Note: that a Slicer3-lib and Slicer3-build directory will be created for you. This is meant to be used to set up new machines and to run nightly testing of the full builds.
To run (all platforms):
./Slicer3-build/Slicer3
Note: the whole build environment takes about 2G of disk space.
Testing
Note also that getbuildtest will do an Experimental submission to the Slicer3 dashboard. If you want to use getbuildtest without submitting to the dashboard, you can set the test type to nothing with
getbuildtest.tcl -t ""
Other options for the -t (--test-type) option are Nightly or Continuous (or any of the CTest options).
What does getbuildtest.tcl do?
This script just automates the steps needed to build slicer. What you end up with is a set of source and build directories that can either be further manipulated with getbuildtest or can be worked with normally. That is, on windows you will have solution files that you can load in visual studio for debugging and further development.
Specifically, getbuildtest does the following steps:
- Refreshes Slicer3 svn
- Runs Scripts/genlib.tcl which does the following for each of the support libraries
- does a cvs/svn checkout/update
- runs cmake with the correct settings for use with Slicer3
- runs make (or developer studio) to build the libraries
- Runs cmake on Slicer3
- Builds Slicer3
- Runs ctest on Slicer3
- (optionally) Runs CPack on Slicer3
Usage
Usage:
usage: getbuildtest [options] [target] [target] is determined automatically if not specified [options] is one of the following: --help : prints this message and exits --clean : delete lib and build directories first -t --test-type : CTest test target --release : compile with optimization flags --update : does a cvs/svn update on each lib --pack : builds a distribution package (cpack)
Errors from getbuildtest
You will need to have your firewall configured to allow access to na-mic.org for cvs access through port 2401. Also you need 8081 for submitting to the dashboard.
Other errors might mean you don't have all the build tools (see next section).
If you want to generate a log of the build process, you can use a command like the following:
# for csh/tcsh: ./Scripts/getbuildtest.tcl |& tee build.log
or
# for sh/bash: ./Scripts/getbuildtest.tcl 2>&1 | tee build.log
Updating Your getbuildtest Build
There are a few options:
- you can re-run getbuildtest and it will update slicer3 and rebuild (just slicer3)
- you can add the --update option and all the libs will get a cvs/svn update and will rebuild if needed (good for tracking the development head of VTK/ITK/KWWidgets etc).
- you can just 'svn update' in the Slicer3 directory and then do 'make' in the Slicer3-build to get just the latest Slicer3 code.
The following command for unix machines will update, build, and launch the latest Slicer3:
svn update && (cd ../Slicer3-build; make && ./bin/Slicer3)
getbuildtest on linux
To compile slicer and do development, be sure you have a complete set of development packages installed on your machine. The exact packages vary by distribution, but include:
- gcc
- gcc-c++
- libX11
- libX11-devel
- libXt-devel
Also, be sure you have OpenGL and the GLX extension to X working. To check the installation, it is usually enough to confirm that the command
glxgears
runs with no errors.
getbuildtest on windows
While still experimental, the script should also work on a properly configured windows environment. Current requirements are:
- Developer studio 8 Visual C++ Express which is free from Microsoft - be sure to install the Platform SDK and follow the ridiculous manual steps to set up the paths see below.
- Other releases of visual studio also work (7 and 7.1)
- If they are installed in the default locations in "c:/Program Files" they will be detected by the build script automatically
- Cygwin with the following packages
- tcltk
- svn
- cvs
- unzip
- curl
- With Developers Studio and cygwin installed, you only need to do the svn checkout and getbuildtest script to get a fully working Slicer3 plus all the tools you need to develop new code.
configuration options
The file Slicer3/slicer_variables.tcl includes configuration options for which support libraries to use. You may want to change thes for testing or to get access to new functionality.
set ::SLICER_TAG "http://svn.slicer.org/Slicer3/trunk" set ::CMAKE_TAG "CMake-2-4-2" set ::TEEM_TAG "Teem-1-9-0-patches" set ::KWWidgets_TAG "HEAD" set ::VTK_TAG "VTK-5-0" set ::ITK_TAG ITK-3-0 set ::TCL_TAG "core-8-4-6" set ::TK_TAG "core-8-4-6" set ::ITCL_TAG "itcl-3-2-1" set ::IWIDGETS_TAG "iwidgets-4-0-1" set ::BLT_TAG "blt24z" set ::SANDBOX_TAG "http://svn.na-mic.org/svn/NAMICSandBox/branches/Slicer-2-6"
For example, you may want a build against the ITK cvs head. Change the flag value and then run
getbuildtest.tcl --update
which will get the version from cvs, build it, and rebuild slicer3. Depending on how radically different the versions you build are, you may need to use --clean.
Another useful option is to change your build type to include support debugging.
set ::VTK_BUILD_TYPE "RelWithDebInfo"
options are Debug, Release, or RelWithDebInfo. RelWithDebInfo is a compromise between speed and debuggability. If you are tracking down a tough C++ bug you will get better information in Debug mode. After changing this flag, you should run
getbuildtest.tcl --clean
to create a completely new build.
Manual checkout/build of Slicer3 and support libraries:
Note: this method is not recommended for most users. The build script described above is updated with software versions and compile options that are known to work well together and build on all platforms. The information below may not always be as up to date as the contents of the build script.
Prerequisite software
You need to get and build the following packages if you aren't using the getbuildtest script:
- CMake (2.4.1 or later)
- Tcl/Tk (8.4 or later)
- incrTcl (3.2.1)
- VTK 5.0
- ITK 2.8
- KWWidgets CVS head
- Teem from http://svn.slicer.org/Slicer3-lib-mirrors/trunk/teem
Build Steps
Steps:
$ svn co http://www.na-mic.org/svn/Slicer3/trunk Slicer3 $ cvs -d :pserver:anoncvs@www.vtk.org:/cvsroot/VTK co VTK $ cvs -d :pserver:anoncvs@www.itk.org:/cvsroot/Insight co Insight $ cvs -d :pserver:anoncvs@www.kwwidgets.org:/cvsroot/KWWidgets co KWWidgets
You may choose to take VTK5 instead of VTK CVS
Configure and build ITK
- BUILD_SHARED_LIBS ON
- CMAKE_SKIP_RPATH ON
Configure and build VTK
- All systems:
- BUILD_SHARED_LIBS ON
- CMAKE_SKIP_RPATH ON
- VTK_WRAP_TCL ON
- VTK_DEBUG_LEAKS ON
- MacOSX specific (Make sure to install X11):
- VTK_USE_CARBON OFF
- VTK_USE_X ON
- Note, those options should not appear, since they disapear since VTK5:
- VTK_USE_HYBRID ON
- VTK_USE_PATENTED ON
- Make sure that the TCL and TK path are set properly
- TCL_* and TK_*
Configure and build KWWidgets
- You need to specify where your VTK build tree is.
- BUILD_SHARED_LIBS ON
- CMAKE_SKIP_RPATH ON
Build and Run Slicer3
Manually
- Check out and build slicer3 (e.g. on linux)
svn co http://www.na-mic.org/svn/Slicer3/trunk Slicer3 mkdir Slicer3-build cd Slicer3-build ccmake ../Slicer3 make
Again make sure to turn:
- BUILD_SHARED_LIBS ON
- CMAKE_SKIP_RPATH ON
Start slicer with the Slicer3Launcher executable in your bin directory.
Links
- http://www.na-mic.org/Wiki/index.php/Slicer3
- http://www.na-mic.org/websvn/listing.php?repname=Slicer3
- Howto integrate Slicer3 into Eclipse
Information on Free Microsoft C++ Compiler on Windows
Be sure to follow all the steps on Microsoft link. Yes it means you need to download the compiler and sdk.