Error building examples

I’m new to VTK. I built and installed VTK-8.2 on ubuntu 18.04.4. I want to build all the examples, and am following the directions at this link. . When I type ‘make’ I get:
make
Scanning dependencies of target AnimateActors
[ 1%] Building CXX object Cxx/Animation/CMakeFiles/AnimateActors.dir/AnimateActors.cxx.o
[ 1%] Linking CXX executable …/…/bin/AnimateActors
[ 1%] Built target AnimateActors
Scanning dependencies of target OverlappingAMR
[ 2%] Building CXX object Cxx/CompositeData/CMakeFiles/OverlappingAMR.dir/OverlappingAMR.cxx.o
[ 2%] Linking CXX executable …/…/bin/OverlappingAMR
[ 2%] Built target OverlappingAMR
Scanning dependencies of target CompositePolyDataMapper
[ 2%] Building CXX object Cxx/CompositeData/CMakeFiles/CompositePolyDataMapper.dir/CompositePolyDataMapper.cxx.o
/home/oreilly/VTKWikiExamples-master/Cxx/CompositeData/CompositePolyDataMapper.cxx: In function ‘int main(int, char**)’:
/home/oreilly/VTKWikiExamples-master/Cxx/CompositeData/CompositePolyDataMapper.cxx:42:31: error: invalid conversion from ‘int’ to ‘vtkDataObject*’ [-fpermissive]
cdsa->SetBlockColor(3, color);
^
In file included from /home/oreilly/VTKWikiExamples-master/Cxx/CompositeData/CompositePolyDataMapper.cxx:5:0:
/home/oreilly/VTK-8.2.0/Rendering/Core/vtkCompositeDataDisplayAttributes.h:113:8: note: initializing argument 1 of ‘void vtkCompositeDataDisplayAttributes::SetBlockColor(vtkDataObject*, const double*)’
void SetBlockColor(vtkDataObject* data_object, const double color[3]);
^~~~~~~~~~~~~
Cxx/CompositeData/CMakeFiles/CompositePolyDataMapper.dir/build.make:62: recipe for target ‘Cxx/CompositeData/CMakeFiles/CompositePolyDataMapper.dir/CompositePolyDataMapper.cxx.o’ failed

Does anyone know why?
Thanks!

Seriously, no one has ever seen this problem before? Anyone?

The examples are compatible with the last version of VTK, VTK 9.0.0.

1 Like

I downloaded and installed VTK 9.0.1.
Building VTKWikiExamples-master encounters exactly the same error, again while trying to build CompositePolyDataMapper:

[  2%] Building CXX object Cxx/CompositeData/CMakeFiles/CompositePolyDataMapper.dir/CompositePolyDataMapper.cxx.o
/home/oreilly/VTKWikiExamples-master/Cxx/CompositeData/CompositePolyDataMapper.cxx: In function ‘int main(int, char**)’:
/home/oreilly/VTKWikiExamples-master/Cxx/CompositeData/CompositePolyDataMapper.cxx:42:31: error: invalid conversion from ‘int’ to ‘vtkDataObject*’ [-fpermissive]
   cdsa->SetBlockColor(3, color);
                               ^

Now I’ve downloaded VTKExamples (instead of VTKWikiExamples-master). I am following the “Build all of the examples” section at this link.

% mkdir VTKExamples/build
% cd VTKExamples/build
% ccmake ..

ccmake displays this:

 BUILD_TESTING                    ON                                           
 CMAKE_BUILD_TYPE                                                              
 CMAKE_INSTALL_PREFIX             /usr/local                                   
 Fontconfig_DIR                   Fontconfig_DIR-NOTFOUND                      
 Qt5Core_DIR                      /home/oreilly/Qt/5.14.2/gcc_64/lib/cmake/Qt5C
 Qt5Gui_DIR                       /home/oreilly/Qt/5.14.2/gcc_64/lib/cmake/Qt5G
 Qt5Sql_DIR                       /home/oreilly/Qt/5.14.2/gcc_64/lib/cmake/Qt5S
 Qt5Widgets_DIR                   /home/oreilly/Qt/5.14.2/gcc_64/lib/cmake/Qt5W
 Qt5_DIR                          /home/oreilly/Qt/5.14.2/gcc_64/lib/cmake/Qt5 
 VTK_DIR                          /usr/local/lib/cmake/vtk-9.0                 

