[vtk-developers] Qt5 linker issues

Christopher Mullins christopher.mullins at kitware.com
Fri May 2 14:39:33 EDT 2014


Hi all,

I've discovered an issue with linking against a VTK build configured with
Qt5 on Linux.  Qt5 was installed from [1] using the installer link Qt5.2.1
for Linux 64-bit [2].

VTK was configured with the following options:

CMAKE_PREFIX_PATH:PATH=/home/chris/Projects/qt-5.2.1-install/5.2.1/gcc_64/lib/cmake
BUILD_SHARED_LIBRARIES:BOOL=ON
VTK_QT_VERSION:STRING=5
QT_QMAKE_EXECUTABLE:PATH=/home/chris/Projects/qt-5.2.1-install/5.2.1/gcc_64/bin/qmake

*The Problem*

Now, I want to build a simple example.  I'll use DistanceBetweenPoints [3].
 When I configure with VTK_DIR:PATH=/home/chris/Projects/VTK-with-qt5 there
are no errors.  When I build with make I get the following error:

/usr/bin/ld: error: cannot find -lQt5::Widgets

If I do the same thing, except configuring VTK with
BUILD_SHARED_LIBS:BOOL=OFF instead, I get this error with 3 additional
libraries it can't find:

/usr/bin/ld: error: cannot find -lQt5::WebKitWidgets
/usr/bin/ld: error: cannot find -lQt5::OpenGL
/usr/bin/ld: error: cannot find -lQt5::Widgets
/usr/bin/ld: error: cannot find -lQt5::Sql

*Temporary Fix*

By default, the line in the CMakeLists.txt for this example

find_package(VTK REQUIRED)

will link against all of the libraries VTK was configured to find, so I can
fix the error by replacing this line with something like

find_package(VTK COMPONENTS
     vtkCommonCore
     vtkIOImage
     vtkIOXML
     vtkImagingCore
    vtkInteractionWidgets
    vtkRenderingOpenGL
    REQUIRED
    )

However, it should be able to find Qt5::Widgets, especially since looking
in the CMakeCache.txt for the VTK build, I see

Qt5Widgets_DIR:PATH=/home/chris/Projects/qt-5.2.1-install/5.2.1/gcc_64/lib/cmake/Qt5Widgets

which is correct. Manipulating the environment variables as detailed here
[4] on the Paraview wiki yields the same results.  Has anyone encountered
this?  Have I configured something incorrectly, or is this a bug in the
UseVTK file somewhere?

As a side note, I'm currently redoing the documentation on building with Qt
so please pass me any good sources you have used when encountering this
problem, or similar ones.

Thanks!



[1] http://qt-project.org/downloads
[2]
http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x64-5.2.1.run
[3]
http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistanceBetweenPoints
[4]
http://paraview.org/Wiki/ParaView:Build_And_Install#Environment_Variables

-- 
Christopher Mullins
R&D Engineer
Kitware Inc.,
919.869.8871
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtk-developers/attachments/20140502/636ab6d4/attachment-0001.html>


More information about the vtk-developers mailing list