sikang / mpl_ros

A ROS wrapper for trajectory planning based on motion primitives
Apache License 2.0
581 stars 148 forks source link

undefined reference to `vtkRenderingOpenGL2_AutoInit_Destruct()' #18

Open zltnl opened 4 years ago

zltnl commented 4 years ago

Dear sikang CMakeFiles/mesh_sampling.dir/src/mapping_utils/mesh_sampling.cpp.o: In function vtkRenderingCore_AutoInit::~vtkRenderingCore_AutoInit()': mesh_sampling.cpp:(.text._ZN25vtkRenderingCore_AutoInitD2Ev[_ZN25vtkRenderingCore_AutoInitD5Ev]+0x13): undefined reference tovtkRenderingOpenGL2_AutoInit_Destruct()' CMakeFiles/mesh_sampling.dir/src/mapping_utils/mesh_sampling.cpp.o: In function _GLOBAL__sub_I__Z16uniform_sampling15vtkSmartPointerI11vtkPolyDataEmRN3pcl10PointCloudINS2_8PointXYZEEE': mesh_sampling.cpp:(.text.startup+0x10c4): undefined reference tovtkRenderingOpenGL2_AutoInit_Construct()' collect2: error: ld returned 1 exit status CMakeFiles/mesh_sampling.dir/build.make:334: recipe for target '/home/zlt/z0323test/devel_isolated/planning_ros_utils/lib/planning_ros_utils/mesh_sampling' failed make[2]: [/home/zlt/z0323test/devel_isolated/planning_ros_utils/lib/planning_ros_utils/mesh_sampling] Error 1 CMakeFiles/Makefile2:685: recipe for target 'CMakeFiles/mesh_sampling.dir/all' failed make[1]: [CMakeFiles/mesh_sampling.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....

what should i do to make it work ?

MohamadHalwani commented 4 years ago

Any luck ? I'm facing the same issue

Ramkumar47 commented 3 years ago

yeah me too.. same issue.. but @MohamadHalwani i saw ur post on stackoverflow about the same and there u mentioned like u installed some VTK library and it solved the issue.. could u plz tell us the exact library(s) u installed and the linux distro that u use?.. i am using openSUSE and i think i can find the equivalent library for this and solve the issue.. by the way, u compiled paraview completly and make it work?

Ramkumar47 commented 3 years ago

but in my case, i am not getting single line of "undefined reference" thing, but a bunch of 100 lines..

Ramkumar47 commented 3 years ago

here is the log file of compilation on my machine

paraview.log

please let me know if u find something.. if i compiled paraview with python support successfully means, i will settle on this distribution itself.. because of this one thing, i am distro hopping

08beeqtufail-sudo commented 3 years ago

Hello everyone, If this issue is not yet solved, here's why it was happening for me and how i solved it: Why:

mw9385 commented 2 years ago

I solved it by following your comments. Thank you!

ZhanyuGuo commented 8 months ago

Hello everyone, If this issue is not yet solved, here's why it was happening for me and how i solved it: Why:

  • The basic reason was that the 'correct' VTK couldn't be found.
  • If you don't have VTK installed, just install it (version 6.3 worked for me) Otherwise, it means that the VTK cannot be found by cmake. In that case:
  • Go to the CMakeLists.txt file of package planning_ros_utils
  • Add the following command after the set(CMAKE_CXX_FLAG .....) line: set(VTK_DIR "/usr/lib/cmake/vtk-6.3" CACHE PATH "VTK directory override" FORCE) The path should be the path to VTKConfig.cmake file. In my case, this file was found at /usr/lib/cmake/vtk-6.3. This command sets the correct VTK directory. -Retry the build process, now it should work. Cheers!

Thanks for saving my time, and in my case, I need to add another command in the file:

...
if(NOT VTK_FOUND)
  set(DEFAULT FALSE)
  set(REASON "VTK was not found.")
  message("VTK was not found")
else(NOT VTK_FOUND)
  include(${VTK_USE_FILE})
  cs_add_executable(mesh_sampling src/mapping_utils/mesh_sampling.cpp)

  # NOTE HERE
  target_link_libraries(mesh_sampling
    ${VTK_LIBRARIES})

endif(NOT VTK_FOUND)
...