Written by Ofri Sadowsky, 2003-01-15
Updated: 2003-01-22
VTK is Kitware's Visualization Toolkit, available on http://www.kitware.org/vtk.
This document describes the installation process for the VTK package on the Linux workstation 'tragus' (Red Hat Linux release 8.0 (Psyche)). As of the creation of the document, VTK did not include an RPM (RedHat Package Manager). The installation was done manually, and involved using cmake to compile the VTK source files and build the VTK libraries.
Option 1:
Download the VTK source files from http://www.vtk.org/get-software.php.
gunzip and untar the files. The tar file contains a directory VTK which includes the entire distribution. I extracted it into '/usr/local/erc-share/downloaded-src/vtk40/', and a new 'VTK' directory was created under it after opening the tar file.
Option 2:
Get the most recent cvs distribution from the VTK server.Instructions for getting the distribution are on the VTK web-site. I had it created under '/usr/local/erc-share/downloaded-src/vtk4x-cvs/' and cvs created the 'VTK' subdirectory.
Note that as of the 2003-01-22 update, the cvs version was the one used most, since the vtk-4.0 release is incompatible with the Insight-ITK release/cvs. The following instructions follow the installation from the cvs distribution. We assume that $VTK_HOME is the directory of the VTK source root.
Installing VTK uses CMake. If you don't have CMake on your system, please refer to the installation instructions in CMake.Linux.html. VTK requires installation of Tcl/Tk. RPM is available for the Tcl/Tk package for Linux.
Follow the installation instructions in ${VTK_HOME}/README.html:
> cmake -i
A
non-GUI, serial-question-answer-mode, initialization script. You
may skip it and go directly to ccmake
-i, although I believe it's a better starting-point than the
ccmake. One advantage of cmake over ccmake is, that you get to see
the complete explanation of each option, whereas ccmake only shows
you part of it. If you start with cmake, please set the options
according to the ccmake instructions as much as you can. Note that
cmake alone (without ccmake) may iterate several times and ask new
questions in each iteration. This corresponds to hitting ācā
(configure) in ccmake several times.
> ccmake
ccmake
provides a convenient console interface for the CMake options. It
is not a complete GUI, but it is possible to navigate between
options and to toggle them. Here are the most important option
settings. For the others, you may use the default.
|
Option |
Value |
|---|---|
|
CMAKE_CXX_COMPILER |
Your C++ compiler. For my case, it was g++. |
|
CMAKE_CXX_LINK_SHARED |
Typically the same as CMAKE_CXX_COMPILER. |
|
CMAKE_C_COMPILER |
Your C compiler. For my case, it was gcc. |
|
CMAKE_C_LINK_SHARED |
Typically the same as CMAKE_C_COMPILER. |
|
CMAKE_INSTALL_PREFIX |
Location where VTK binaries, etc., will be installed. For my case it was /usr/local/erc-share. |
|
CMAKE_MAKE_PROGRAM |
Your make utility. For my case it was /usr/bin/gmake. |
|
EXECUTABLE_OUTPUT_PATH |
Actual location for VTK binaries. Typically set to ${CMAKE_INSTALL_PREFIX}/bin. |
|
LIBRARY_OUTPUT_PATH |
Actual location for VTK libraries. Typically set to ${CMAKE_INSTALL_PREFIX}/lib. |
|
VTK_DATA_ROOT |
By default set to ${VTK_HOME}/../VTKData, which is where you put the VTKData package from the cvs. |
|
VTK_USE_ANSI_STDLIB |
Usually set to ON to use ANSI standard iostream library. |
|
VTK_USE_HYBRID |
Set to ON in case you plan to install other packages which rely on or make use of VTK, such as Insight-ITK. |
|
VTK_USE_PATENTED |
Set to ON when you plan to use applications that make use of the patented VTK stuff, such as some versions of slicer. |
|
VTK_WRAP_HINTS |
Location of a hints file that is used by other packages to learn about the VTK installation. Set to ${VTK_HOME}/Wrapping/hints. |
|
VTK_WRAP_TCL |
Set to ON so that Tcl/Tk wrappers for VTK examples and other programs, such as Slicer, can use VTK and Tcl/Tk together. |
> make
This
command appears in this syntax in the original installation
instructions. You may choose a different make utility. For my case,
I used gmake, which I also set as the make utility in CMake.
Note that the VTK source file may attempt to include old-fashioned C++ header file, such as the stream header files -- <iostream.h> instead of the newer standard <iostream>, possibly regardless of the VTK_USE_ANSI_STDLIB setting. g++ issues a warning in this case. This is of no great concern for the time being, but we should try to avoid it somehow.
The Makefiles have a 'clean' target for a fresh rebuild, if one is necessary.
After make or gmake is complete, VTK is ready to run.
A file named 'vtk' should be created during the build in ${EXECUTABLE_OUTPUT_PATH}. Make sure that the shell executable path environment variable contains that directory. Then you can run any Tcl example by writing
> vtk example.tcl