Then I press ‘c’ and get hundreds of messages like the following:

 CMake Warning (dev) at /usr/local/lib/cmake/vtk-9.0/vtkModule.cmake:2847
 (message):
   No `MODULES` passed to `vtk_modules_autoinit`.
 Call Stack (most recent call first):
   src/Cxx/DataStructures/CMakeLists.txt:48 (vtk_module_autoinit)
 This warning is for project developers.  Use -Wno-dev to suppress it.

With no ‘g’ option to generate a Makefile.
Likewise if I run ‘cmake’ instead of ‘ccmake’ I get the same hundreds of :No MODULES passed to vtk_modules_autoinit." error messages, with no Makefile generated.

What am I doing wrong???

Thanks

@amaclean

@Tomasso, @mwestphal

I see the problem … that link VTK/Examples/Instructions/ForUsers references the old site which is no longer in use.

You need to go to VTKExamples and the instructions for downloading the source can be found here: Instructions for Users.

Everything should build OK and most tests pass. I have just verified that everything builds using the master version of VTK and code from the VTKExamples site.

1 Like

Thanks @amaclean - cmake is still not working, I get the same errors as in my previous message.I re-downloaded VTKExamples but I still get many errors from cmake, and no Makefile is built. I downloaded the VTKExamples per instructions per the instructions at the page you referenced:

% git clone https://github.com/lorensen/VTKExamples.git
% cd VTKExamples
% cd build
% cmake -DVTK_DIR:PATH=/home/oreilly/VTK-9.0.1/build/bin …

Here are the first several lines of cmake output, which is over 2600 lines long:

-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- VTKWikiExamples: Building VTKWikiExamples stand-alone
-- VTKWikiExamples: Building VTKWikiExamples stand-alone - yes
-- VTKWikiExamples: Setting executables prefix
-- VTKWikiExamples: Setting executables prefix - no
-- VTKWikiExamples: VTK VERSION: 9.0.1(OpenGL2)
-- VTKWikiExamples: Example executables are stored in /home/oreilly/VTKExamples/build/bin
-- VTKWikiExamples: Tests will be built with label "WikiExamples"
CMake Warning (dev) at /usr/local/lib/cmake/vtk-9.0/vtkModule.cmake:2847 (message):
  No `MODULES` passed to `vtk_modules_autoinit`.
Call Stack (most recent call first):
  src/Cxx/DataStructures/CMakeLists.txt:48 (vtk_module_autoinit)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/local/lib/cmake/vtk-9.0/vtkModule.cmake:2847 (message):
  No `MODULES` passed to `vtk_modules_autoinit`.

These messages:

CMake Warning (dev) at /usr/local/lib/cmake/vtk-9.0/vtkModule.cmake:2847 (message):
  No `MODULES` passed to `vtk_modules_autoinit`.
Call Stack (most recent call first):
  src/Cxx/DataStructures/CMakeLists.txt:48 (vtk_module_autoinit)
This warning is for project developers.  Use -Wno-dev to suppress it.

Are repeated 429 times.
And no Makefile is generated.
I am running cmake v 3.10.2
What am I doing wrong?

Thanks
Tom

@amaclean - what platform are you testing the VTKExamples build on?
cmake is still failing on my ubuntu 18.04.4 system, as I described.
This is what I see when I run ‘ccmake …’ from the VTKExamples/build directory:

 BUILD_TESTING                    ON                                           
 CMAKE_BUILD_TYPE                                                              
 CMAKE_INSTALL_PREFIX             /usr/local                                   
 Fontconfig_DIR                   Fontconfig_DIR-NOTFOUND                      
 Qt5Core_DIR                      /home/oreilly/Qt/5.14.2/gcc_64/lib/cmake/Qt5C
 Qt5Gui_DIR                       /home/oreilly/Qt/5.14.2/gcc_64/lib/cmake/Qt5G
 Qt5Sql_DIR                       /home/oreilly/Qt/5.14.2/gcc_64/lib/cmake/Qt5S
 Qt5Widgets_DIR                   /home/oreilly/Qt/5.14.2/gcc_64/lib/cmake/Qt5W
 Qt5_DIR                          /home/oreilly/Qt/5.14.2/gcc_64/lib/cmake/Qt5 
 VTK_DIR                          /usr/local/lib/cmake/vtk-9.0                 

