wiki:InstallVtkStatic

Find a matching version of VTK. This is going to be important because if we already have an Ubuntu packaged version of VTK installed, then there's a strong possibility that headers and/or libraries may be read from either installation.

#On Jaunty (9.04)
## dpkg -l | grep libvtk5-dev
##ii  libvtk5-dev                                5.0.4-1.1ubuntu1
#On Hardy (8.04)
#dpkg -l | grep libvtk5-dev
##ii  libvtk5-dev                           5.0.3-1ubuntu1                                             VTK header files for building C++ code

Install cmake

sudo aptitude  install cmake 

Get and install a VTK version

## 9.04
wget http://www.vtk.org/files/release/5.0/vtk-5.0.4.tar.gz
tar xvfz vtk-5.0.4.tar.gz 
cd VTK
## We probably don't want VTK-zlib 
## To remove VTK-zlib and stuff:
ccmake -DCMAKE_INSTALL_PREFIX:PATH=${HOME}/vtk-5.0 -DVTK_USE_SYSTEM_ZLIB=ON -DVTK_USE_SYSTEM_PNG=ON -DVTK_USE_SYSTEM_JPEG=ON  .
#Select option "C" (twice) to configure and 
# then "G" to generate config files and quit

## 8.04
wget http://www.vtk.org/files/release/5.0/vtk-5.0.3.tar.gz
tar xvfz vtk-5.0.3.tar.gz
cd VTK 
## We probably don't want VTK-zlib 
## To remove VTK-zlib and stuff:
ccmake -DCMAKE_INSTALL_PREFIX:PATH=${HOME}/vtk-5.0 -DVTK_USE_SYSTEM_ZLIB=ON   .
#Select option "C" (twice) to configure and 
# then "G" to generate config files and quit

On 9.04 gcc (4.3.3) with VTK 5.0.4, I needed to alter these files (changed in later versions of VTK):

chmod u+w Utilities/DICOMParser/DICOMFile.cxx
chmod u+w Utilities/DICOMParser/DICOMParser.cxx
chmod u+w Utilities/DICOMParser/DICOMAppHelper.cxx 
# In each case edit:
#       #include <string> to #include <string.h>

Tidy up compilation area, perhaps.

cd ..
rm vtk-5.0.?.tar.gz
rm -rf VTK #Once we're sure it's built okay

Write a configuration (see r8496 for two examples).

Test it

scons compile_only=1 chaste_libs=1 exe=1 build=GccOpt static=1 apps
ldd apps/src/Chaste
#	"not a dynamic executable"
Last modified 10 years ago Last modified on Mar 29, 2010, 1:19:03 PM