Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined reference to `vtkRenderingOpenGL2_AutoInit_Destruct()' #18

Open
zltnl opened this issue Mar 23, 2020 · 7 comments
Open

undefined reference to `vtkRenderingOpenGL2_AutoInit_Destruct()' #18

zltnl opened this issue Mar 23, 2020 · 7 comments

Comments

@zltnl
Copy link

zltnl commented Mar 23, 2020

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 to vtkRenderingOpenGL2_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 to vtkRenderingOpenGL2_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
Copy link

Any luck ? I'm facing the same issue

@Ramkumar47
Copy link

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
Copy link

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

@Ramkumar47
Copy link

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
Copy link

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!

@mw9385
Copy link

mw9385 commented Jul 6, 2022

I solved it by following your comments. Thank you!

@ZhanyuGuo
Copy link

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)
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants