Why do I get build error "class vtkOBJExporter has no member named SetOBJFileComment" when building Slicer against Qt4?

On linux mint/ubuntu 16.04, GCC 5.4.0

I got error:

[ 24%] Building CXX object Libs/MRML/Core/CMakeFiles/MRMLCore.dir/vtkMRMLProceduralColorNode.cxx.o
/home/gaoyi/usr/work/namic/rls20180330/Slicer/Libs/MRML/Core/vtkMRMLModelStorageNode.cxx: In member function ‘virtual int vtkMRMLModelStorageNode::WriteDataInternal(vtkMRMLNode*)’:
/home/gaoyi/usr/work/namic/rls20180330/Slicer/Libs/MRML/Core/vtkMRMLModelStorageNode.cxx:504:15: error: ‘class vtkOBJExporter’ has no member named ‘SetOBJFileComment’
exporter->SetOBJFileComment(header.c_str());
^
[ 24%] Building CXX object Libs/MRML/Core/CMakeFiles/MRMLCore.dir/vtkMRMLProceduralColorStorageNode.cxx.o
[ 24%] Building CXX object Libs/MRML/Core/CMakeFiles/MRMLCore.dir/vtkMRMLROIListNode.cxx.o
Libs/MRML/Core/CMakeFiles/MRMLCore.dir/build.make:998: recipe for target ‘Libs/MRML/Core/CMakeFiles/MRMLCore.dir/vtkMRMLModelStorageNode.cxx.o’ failed
make[5]: *** [Libs/MRML/Core/CMakeFiles/MRMLCore.dir/vtkMRMLModelStorageNode.cxx.o] Error 1
make[5]: *** Waiting for unfinished jobs…
CMakeFiles/Makefile2:1275: recipe for target ‘Libs/MRML/Core/CMakeFiles/MRMLCore.dir/all’ failed
make[4]: *** [Libs/MRML/Core/CMakeFiles/MRMLCore.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs…
[ 24%] Linking CXX static library …/…/…/lib/Slicer-4.9/libBRAINSDemonWarpTemplatesLIB.a
[ 24%] Built target BRAINSDemonWarpTemplatesLIB
Makefile:149: recipe for target ‘all’ failed
make[3]: *** [all] Error 2
CMakeFiles/Slicer.dir/build.make:142: recipe for target ‘Slicer-prefix/src/Slicer-stamp/Slicer-build’ failed
make[2]: *** [Slicer-prefix/src/Slicer-stamp/Slicer-build] Error 2
CMakeFiles/Makefile2:96: recipe for target ‘CMakeFiles/Slicer.dir/all’ failed
make[1]: *** [CMakeFiles/Slicer.dir/all] Error 2
Makefile:83: recipe for target ‘all’ failed
make: *** [all] Error 2

Yesterday it was fine so I checked the git log, seems there are some major changes with VTK in 4ac140217b2b564c7fed7226706616d8523bb4b1

Thanks for any hint!

Best,
yi

This happens because you build Slicer against Qt4 + VTK7.

I suggest you build against Qt5. Simply doing a clean build passing -DQt5_DIR:PATH=/path/to/lib/cmake/Qt5 should be sufficient.

That said, I will fix the error because code up to the next release (Slicer 4.10.0) that will be cut tonight or tomorrow will be the last one to support compiling against both Qt4/VTK7 and Qt5/VTK9.

2 posts were split to a new topic: Should I build Qt 5.10 from source on Linux?