<div dir="ltr">Hi all,<div><br></div><div>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].  </div>
<div><br></div><div>VTK was configured with the following options:</div><div><br></div><div>CMAKE_PREFIX_PATH:PATH=/home/chris/Projects/qt-5.2.1-install/5.2.1/gcc_64/lib/cmake</div><div>BUILD_SHARED_LIBRARIES:BOOL=ON</div>
<div>VTK_QT_VERSION:STRING=5<br></div><div>QT_QMAKE_EXECUTABLE:PATH=/home/chris/Projects/qt-5.2.1-install/5.2.1/gcc_64/bin/qmake<br></div><div><br></div><div><b>The Problem</b></div><div><br></div><div>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:</div>
<div><br></div><div>/usr/bin/ld: error: cannot find -lQt5::Widgets<br></div><div><br></div><div>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:</div>
<div><br></div><div><div>/usr/bin/ld: error: cannot find -lQt5::WebKitWidgets</div><div>/usr/bin/ld: error: cannot find -lQt5::OpenGL</div><div>/usr/bin/ld: error: cannot find -lQt5::Widgets</div><div>/usr/bin/ld: error: cannot find -lQt5::Sql</div>
</div><div><br></div><div><b>Temporary Fix</b></div><div><br></div><div>By default, the line in the CMakeLists.txt for this example</div><div><br></div><div>find_package(VTK REQUIRED)</div><div><br></div><div>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</div>
<div><br></div><div><div>find_package(VTK COMPONENTS</div><div>     vtkCommonCore</div><div>     vtkIOImage</div><div>     vtkIOXML</div><div>     vtkImagingCore</div><div>    vtkInteractionWidgets</div><div>    vtkRenderingOpenGL</div>
<div>    REQUIRED</div><div>    )</div></div><div><br></div><div>However, it should be able to find Qt5::Widgets, especially since looking in the CMakeCache.txt for the VTK build, I see</div><div><br></div><div>Qt5Widgets_DIR:PATH=/home/chris/Projects/qt-5.2.1-install/5.2.1/gcc_64/lib/cmake/Qt5Widgets<br>
</div><div><br></div><div>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?</div>
<div><br></div><div>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.</div><div><br></div><div>
Thanks!</div><div><br></div><div><br></div><div><br></div><div>[1] <a href="http://qt-project.org/downloads">http://qt-project.org/downloads</a></div><div>[2] <a href="http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x64-5.2.1.run">http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x64-5.2.1.run</a></div>
<div>[3] <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistanceBetweenPoints">http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistanceBetweenPoints</a></div><div>[4] <a href="http://paraview.org/Wiki/ParaView:Build_And_Install#Environment_Variables">http://paraview.org/Wiki/ParaView:Build_And_Install#Environment_Variables</a><br clear="all">
<div><br></div>-- <br>Christopher Mullins<div>R&D Engineer</div><div>Kitware Inc.,</div><div>919.869.8871</div>
</div></div>