vtkImplicitArrays error with java wrappings

Hello all,

I was just compiling VTK (master) with Enable CommonImplicitArrays and noticed that the Java wrapping give a link error

[17797/21487] Linking CXX shared library lib\java\vtk-Windows-AMD64\vtkFiltersReductionJava.dll
FAILED: lib/java/vtk-Windows-AMD64/vtkFiltersReductionJava.dll lib/vtkFiltersReductionJava.lib
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1430~1.307\bin\Hostx64\x64\link.exe /nologo Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkToAffineArrayStrategyJava.cxx.obj Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkToConstantArrayStrategyJava.cxx.obj Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkToImplicitArrayFilterJava.cxx.obj Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkToImplicitRamerDouglasPeuckerStrategyJava.cxx.obj Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkToImplicitStrategyJava.cxx.obj Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkToImplicitTypeErasureStrategyJava.cxx.obj Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkFiltersReductionModuleJava.cxx.obj  /out:lib\java\vtk-Windows-AMD64\vtkFiltersReductionJava.dll /implib:lib\vtkFiltersReductionJava.lib /pdb:lib\java\vtk-Windows-AMD64\vtkFiltersReductionJava.pdb /dll /version:0.0 /machine:x64  /INCREMENTAL:NO  lib\vtkFiltersReduction-9.2.lib  lib\vtkCommonExecutionModelJava.lib  lib\vtkCommonImplicitArraysJava.lib  lib\vtkCommonExecutionModel-9.2.lib  lib\vtkCommonDataModel-9.2.lib  lib\vtkCommonTransforms-9.2.lib  lib\vtkCommonMath-9.2.lib  lib\vtkkissfft-9.2.lib  lib\vtkCommonCoreJava.lib  lib\vtkJava-9.2.lib  "openjdk17\current\lib\jawt.lib"  "openjdk17\current\lib\jvm.lib"  lib\vtkCommonImplicitArrays-9.2.lib  lib\vtkCommonCore-9.2.lib  lib\vtksys-9.2.lib  ws2_32.lib  dbghelp.lib  psapi.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."
LINK: command "C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1430~1.307\bin\Hostx64\x64\link.exe /nologo Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkToAffineArrayStrategyJava.cxx.obj Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkToConstantArrayStrategyJava.cxx.obj Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkToImplicitArrayFilterJava.cxx.obj Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkToImplicitRamerDouglasPeuckerStrategyJava.cxx.obj Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkToImplicitStrategyJava.cxx.obj Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkToImplicitTypeErasureStrategyJava.cxx.obj Wrapping\Java\CMakeFiles\vtkFiltersReductionJava.dir\CMakeFiles\vtkFiltersReductionJava\vtkFiltersReductionModuleJava.cxx.obj /out:lib\java\vtk-Windows-AMD64\vtkFiltersReductionJava.dll /implib:lib\vtkFiltersReductionJava.lib /pdb:lib\java\vtk-Windows-AMD64\vtkFiltersReductionJava.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO lib\vtkFiltersReduction-9.2.lib lib\vtkCommonExecutionModelJava.lib lib\vtkCommonImplicitArraysJava.lib lib\vtkCommonExecutionModel-9.2.lib lib\vtkCommonDataModel-9.2.lib lib\vtkCommonTransforms-9.2.lib lib\vtkCommonMath-9.2.lib lib\vtkkissfft-9.2.lib lib\vtkCommonCoreJava.lib lib\vtkJava-9.2.lib openjdk17\current\lib\jawt.lib openjdk17\current\lib\jvm.lib lib\vtkCommonImplicitArrays-9.2.lib lib\vtkCommonCore-9.2.lib lib\vtksys-9.2.lib ws2_32.lib dbghelp.lib psapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:lib\java\vtk-Windows-AMD64\vtkFiltersReductionJava.dll.manifest" failed (exit code 1181) with the following output:
LINK : fatal error LNK1181: cannot open input file 'lib\vtkCommonImplicitArraysJava.lib'

And indeed there is no ‘lib\vtkCommonImplicitArraysJava.lib’.
Any ideas on how to fix this ?

Many thanks,
Kostas

@jfausty @dgobbi

With these Java build errors, the best way around them is to simply resume the build, and they will usually go away on their own. If you’re using msbuild, then try “-m:1” instead of doing a parallel build (if you’re using ninja, use “-j1” to do the same thing).

The problem is the cmake dependency rules for “vtk.jar” and for the .class files. It’s a problem that has been around for a long time, but no-one has a fix for it.

I don’t think it has anything to do with CommonImplicitArrrays specifically, I’ve seen it fail in similar ways for completely different libraries. For example, I just tried building on my linux box with CommonImplicitArrays enabled, and saw a completely different error:

Wrapping/Java/Testing/Java/vtk/test/Regression.java:166: error: package vtkObject does not exist
        vtkObject.JAVA_OBJECT_MANAGER.deleteAll();
                 ^
Wrapping/Java/Testing/Java/vtk/test/Regression.java:168: error: cannot find symbol
        if (retVal0 != vtkJavaTesting.PASSED) {
                       ^

When I restarted the build, it completed without errors.

I should add: if you update your VTK source code (e.g. with git pull), then you should always delete the old contents of your build directory and do a clean build.

This is due to the fact that CMake can’t properly update dependencies for generated code. It also impacts the Python wrappers (see #17235).

Thank you very much for your advice!

I’ll check this out :slight_smile:

By the way, besides kitware’s blog are there any other online resources that discuss for example use cases of implicit arrays or related Content?

Many thanks :+1:
Kostas

@jfausty @spyridon97

Hi @Kostas_Politis,

Some documentation around implicit arrays can be found in the general documentation on VTK: https://vtk.org/doc/nightly/html/classvtkImplicitArray.html.

The associated change log also has some information: https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/release/dev/add-vtkImplicitArrays.md

And, as you mentioned, the blog can be a good resource: https://www.kitware.com/vtkimplicitarrays-a-new-vtk-framework-for-manipulating-array-like-data/.

Best regards,

Julien