[vtk-developers] Selecting libraries

Sebastien Jourdain sebastien.jourdain at kitware.com
Sat Apr 4 13:02:58 EDT 2015


1) Yes, just make sure you load all the needed libraries.

2) Modules create libraries and each module describe its dependencies (look
at the files named: module.cmake)
For each class from VTK you use find the module it belongs to and keep
track of each dependencies. From that you should be able to create a list
of library that you need.

There might be an "automatic/better" way using CMake but I'm not aware of
it. But I kind of recall some talk a long time ago (years) on the mailing
list on how to build a VTK application without CMake and how to know which
library you need to link against. Dave Cole and Bill Lorensen may have
contributed to that topic as well as Marcus Hanwell. But that is just a
memory that might be good to look into. (You may have to fake a C++ file to
describe the dependencies.)

3) Might be lighter in memory. In case you only need half of VTK, your
application can only embed those libs and be smaller on disk (and memory).

Seb

On Tue, Mar 31, 2015 at 11:47 AM, CSharpdotcom . <csharpdotcom at gmail.com>
wrote:

> Hello,
>
> I've just been trying another Java example of VTK, as listed in
> http://www.vtk.org/Wiki/VTK/Examples/Java/Cylinder, which I put into
> NetBeans.  When I use the code in the static block:
>
> static {
>     System.loadLibrary("vtkCommonCoreJava");
>     System.loadLibrary("vtkFiltersSourcesJava");
>     System.loadLibrary("vtkInteractionStyleJava");
>     System.loadLibrary("vtkRenderingOpenGLJava");
>   }
>
> as given in the listing, the application fails with the error message:
>
> Exception in thread "main" java.lang.UnsatisfiedLinkError:
> vtk.vtkPolyDataMapper.VTKInit()J
> ..........
>
> and I found that VTKInit() is called right at the very end of the
> vtkPolyData class in vtk.jar.  However, if I replace loading the
> specified libraries in the static block above by loading all the
> libraries using:
>
> static {
>     if (!vtkNativeLibrary.LoadAllNativeLibraries()) {
>         for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {
>             if (!lib.IsLoaded())
>               System.out.println(lib.GetLibraryName() + " not loaded");
>         }
>         System.out.println("Make sure the search path is correct: ");
>         System.out.println(System.getProperty("java.library.path"));
>     }
>     vtkNativeLibrary.DisableOutputWindow(null);
> }
>
> as copied from the code I got working last week, then the application
> works correctly.
>
> My questions are:
>
> 1) Is there a way of fixing the error without loading all the libraries?
>
> 2) Related to that, is there a way of determining which libraries to
> load, without having to load them all?
>
> 3) Is it better to load only the libraries you need rather than
> loading them all?  This of course will depend on knowing which
> libraries to load from (2).
>
> At your convenience I would be grateful to have some help on this.
>
> Christopher Sharp
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150404/a84fe0b2/attachment.html>


More information about the vtk-developers mailing list