VTK for OVT page


On October 11, 2003 we have submitted the vtk 4.3.0 port for FreeBSD (ports/57858).
The port is available here.
To install port:
$ cd /usr/ports
$ sh /path/to/vtk-4.3.0-port.sh
This will create /usr/ports/graphics/vtk*.
$ cd graphics/vtk-java
$ make install -DWITH_TESTING
This will insall java bindings to vtk.

This page is created to assist people using OVT and VTK with Java support. I present notes from my personal experience with building VTK on different platforms. All the information will concern VTK releases 2.4 and 3.12.

Main links are
General tips
Some system specific notes:

FreeBSD i386

There is a VTK port under FreeBSD ports tree, but unfortunately it is not compiling with Java support. I used FreeBSD 4.1.1 RELEASE, jdk1.1.8 and TYA-1.7 JIT.

Main steps to sucess are:

Compile static Mesa libs

This is requrired to do because of thread problems with Mesa library. So, compile static Mesa libs with disabled thread support.

Fix configure

One should edit configure so it will generate THREAD_LIBS="-pthread"
to handle pthreads. Run
perl -pi -e 's|-lpthread|-pthread|g configure

Fix vtkJavaUtil

VTK 2.4 requres some changes to handle pthreads. This code is alredy included in VTK 3.x. One can use patch:

     static void vtk_release_mutex() {
         if (release_lock(&vtkGlobalMutex) < 0)
             perror("releasing mutex");
     }
     #define VTK_GET_MUTEX()  vtk_get_mutex()
     #define VTK_RELEASE_MUTEX() vtk_release_mutex()
     
     // Starts here ...
     
     #elif defined(__FreeBSD__) || defined(__linux__) || defined(sgi)
     #define USE_PTHREADS
     #ifdef USE_PTHREADS
     #include <pthread.h>
     pthread_mutex_t vtkGlobalMutex;
     #define VTK_GET_MUTEX()  pthread_mutex_lock(&vtkGlobalMutex)
     #define VTK_RELEASE_MUTEX() pthread_mutex_unlock(&vtkGlobalMutex)
     #endif
     
     // Ends here
     
     #else
     // for solaris
     #include 
     #include 
Edit user.make
     MESA_INCLUDE=-I${X11BASE}/include
     MESA_LIB= /somwhere/libMesaGL.a /somwhere/libMesaGLU.a -lXt 

     # Add additional CFLAGS and CXXFLAGS for compilation
     # uncomment the following two lines to set your own flags
     USER_CFLAGS =  -O2 -D__NO_MATH_INLINES -D_THREAD_SAFE
     USER_CXXFLAGS = -O2 -D__NO_MATH_INLINES -D_THREAD_SAFE

     # if you want to try the java support you'll need to set the following
     # variables to match your environment and uncomment them
     #
     CLASSPATH=${CLASSPATH}:${VTK_OBJ}/java/
     JDKHOME=$(PREFIX)/jdk1.1.8
     JAVAC=$(LOCALBASE)/bin/jikes -classpath $(PREFIX)/jdk1.1.8/lib/classes.zip:${VTK_OBJ}/java
     # files .class will be placed here. To get access
     JAVA_CLASS_HOME=$(PREFIX)/vtk
     JAVAH=${JDKHOME}/bin/javah
     JAVA_INCLUDES=-I${JDKHOME}/include -I${JDKHOME}/include/freebsd
     JAVA_CXX_LIB=-L /usr/lib -thread -lstdc++ -lgcc    
Create jar file

Check if all the *.slass files are in VTK_DIR/vtk. Then run jar cf vtk312.jar vtk

(top)


Solaris

Solaris x86

We used Solaris 2.6, GCC 2.8 and Mesa. All compiled and worked fine.

Solaris Sparc

g++ 2.95.2 complains about NON ANSI things in /usr/openwin/include. Workaround is: change -I/usr/openwin/include to -isystem /usr/openwin/include

Here are the build instructions for Solaris 8 SPARC with WS C++ 5.0.

(top)


Linux

There should be VTK RPMs available on the net, but if you have SEGMENTATION VIOLATION recompile everything yourself in way similar to FreeBSD

(top)


Copyright © 2000, OVT Team. All rights reserved.
Maintained by Yuri Khotyaintsev (yuri@irfu.se)


last modified on

Valid HTML 4.0!