VTK on Linux

WARNING: archived page
Here are the basic steps I took to get VTK built on Linux.

Linux: Red Hat 6.1
Mesa: version 3.1 from SourceForge
VTK: version 3.1 (nightly from 3/31/00) from Kitware
Tcl/Tk: version 8.3 from scriptics.com
Python: Python-1.5.2 from python.org
Java: JDK 1.2.2 from Sun

To configure VTK, I did:

% setenv CXX /usr/bin/c++
% setenv CC /usr/bin/cc

where:
[heiland@patterns]# which cc
/usr/bin/cc
[heiland@patterns]# which c++
/usr/bin/c++

[heiland@patterns]# ll /usr/bin/cc
lrwxrwxrwx   1 root     root            3 Jan 29 14:39 /usr/bin/cc -> gcc*
[heiland@patterns]# ll /usr/bin/c++
-rwxr-xr-x   2 root     root        65996 Sep  8  1999 /usr/bin/c++*

[heiland@patterns]# cc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
[heiland@patterns]# c++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

and then configured as shown here from config.status:
#! /bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host patterns:
#
# ./configure  --with-mesa --with-opengl --with-shared --with-tcl
--with-python --with-patented --with-contrib --with-java --with-tkwidget --with-x --with-pthreads

(Note for those copying/pasting: I inserted a carriage return in the above configure line.

Note: While this config and resulting build worked for me, it has been pointed out that others get "multiple definition" link errors when using both with-mesa and with-opengl. Leaving off with-opengl apparently corrects that situation. (I'm not sure how I got away with it, unless it was due to my dabbling in hardware accelerated GLX stuff -- utah-glx.)

The graphics libs that get built are of the following size for me:

-rwxrwxr-x   1 heiland  heiland  15991271 Apr  1 08:02 libVTKGraphics.so*
-rwxrwxr-x   1 heiland  heiland   5222612 Apr  1 09:16 libVTKGraphicsJava.so*
-rwxrwxr-x   1 heiland  heiland  21181540 Apr  1 09:43 libVTKGraphicsPython.so*
-rwxrwxr-x   1 heiland  heiland   6113786 Apr  1 08:27 libVTKGraphicsTcl.so*

And for Tcl/Tk:

#! /bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host patterns:
#
# configure  --enable-shared

After building, this generates:

-rwxrwxr-x   1 root     root       576017 Mar  7 22:07 libtcl8.3.so*

For Python (probably should have done --with-shared ??):

#! /bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host patterns:
#
# ./configure  --without-gcc

After building, this generates:

-rw-rw-r--   1 root     root      3292788 Mar  7 22:43 libpython1.5.a

For Mesa-3.1, I just did:

(root     root      9472000 Jan 30 19:21 MesaLib-3_1.tar)
./configure
make

Here's my VTK user.make and system.make. Then it's just a matter of building everything :-). Remember to set your CLASSPATH so it can find the Java classes if you're building with "--with-java".

% make

For this particular download, not all the java wrappers got compiled automatically. I had to go to the directory containing them and manually compile.


Here's an example of a compile/link for a C++ pgm:

c++ -g -O2 -fPIC -D_HP_NO_FAST_MACROS -DHAVE_LIMITS_H -DHAVE_UNISTD_H -I. -I. -I/usr/packages/Mesa-3.1/include -DVTK_USE_MESA -I/usr/X11R6/include -I./../../common -I./../../common/examplesCxx -I./.. -I./../../imaging -c Mace.cxx -o Mace.o

c++ -o Mace -g -O2 -fPIC -D_HP_NO_FAST_MACROS -DHAVE_LIMITS_H -DHAVE_UNISTD_H -I. -I. -I/usr/packages/Mesa-3.1/include -DVTK_USE_MESA -I/usr/X11R6/include -I./../../common -I./../../common/examplesCxx -I./.. -I./../../imaging Mace.o ../../patented/libVTKPatented.so ../../imaging/libVTKImaging.so ../../graphics/libVTKGraphics.so ../../common/libVTKCommon.so -L/usr/X11R6/lib -L/usr/X11R6/lib /usr/lib/libGL.so.1 /usr/packages/Mesa-3.1/src/OSmesa/osmesa.lo -ldl \ -L/usr/X11R6/lib -lXext -lXt -lSM -lICE -lX11 -lm