Compiling VTK with OSPRay + Java wrappers enabled

Hello,
After a long hiatus, I’ve recently started picking up VTK, and WOW, so much progress and new features to play around with. Kudos to all involved!
On to the question…
I have been evaluating language support of various features of VTK and ran into some issues with raytracing support via OSPRay.

  • I was able to build and run the examples in C++.

  • I then transitioned to prototyping in python and that worked pretty flawlessly.

  • Next, trying jvm support and I ran into an issue compiling VTK with OSPRay with java wrappings enabled.
    I’m compling with jdk 8 but the source target still seems to be 1.7. There are a few warnings during the build about that but the main error is with linking the vtkOSPRayMaterialLibaryJava…I get the following error:

    ➜ make -j8 | grep Error
     Undefined symbols for architecture x86_64:
        _vtkObject_Typecast, referenced from:
      _vtkOSPRayMaterialLibrary_Typecast in vtkOSPRayMaterialLibraryJava.cxx.o ld: symbol(s) not found for architecture x86_64
            clang: error: linker command failed with exit code 1 (use -v to see invocation)
            make[2]: *** [lib/java/vtk-Darwin-x86_64/libvtkRenderingRayTracingJava.jnilib] Error 1
            make[1]: *** [Wrapping/Java/CMakeFiles/vtkRenderingRayTracingJava.dir/all] Error 2
            make[1]: *** Waiting for unfinished jobs....
            make: *** [all] Error 2
    

Has anyone been able to successfully compile VTK with OSPRay + Java wrappers enabled?

  • OS: Mac 11.2.3 (BigSur)
  • VTK: 9, using master of git
commit 42d63c20859215e5a455d91f0f7c9a816d69805e (HEAD -> master, origin/master, origin/HEAD)
Merge: 64a1eddb20 122a7fed59
Author: Ben Boeckel <ben.boeckel@kitware.com>
Date:   Thu Mar 11 13:42:57 2021 +0000

    Merge topic 'cmake-cleanups'

    122a7fed59 vtkSimpleImageFilterExample: deprecate example class
    a30797d087 cmake: quote variable expansions
    6b1e5bed8f cmake: prefer `foreach (IN LISTS)`
    b0eae3fc55 cmake: use PRIVATE_CLASSES where possible
    7fe5cc86a8 cmake: sort file and class listings

    Acked-by: Kitware Robot <kwrobot@kitware.com>
    Merge-request: !7734

Thanks for any advice here
Gerrick

The dependencies for the module might be mislabeled.

In the file Rendering/RayTracing/vtk.module can you try moving VTK::CommonCore from the PRIVATE_DEPENDS section to the DEPENDS section?

Since vtkOSPRayMaterialLibrary is a direct subclass of vtkObject, the CommonCore module is a direct dependency of RenderingRayTracing. The wrappers need these dependencies to be correct.

It looks like when vtkOSPRayMaterialLibrary was added to VTK, the module file should have been updated but wasn’t.

Yup, that was exactly it! Should I file a ticket or what is the process you all are using to get that updated?

If you’re willing, you can submit a merge request. The process is described here.

Briefly, you can make a topic branch with the fix:

checkout -b renderingraytracing-depends

and then submit the fix to gitlab:

git gitlab-push 

After doing this, a “Create Merge Request” button should appear at the top of the VTK merge_requests web page.

Java 1.7 is the minimum requirement, so JDK1.8+ is fine.

Submitted: https://gitlab.kitware.com/vtk/vtk/-/merge_requests/7799#