[vtkusers] VTK fails to build on Linux with OpenJDK and "make -j" flag

Denis Barbier bouzim at gmail.com
Wed Aug 26 15:23:35 EDT 2009


Hi,

When looking at bug reports about VTK in the Debian Bug Tracking System, I found
someone complaining that VTK fails to build. Full log is available at
   http://people.debian.org/~lucas/logs/2009/08/22/vtk_5.2.1-7_lsid64.buildlog
It contains 3 consecutive tries, all fail at different places, but
always when compiling
Java classes, for instance like this:

> /build/user-vtk_5.2.1-7-amd64-Ow7MYz/vtk-5.2.1/Build/java/vtk/vtkVTKJavaCommonDriver.java:51: cannot access vtk.vtkHomogeneousTransform
> bad class file: /build/user-vtk_5.2.1-7-amd64-Ow7MYz/vtk-5.2.1/Build/java/vtk/vtkHomogeneousTransform.class
> class file contains wrong class: vtk.vtkHeap
> Please remove or make sure it appears in the correct subdirectory of the classpath.
>     dummy = new vtkHomogeneousTransform();
>                  ^
>  1 error

This intrigued me, since I regularly compile VTK with Java bindings,
and found that this
bug can indeed be reproduced when compiling with -j flag. According to
the log file, this
seems to be due to javac.  This happens on Linux with openjdk 6.

With a sequential build, any dependency on a .class file will compile
vtk${Target}Driver.java
and thus also produce all .class files for the current kit.  But with
a parallel build, several
compilations of the same driver file can happen at the same time, and
this seems to
introduce some race issue in javac.  I suggested the attached patch to
fix this failure for
Debian, it makes sure that each driver file is compiled only once, and
indeed solve this
issue on my tests (tested with VTK 5.2 and 5.4).

Does someone else already experienced this problem, or has a better fix?
Thanks.

Denis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-vtk-javac.patch
Type: text/x-diff
Size: 1308 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090826/85410bc1/attachment.patch>


More information about the vtkusers mailing list