$ cd /usr/ports $ sh /path/to/vtk-4.3.0-port.shThis will create /usr/ports/graphics/vtk*.
$ cd graphics/vtk-java $ make install -DWITH_TESTINGThis 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.
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:
This is requrired to do because of thread problems with Mesa library. So, compile static Mesa libs with disabled thread support.
One should edit configure so it will generate THREAD_LIBS="-pthread"
to handle pthreads. Run
perl -pi -e 's|-lpthread|-pthread|g configure
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
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
Check if all the *.slass files are in VTK_DIR/vtk. Then run
jar cf vtk312.jar vtk
We used Solaris 2.6, GCC 2.8 and Mesa. All compiled and worked fine.
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.
gzcat vtk312Unix.tar.gz | tar xvf -
CC=cc CXX='CC -compat=4' ./configure --with-java --with-shared
-compat=4 thing is probaly not necessary. Probably one should patch WS or upgrade to new version ;-)
JDKHOME=/usr/java1.2 JAVAC=/usr/bin/javac JAVA_CLASS_HOME=/usr/local/vtk JAVA_INCLUDES=-I${JDKHOME}/include -I${JDKHOME}/include/solaris JAVA_CXX_LIB=-lC
export CLASSPATH=$CLASSPATH:/DASEDIR/vtk31/java
export CLASSPATH=$CLASSPATH:/usr/loval/vtk
There should be VTK RPMs available on the net, but if you have
SEGMENTATION VIOLATION
recompile everything yourself
in way similar to
FreeBSD
Copyright © 2000, OVT Team.
All rights reserved.
Maintained by
Yuri Khotyaintsev
(yuri@irfu.se)
last modified on