1

Using VTK 6.2, there are multiple link errors when trying to make a project:

/usr/bin/ld: cannot find -lvtkWrappingTools /usr/bin/ld: cannot find -lvtkGUISupportQt /usr/bin/ld: cannot find -lvtkWrappingPythonCore /usr/bin/ld: cannot find -lvtkFiltersPython /usr/bin/ld: cannot find -lvtkGUISupportQtSQL /usr/bin/ld: cannot find -lvtkRenderingQt /usr/bin/ld: cannot find -lvtkglew /usr/bin/ld: cannot find -lvtkGUISupportQtOpenGL /usr/bin/ld: cannot find -lvtkLocalExample /usr/bin/ld: cannot find -lvtkViewsQt /usr/bin/ld: cannot find -lvtkoggtheora /usr/bin/ld: cannot find -lvtkGUISupportQtWebkit 

Problem:

Unresolved linker errors. This may be a path issue, since the libraries appear to be present in /usr/local/ but are not seen by ld at compile time...

Background information:

VTK was configured as an out-of-source CMake build (no problems) followed by make and make install so that all of the libraries are correctly placed in /usr/local/lib.

My project build now uses the following CMakeLists.txt:

# Add VTK, insist that it uses 6.2, find_package(VTK 6.2 EXACT REQUIRED NO_MODULE) include(${VTK_USE_FILE}) find_package(GLEW REQUIRED) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${VTK_DEFINITIONS}) include_directories( ${VTK_INCLUDE_DIRS} ${GLEW_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) #################### # Make my_target #################### set(EXE my_target) set(SOURCES my_target.cpp ) add_executable(${EXE} ${SOURCES}) target_link_libraries(${EXE} ${VTK_LIBRARIES} ${GLEW_LIBRARY} ) ################### 

1 Answer 1

4

Change the find_package parameters to specify just the modules that you want. For example:

find_package(VTK 6.2 EXACT REQUIRED COMPONENTS vtkRenderingOpenGL vtkInteractionStyle NO_MODULE) 

This 'fix' took some time to find. It looks like the default behaviour is for CMake to include all VTK modules ... some of which may not exist. If you specify components then the default behaviour is disabled. Unfortunately, it can be quite difficult to know what libraries to include, and so it would be nice to have the default "include everything" behaviour working!

My simple program didn't use Python or Qt, but ld still wants to resolve those basic libraries. This appears to be normal behaviour even when VTK is built without the Qt or Python modules.

This may be a bug in VTK 6.2. I'll raise it with Kitware, and revise the answer as/when new info is available...

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.