Building vtk 9.4.0 on windows Java

Hi @vbolea, I’ve added vtk-java11 and the natives to my project and when I run my application, I’m only seeing the jni shared libraries, (libvtk*Java.so) in the jar. How do I install the compatible natives(libvtk*.so) for vtk itself? Are those available via maven as well?

Example error:

java.lang.UnsatisfiedLinkError: /workspaces/my-app/target/native-libs/libvtkWebGLExporterJava.so: libvtkWebGLExporter.so: cannot open shared object file: No such file or directory

Thanks for providing this

Good afternoon David. I ran up against a compiler brick wall trying to configure the build job for Ninja. I started Cmake from with VS2022.

  1. I accepted default compilers. The system puts forward Clang 15.0.7 . The config fails with error as shown in attachement:

ninja default compilers.txt

Running cmake with Ninja generator from the Visual Studio Command Prompt should look like the following image. CMake should automatically find the Visual Studio 2022 compiler.

Thanks David. Let me have another bash. I had just raised cmake with “cmake-gui” and went back to my bad old ways. I will report back.

ngwarai

Hello,

Then it is necessary to analyse the exact build commands being issued by nmake which are not present in the log you’ve posted. Please, enable a more verbose output:

then capture and re-share the resulting log file.

best,

PC

Thanks Paulo. I shall enable the verbose output and report. Thanks again.
ngwarai

According to your latest log, all Java-generating commands are failing. It is possible that malformed commands are the cause.

@thegbiv the native libs should have been included in the Jar. I am investigating this, it seems that this broke last week. I will keep you updated.

1 Like

Good evening Vincente. Thank you very much for following up on this problem. We cross our fingers for an early resolution. Thanks again and good luck.

ngwarai

Good evening Paulo. I set the verbose option in cmake then generated the vs project:


-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON 

The attached is the vs 2022 log. I trust it shall give some leads to the Java problem  you
have identified. Looking at the errors generated, yes, it does look like a machinery system 
fault with 120 casualties.

Find attached. Thanks very much and good luck.

ngwarai

(attachments)

vs2022 verbose output.txt (2.84 MB)

How are you building? In VS IDE or in VS command prompt?

Good morning Paulo. I am building in VS IDE. I have not ventured beyond the GUI yet. I guess because it used to work.

ngwarai

I asked that because even the verbose mode is not resulting in the exact commands issued during build. So I guess you have to do like suggested by @dgobbi further up (build in a VS command prompt window) to get a more informative build log. We need to get all information of what is being done. Other than that, we can only guess, guess and guess only to go nowhere. That is not very efficient.

Good afternoon David. I tried as per the example you shared. Cmake kept choosing Clang 15.0.7 as default compiler which soon fails.

ninjaConfigLog.txt

(attachments)

ninjaConfigLog.txt (6.61 KB)

Thanks Paulo, I understand. Let me have another bash. I will report back asap. Thanks again.

ngwarai

Hello,

Please, take a look at this: iar - How to specify a compiler in CMake? - Stack Overflow .

best,

PC

Thanks Paulo, will do.

ngwarai

The MSVC compiler is actually a program called cl.exe, so after opening the developer command prompt for VS 2022, do some simple checks as shown in the following image to make sure the compiler is in the path. For cmake, you can set the environment variables CC and CXX to the compiler (use the full path). CC is what cmake will use for CMAKE_C_COMPILER and CXX is what cmake will use for CMAKE_CXX_COMPILER. MSVC uses the same compiler for both C and C++.

1 Like

Good evening Paulo. Thanks very much for your patience. Please find attached the diagnostic build log of vs2022. It is set to maximum verbosity. I had to compress to a zip for attachment.

Thanks again and happy forensic diagnosis.

ngwarai

(attachments)

vs2022_disgnostic_build_log.zip (3.24 MB)

1 Like

Hello,

I found the lines below very concerning (there is one like this for each of the Java wrappings):

511>Project file contains ToolsVersion="17.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="Current". For more information, please see http://go.microsoft.com/fwlink/?LinkId=293424.
511>Target "EnableIntermediateOutputPathMismatchWarning" skipped, due to false condition; ('$(RestoreProjectStyle)' == 'PackageReference') was evaluated as ('' == 'PackageReference').
511>Target "_CheckForInvalidConfigurationAndPlatform" in file "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets":
511>  Set Property: _InvalidConfigurationMessageText=The BaseOutputPath/OutputPath property is not set for project 'vtkChartsCoreJava.vcxproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Release'  Platform='Win32'.
511>  Set Property: _InvalidConfigurationMessageText=The BaseOutputPath/OutputPath property is not set for project 'vtkChartsCoreJava.vcxproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Release'  Platform='Win32'.  This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.

Other parts of the log refer to 14.42.34433. It looks like a corrupted or misconfigured VS2022 installation to me - or - you are somehow re-using VS project files (.vcxproj files) configured for another VS.

I’d try:

  1. Make sure you have a clean and healthy VS2022 Community installation. Keep an eye for other VS installed in your system.
  2. Start a new, clean build of VTK from scratch (delete everything in the build directory).

best,

PC