0

I tried to install opencv with VTK on Ubuntu. Actually I have succeeded in installing opencv only. But when I finished the make VTK and tried to make opencv, I got the following error when installing viz module.

> [ 71%] Building CXX object
> modules/viz/CMakeFiles/opencv_viz.dir/src/clouds.cpp.o
> /home/ycdfwzy/Documents/opencv-3.4.1/modules/viz/src/clouds.cpp: In
> constructor ‘cv::viz::WMesh::WMesh(const cv::viz::Mesh&)’:
> /home/ycdfwzy/Documents/opencv-3.4.1/modules/viz/src/clouds.cpp:447:16:
> error: invalid use of incomplete type ‘class vtkTexture’
>          texture->SetInputConnection(image_source->GetOutputPort());
>                 ^ In file included from /usr/local/include/vtk-9.0/vtkFollower.h:36:0,
>                  from /home/ycdfwzy/Documents/opencv-3.4.1/build/modules/viz/precomp.hpp:86:
> /usr/local/include/vtk-9.0/vtkActor.h:41:7: note: forward declaration
> of ‘class vtkTexture’  class vtkTexture;
>        ^ In file included from /usr/local/include/vtk-9.0/vtkGenericDataArray.h:70:0,
>                  from /usr/local/include/vtk-9.0/vtkAOSDataArrayTemplate.h:35,
>                  from /usr/local/include/vtk-9.0/vtkIntArray.h:33,
>                  from /usr/local/include/vtk-9.0/vtkCellTypes.h:42,
>                  from /usr/local/include/vtk-9.0/vtkPolyData.h:64,
>                  from /usr/local/include/vtk-9.0/vtkPolyDataAlgorithm.h:36,
>                  from /usr/local/include/vtk-9.0/vtkAppendPolyData.h:35,
>                  from /home/ycdfwzy/Documents/opencv-3.4.1/build/modules/viz/precomp.hpp:56:
> /usr/local/include/vtk-9.0/vtkSmartPointer.h: In instantiation of
> ‘static vtkSmartPointer<T> vtkSmartPointer<T>::New() [with T =
> vtkTexture]’:
> /home/ycdfwzy/Documents/opencv-3.4.1/modules/viz/src/clouds.cpp:446:76:
> required from here
> /usr/local/include/vtk-9.0/vtkSmartPointer.h:155:37: error: incomplete
> type ‘vtkTexture’ used in nested name specifier
>      return vtkSmartPointer<T>(T::New(), NoReference());
>                                      ^ /usr/local/include/vtk-9.0/vtkSmartPointer.h: In instantiation of ‘T*
> vtkSmartPointer<T>::operator->() const [with T = vtkTexture]’:
> /home/ycdfwzy/Documents/opencv-3.4.1/modules/viz/src/clouds.cpp:447:16:
> required from here
> /usr/local/include/vtk-9.0/vtkSmartPointer.h:130:40: error: invalid
> static_cast from type ‘vtkObjectBase* const’ to type ‘vtkTexture*’
>      return static_cast<T*>(this->Object);
>                                         ^ /usr/local/include/vtk-9.0/vtkSmartPointer.h: In instantiation of
> ‘vtkSmartPointer<T>::operator T*() const [with T = vtkTexture]’:
> /home/ycdfwzy/Documents/opencv-3.4.1/modules/viz/src/clouds.cpp:448:34:
> required from here
> /usr/local/include/vtk-9.0/vtkSmartPointer.h:113:40: error: invalid
> static_cast from type ‘vtkObjectBase* const’ to type ‘vtkTexture*’
>      return static_cast<T*>(this->Object);
>                                         ^ modules/viz/CMakeFiles/opencv_viz.dir/build.make:62: recipe for target
> 'modules/viz/CMakeFiles/opencv_viz.dir/src/clouds.cpp.o' failed
> make[2]: *** [modules/viz/CMakeFiles/opencv_viz.dir/src/clouds.cpp.o]
> Error 1 CMakeFiles/Makefile2:4082: recipe for target
> 'modules/viz/CMakeFiles/opencv_viz.dir/all' failed make[1]: ***
> [modules/viz/CMakeFiles/opencv_viz.dir/all] Error 2 Makefile:160:
> recipe for target 'all' failed make: *** [all] Error 2

Is there anyone who has gotten similar problem? How can I fix this?

ycdfwzy
  • 11
  • 3
  • You need to set the path to find `libpython2.7.so` on your system. Check [here](https://stackoverflow.com/a/49068482/8928024) how to solve it. – ZF007 Mar 12 '18 at 12:26
  • Thank you. But I have set the path. The problem is still unsolved. – ycdfwzy Mar 12 '18 at 13:09
  • vtk 9.0? at the website the latest version is 8.1.0.... version 7.1.1. has linux installer... You're an alpha/beta tester? VTK removed [this](https://www.vtk.org/files/release/9.0/VTK-9.0.0.tar.gz%27) link recently. – ZF007 Mar 12 '18 at 13:17
  • I have solved it. I think the vtk version is the key to this problem. I reinstall vtk 8.1.0 and compile it again. It works. I think maybe I got vtk 9.0 by this commands ```To update the code # git fetch origin # git rebase origin/master ``` from [here](https://www.vtk.org/Wiki/VTK/Configure_and_Build) – ycdfwzy Mar 13 '18 at 02:46
  • Nice to read v8.1. solved it all. Could you please report the vtk bug [here at github](https://github.com/Kitware/VTK)? If you do don't forget to implement a link to here. – ZF007 Mar 13 '18 at 10:55

0 Answers0