I tried to install java and python wrappers in order to use them for calling VTK APIs, over last three days I have tried different approaches. first VTK_BUILD?SHARED checked in CMake apparently that failed in installation stage because of missing .pyd library file for python, I guess it was vtkIOVeraOut.cp36-win.amd64.pyd if I am not wrong. I search the download vtk source files and could not find it. then I tried to install it in release mode and that also failed, today I tried to uncheck VTK_BUILD_SHARED so everything builds and I still have problems building, I saw a project failed to build at project number 490, and some other problems raised with my pc after 10 hours of continues build of vtk 9.0.
Q. has anybody managed to include java and python wrappers checked in CMake and succeeded to install VTK 9.0,
@ben,
CMake is used to generate a vtk.sln solution for vs2017
EDI: (VS2017 + x64/debug) build
I just responded to your email from my gmail. I hope that helps, As I explained the errors are for a static build BUILD_SHARED_LIBS IS UNCHECKED! I also have missing libraries which I hope it is because of compilation errors which consequently resulted in missing libraries.
Missing libraries:
…/…/lib/debug/vtkCommonExecutionModelJava.lib
…/…/lib/debug/vtkCommonCoreJava.lib
what do you think the compilation errors resulted in not building these libraries so they are missing!?
I don’t know how well Java support with static libraries is supported. It looks like “not 100%”. I suggest doing a shared build if you need Java right now. If you chase the errors back to the source, you find this output:
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(45): error C2375: 'vtkJavaGetPointerFromObject': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(28): note: see declaration of 'vtkJavaGetPointerFromObject'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(50): error C2375: 'vtkJavaMakeJArrayOfDoubleFromDouble': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(37): note: see declaration of 'vtkJavaMakeJArrayOfDoubleFromDouble'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(75): error C2375: 'vtkJavaMakeJArrayOfDoubleFromFloat': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(35): note: see declaration of 'vtkJavaMakeJArrayOfDoubleFromFloat'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(100): error C2375: 'vtkJavaMakeJArrayOfIntFromInt': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(41): note: see declaration of 'vtkJavaMakeJArrayOfIntFromInt'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(125): error C2375: 'vtkJavaMakeJArrayOfIntFromIdType': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(42): note: see declaration of 'vtkJavaMakeJArrayOfIntFromIdType'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(150): error C2375: 'vtkJavaMakeJArrayOfIntFromLongLong': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(44): note: see declaration of 'vtkJavaMakeJArrayOfIntFromLongLong'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(175): error C2375: 'vtkJavaMakeJArrayOfIntFromSignedChar': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(46): note: see declaration of 'vtkJavaMakeJArrayOfIntFromSignedChar'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(200): error C2375: 'vtkJavaMakeJArrayOfFloatFromFloat': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(33): note: see declaration of 'vtkJavaMakeJArrayOfFloatFromFloat'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(225): error C2375: 'vtkJavaMakeJArrayOfShortFromShort': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(39): note: see declaration of 'vtkJavaMakeJArrayOfShortFromShort'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(250): error C2375: 'vtkJavaMakeJArrayOfByteFromUnsignedChar': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(50): note: see declaration of 'vtkJavaMakeJArrayOfByteFromUnsignedChar'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(276): error C2375: 'vtkJavaMakeJArrayOfLongFromLong': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(48): note: see declaration of 'vtkJavaMakeJArrayOfLongFromLong'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(302): error C2375: 'vtkJavaMakeJArrayOfUnsignedLongFromUnsignedLong': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(62): note: see declaration of 'vtkJavaMakeJArrayOfUnsignedLongFromUnsignedLong'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(329): error C2375: 'vtkJavaMakeJArrayOfUnsignedShortFromUnsignedShort': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(60): note: see declaration of 'vtkJavaMakeJArrayOfUnsignedShortFromUnsignedShort'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(356): error C2375: 'vtkJavaMakeJArrayOfUnsignedCharFromUnsignedChar': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(56): note: see declaration of 'vtkJavaMakeJArrayOfUnsignedCharFromUnsignedChar'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(383): error C2375: 'vtkJavaMakeJArrayOfUnsignedIntFromUnsignedInt': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(58): note: see declaration of 'vtkJavaMakeJArrayOfUnsignedIntFromUnsignedInt'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(410): error C2375: 'vtkJavaMakeJArrayOfCharFromChar': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(54): note: see declaration of 'vtkJavaMakeJArrayOfCharFromChar'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(517): error C2375: 'vtkJavaUTFToChar': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(29): note: see declaration of 'vtkJavaUTFToChar'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(522): error C2375: 'vtkJavaUTFToString': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(30): note: see declaration of 'vtkJavaUTFToString'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(535): error C2375: 'vtkJavaMakeJavaString': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(31): note: see declaration of 'vtkJavaMakeJavaString'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(565): error C2375: 'vtkJavaVoidFunc': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(74): note: see declaration of 'vtkJavaVoidFunc'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(582): error C2375: 'vtkJavaVoidFuncArgDelete': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(75): note: see declaration of 'vtkJavaVoidFuncArgDelete'
VTK can often be tricky to build, especially with Python and Java wrappers, but it can definitely be done. It’s even done as part of the automated nightly testing.
However, there are some considerations:
If you want to build the wrappers, set BUILD_SHARED_LIBS to ON. Otherwise, the wrappers will not work as you expect. Trying to build the wrappers with static libraries is just a waste of time unless you really need static libraries.
For VTK 9.0, building the Java wrappers inside Visual Studio will not work. Right now, the only way to build Java wrapping on Windows is from the “VS Developer Command Prompt” with the Ninja generator. This will probably be fixed for VTK 9.1.
VTK 9.0 also has issues with embedding the VTK render window within a Java GUI, this should also be fixed in 9.1.
In summary, I think your best option right now is to only use Python wrapping (and definitely check BUILD_SHARED_LIBS). For Java, wait for VTK 9.1.
@ben.boeckel I can check the attributes and specifiers for the generated Java methods. But it’s probably worth repeating that I’m really no expert on the Java wrapping, and I’m not even a Java programmer.
Hi ben
Firstly Thank you sir about your help, secondly I don’t know how to run build from vs developers command prompt with ninja generator!? I will do CMake with BUILD_SHARED_LIBS! afterwards what is the command line for build from command prompt with ninja generator!?
The “x64 Native Tools Command Prompt” is in the Windows Start menu (under the Visual Studio 2017 menu).
Once you are in the command prompt, all the build commands should be run from this prompt. First, you should “cd” to your build folder, and then you can run cmake, and then ninja:
Firstly thank you for your response. secondly I followed the instruction you wrote in your message:
cmake …\src -GNinja -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DVTK_WRAP_JAVA=ON -DVTK_WRAP_PYTHON=ON ninja
but I received error message: CMake Error: The source directory c:\vtk\bin\ninja does not exist specify --help for usage, or press the help button on the CMake GUI.
Please inform me what do you make of this error message and how could I do ninja generation of my source code and built VTK tool
I appreciate your help in advance
You put “ninja” at the end of your cmake command. This is wrong, ninja is a separate command to run after you run cmake. Take another look at my example above.
After doing the build with “ninja”, type “ninja install” to do the actual installation.