[vtkusers] libvtkJava and libXt

Peter F Bradshaw pfb at users.sourceforge.net
Sat Jan 13 22:13:36 EST 2001


Hi;

I'm having problems with the vtkJava library. The test code I'm using is:

import vtk.*;
import java.io.*;
import java.awt.*;
import javax.swing.*;
import Gui.Common.*;

/*
 * $Id$
 */

public class xxx
  {
  public xxx()
    {
    }
  
  static void main(String[] arg)
    {
    System.out.println("xxx.main()");

    System.loadLibrary("Xt");
    System.loadLibrary("vtkJava");

    JFrame panel = new JFrame("Test");
    panel.setBackground(new Color(140, 0, 0));
    panel.pack();
    panel.show();
    }
  }

If I run this (under Linux) the Java virtual machine fails with a SIGSEGV as
follows:

xxx.main()
SIGSEGV 11 (*) segmentation violation
        stackpointer=0xbffc1cb0

Full thread dump Classic VM (J2RE 1.3.0 IBM build cx130-20000623, native threads):
    "Image Fetcher 0" (TID:0x402d8548, sys_thread_t:0x8311ef0, state:CW, native ID:0x1c08) prio=8
.
.
.
other threads in state CW
.
.
.
    "main" (TID:0x402d87e0, sys_thread_t:0x8050730, state:R, native ID:0x400) prio=5
        at sun.awt.motif.MWindowPeer.create(Native Method)
        at sun.awt.motif.MComponentPeer.init(MComponentPeer.java:193)
        at sun.awt.motif.MWindowPeer.init(MWindowPeer.java:86)
        at sun.awt.motif.MFramePeer.<init>(MFramePeer.java:66)
        at sun.awt.motif.MToolkit.createFrame(MToolkit.java:146)
        at java.awt.Frame.addNotify(Frame.java:356)
        at java.awt.Window.pack(Window.java:370)
        at Java.Common.DataSource.FiletoPoly.xxx.main(xxx.java:32)

If I comment out the System.loadLibrary("Xt") then I get an unsatisfied link
error from the virtual machine as follows:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/local/vtk/lib/libvtkJava.so: /usr/local/vtk/lib/libvtkJava.so: undefined symbol: XtAppMainLoop
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1470)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1358)
	at java.lang.Runtime.loadLibrary0(Runtime.java:766)
	at java.lang.System.loadLibrary(System.java:849)
	at Java.Common.DataSource.FiletoPoly.xxx.main(xxx.java:28)

An ldd on libvtkJava yields:

	libVTKImagingJava.so => /usr/local/vtk/lib/libVTKImagingJava.so (0x40130000)
	libVTKImaging.so => /usr/local/vtk/lib/libVTKImaging.so (0x401e5000)
	libVTKGraphicsJava.so => /usr/local/vtk/lib/libVTKGraphicsJava.so (0x40524000)
	libVTKGraphics.so => /usr/local/vtk/lib/libVTKGraphics.so (0x406e6000)
	libVTKCommonJava.so => /usr/local/vtk/lib/libVTKCommonJava.so (0x40c56000)
	libVTKCommon.so => /usr/local/vtk/lib/libVTKCommon.so (0x40ccc000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x40e2d000)
	libdl.so.2 => /lib/libdl.so.2 (0x40e3e000)
	libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40e41000)
	libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40e4d000)
	libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x40e57000)
	libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40e6e000)
	libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x40f12000)
	libstdc++-libc6.1-1.so.2 => /usr/lib/libstdc++-libc6.1-1.so.2 (0x40f5e000)
	libm.so.6 => /lib/libm.so.6 (0x40fa0000)
	libc.so.6 => /lib/libc.so.6 (0x40fbc000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

Sorry about the verbosity of the outputs but too much is probably better than
too little. My firtst question is that given that vtkJava is to be linked to
Xt (ldd) then is the System.loadLibrary("Xt") statement necessary at all? And,
if it is what is causing the SIGSEGV?

Cheers

--
Peter F Bradshaw          | http://members.dingoblue.net.au/~pfb
pfb at users.sourceforge.net | PGP public key at
http://www.pfb.tsx.org    | http://members.dingoblue.net.au/~pfb/public_key.html
ICQ 75431157 (exadios)    | "Needs more salt" - Archimedes






More information about the vtkusers mailing list