Building vtk 9.4.0 on windows Java

Hi all. Having a problem building vtk_9.4.0 on windows / Java. The error below is just a sample of the 120 error that come up. they are all wrapping errors that fail on code 1. I am out of my depth on these errors and have no idea which way to turn.

Please help. Thanks very much.

Custom build for ‘C:\vtk\vtkBinaries_9.4.0\CMakeFiles\37298a315299d8de439efe09fe10d7c1\vtkColorSeries.java.rule;C:\vtk\vtkBinaries_9.4.0\CMakeFiles\37298a315299d8de439efe09fe10d7c1\vtkNamedColors.java.rule;C:\vtk\vtkBinaries_9.4.0\CMakeFiles\ccd1784ea5325db0188fdb455b80e4de\vtkCommonColorJava-java-sources.rule;C:\vtk\VTK-9.4.0\Wrapping\Java\CMakeLists.txt’ exited with code 1.

Hello,

The message you posted isn’t very helpful. Please, at least share the entire output (you can redirect it to a file: command line - How can I redirect Windows cmd standard output and standard error to a single file? - Stack Overflow ). Presenting the procedure you followed in sufficient detail (e.g.: how you configured VTK, which command lines you entered) is also helpful sometimes.

best,

PC

Thanks very much Paulo. Let me give as full an explanation as possible. I have been struggling with 9.x.x but 9.3.1 built without error but would not run.

I will put together a full story and send it in. I am very relieved that someone can and is willing to help. Thanks again

ngwarai

1 Like

Please find below the data collected on the build:

cmake config setup - cmake_3.30.5_step1.png
cmake 1st config log - cmake config report_1.txt
cmake log after “vtk wrap java” - cmake config report_2.png

vs2022 language standard setup - vs2022 language std.png
vs2022 build log - vs2022_build_log.txt
vs2022 error log - vs2022 error log.txt

I manually copied the errors and may have included warnings there too.

My java is jdk1.8.0_431 (I am planning to upgrade to Java 23 and 64bit vtk once my 9.4.0 is working on 32bit). I am currently using vtk 8.2.0 on jdk1.8.0_431.

My visual studio is - Visual Studio 2022 v17.12
I trust that is all the relevant information.

Thank you very much for the help

Ngwarai mazike

(attachments)


cmake_1st config log.txt (17.6 KB)


vs2022_build_log.txt (1.59 MB)
vs2022 error log.txt (605 KB)

Side note, the VTK CI is now publishing Maven packages that can be used directly.

@vbolea can provide more information about the registry where things get published.

1 Like

We provide weekly maven package of snapshots of master (Currently post 9.4.0) here: Packages · Kitware, Inc. · GitHub

We provide native packages inside this maven package for Linux x86 / Windows x86 / MacOS x86/MacOS arm64.

We have not uploaded the vtk 9.4.0 final release yet in this maven registry. We will do it soon.

This is the first error in your log:

168>Error opening dependency file C:/vtk/vtkBinaries_9.4.0/Wrapping/Java/CMakeFiles/vtkViewsContext2DJava.dir/vtkContextInteractorStyle.java.d
168>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build f...

It seems to be a file missing. Can you, in CMake window, disable “Grouped” and enter “java” in the search field? Please, share what appears. Maybe you need to enable something in VTK configuration.

Thanks Paulo. I will try that and send forth the result. Thanks again.

ngwarai

Good evening Paulo. I have dove as you directed, I think and here are the results. On configure after “VTK Wrap Java”, I get :

configure_with_java_search_1.png

Then I configure again but there is no change in the output as in

configure_with_java_search_2.png

I then “Generate” and again there is no change. I have included the ALL_BUILD file for VS 2022. Thanks and good luck.

ngwarai

(attachments)



ALL_BUILD.vcxproj (196 KB)

I strongly suspect that the only way to build VTK with Java on Windows is with the “Ninja” generator, so make sure that you select “Ninja” as the generator when you run cmake. The “Visual Studio” generators will probably not work.

The “Ninja” generator will use the compiler from Visual Studio, so don’t worry, you won’t have to install a different compiler.

After running cmake, open a command-line shell and run “ninja” from your VTK binary directory.

Good evening David and thanks very much for the advice. I will most certainly try ninja and, if you don’t mind, could I please come back to you for issues arising?

I will report to you on my attempts. I will install Java 23 as required. Thanks again for offering to help.

ngwarai

Hello,

I don’t like much this:

So, basically you’re telling CMake to use one Java installation while configuring VTK to use another Java installation. If you don’t have a reason to use two Java installations, try to change that to the same value in Java_JAVA_EXECUTABLE. I don’t know whether this will solve the issue but that often spells trouble if you don’t know exactly what you are doing.

best,

PC

Thank you, but that is not a build log file. Please, refer to the Stack Overflow link posted further up.

Thanks Paulo. I did actually notice it, but it did not ring any bells. I will take it out and see and post what happens next. Thanks again.

Good evening Paulo. I repeated the exercise, making sure the Java entries were consistently from the same JDK and with java in the search window:

cmake at generate.png

I generated and submitted the project file to VS2022. The report was as in:

Vs2022 build log.txt

It generated the same 119 errors as before. I trust I am following the instruction faithfully.

Thanks very much
ngwarai

(attachments)


vs2022 build log.txt (1.59 MB)

Good evening David. As per advice, I tried the ninja build route. I ran into some problems before I got to the ninja.build file.

  1. Attempt 1: - CMake Error at ThirdParty/eigen/vtkeigen/CMakeLists.txt:123 (message): Can’t link to the standard math library.

File: cmake changed compilers.txt

(attachments)

cmake config for ninja.txt (6.49 KB)
cmake changed compilers .txt (2.85 KB)

Sorry about that, I didn’t provide good instructions. When building with ninja it’s necessary to run cmake and ninja from within the Visual Studio Command Prompt, since it sets all of the necessary environment variables for the compiler and the SDK.

Thanks, I will try that out and report back. Most grateful.

ngwarai

There are also some ninja-specific instructions at the following page:
https://docs.vtk.org/en/latest/build_instructions/index.html

I will look them up. Ninja just may enable 9.4.0 for me. All the way up to 8.2.0, I just kind of pressed a button to build the version. Version 9 is different, to say the least. Thanks very much

ngwarai