I don’t know what “Fontconfig_Dir” should be, but it is not found according to ccmake…
Thanks!

@tomasso I see your problem, your CMake version is too old. You need Version 3.12 or later for VTK 9. I recommend downloading the latest version namely 3.17.3.

When you do this, try this first, and if it succeeds then the examples will build Ok.

Download the tarball here, untar it and cd to the build directory then type ccmake ... After pressing 'c' twice you should see something like this:


Finally press g
In the folder you should have these files:

CMakeCache.txt  CMakeFiles  cmake_install.cmake  Makefile
1 Like

Thanks @amaclean - you say “Download the tarball here”, but there is no URL in the message. Where is the tarball you refer to?

Here is the link: CylinderExample look towards the bottom of the page.

1 Like

Thanks for that info @amaclean. Is there a page that lists all vtk dependencies and required versions? That could save a lot of time in installing.
But the Cylinder example does not build on my system:

I’ve installed cmake version 3.18.0-rc2, and I’ve installed vtk 9.0.
Downloaded CylinderExample from the provided URL.. Then:

% cd CylinderExample/build
% ccmake ..

which just displays “EMPTY CACHE”

I type ‘c’ and ccmake displays:

Skipping CylinderExample: Could not find the VTK package with the following
required components: RenderingContextOpenGL2.

I’ve verified that /usr/local/lib/libvtkRenderingGL2PSOpenGL2-9.0.so is installed on the system.
I try the following, specifying where VTK-9.0 source resides on my system:

cmake -DVTK_DIR:PATH=/home/oreilly/VTK-9.0 ..

That generates a Makefile, so I run ‘make’:
% make
/usr/local/bin/cmake -S/home/oreilly/CylinderExample -B/home/oreilly/CylinderExample/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start /home/oreilly/CylinderExample/build/CMakeFiles /home/oreilly/CylinderExample/build//CMakeFiles/progress.marks
make -s -f CMakeFiles/Makefile2 all
/usr/local/bin/cmake -E cmake_progress_start /home/oreilly/CylinderExample/build/CMakeFiles 0

But I cannot find an executable called “CylinderExample” anywhere in the CylinderExample/ directory tree - the example page says it should be in CylinderExample/build.

I also added specification for CMAKE_MODULE_PATH in CylinderExample/CMakeLists.txt:
set(CMAKE_MODULE_PATH “/usr/local/lib”)

find_package(VTK COMPONENTS 
  vtkCommonColor
  vtkCommonCore
  vtkFiltersSources
  vtkInteractionStyle
  vtkRenderingContextOpenGL2
  vtkRenderingCore
  vtkRenderingFreeType
  vtkRenderingGL2PSOpenGL2
  vtkRenderingOpenGL2 QUIET)

But running ‘cmake …’ again gives this error after pressing ‘c’:

Skipping CylinderExample: Could not find the VTK package with the following
 required components: RenderingContextOpenGL2.

I guess I am missing something pretty fundamental, but what?
Thanks!

It seems to me that you haven’t built VTK at all. If you have built it, then you need to check your paths. Look for a file called unix_path.sh this will tell you where LD_LIBRARY_PATH should point to.

There is nothing wrong with the VTK Examples code it builds and runs with all recent versions of VTK.

1 Like

With respect to finding the relevant modules for your VTK code there is a Python script:
Utilities/Maintenance/FindNeededModules.py that can do this. Be aware it needs modules.json found in the top-level of your build directory. Running it on the cylinder example will give you this:

find_package(VTK
 COMPONENTS
    CommonColor
    CommonCore
    FiltersSources
    RenderingCore
    # These modules are suggested since they implement an existing module.
    # Uncomment those you need.
    # InteractionStyle  # implements VTK::RenderingCore
    # RenderingFreeType # implements VTK::RenderingCore
    # RenderingOpenGL2  # implements VTK::RenderingCore
    # RenderingUI       # implements VTK::RenderingCore
)

1 Like