Linker error "cannot find -lqt5::widgets"

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Linker error "cannot find -lqt5::widgets"

Postby shoogen » Sun May 08, 2016 10:20 am

Hello,
I'm trying to build FreeCAD (branch "occt7bernd" ) on Debian 8.4. But i keep getting the error message "/usr/bin/ld: cannot find -lQt5::Widgets".
It seems to me that the trouble starts already with cmake:
CMake Warning (dev) at src/Mod/MeshPart/Gui/CMakeLists.txt:62 (add_library):

Code: Select all

  Policy CMP0028 is not set: Double colon in target name means ALIAS or
  IMPORTED target.  Run "cmake --help-policy CMP0028" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  Target "MeshPartGui" links to target "Qt5::Widgets" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
This warning is for project developers.  Use -Wno-dev to suppress it.
I tried

Code: Select all

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6f760fe..ae86dd2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,9 @@ if(COMMAND cmake_policy)
     if(POLICY CMP0050)
         cmake_policy(SET CMP0050 OLD)
     endif(POLICY CMP0050)
+    if(POLICY CMP0028)
+        cmake_policy(SET CMP0028 OLD)
+    endif(POLICY CMP0028)
 endif(COMMAND cmake_policy)
But it don't improve the situation.
Did anyone encounter the same problem and has an idea how to solve it?
User avatar
f3nix
Posts: 299
Joined: Sat May 30, 2015 11:58 am

Re: Linker error "cannot find -lqt5::widgets"

Postby f3nix » Sun May 08, 2016 10:45 am

Hi!
It looks like some dependency is built with Qt5 support (which is not supported). Possibly OpenCascade... Have not tried it yet. Just a guess.

Cheers,
Mateusz
User avatar
f3nix
Posts: 299
Joined: Sat May 30, 2015 11:58 am

Re: Linker error "cannot find -lqt5::widgets"

Postby f3nix » Sun May 08, 2016 10:51 am

Maybe grepping the CMakeCache.txt for Qt5 could reveal the problematic library...
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Linker error "cannot find -lqt5::widgets"

Postby shoogen » Sun May 08, 2016 12:33 pm

f3nix wrote:It looks like some dependency is built with Qt5 support (which is not supported).
I'd rather suspect PCL or VTK stuff in PCL
kuroshivo
Posts: 39
Joined: Mon Dec 22, 2014 3:16 pm
Contact:

Re: Linker error "cannot find -lqt5::widgets"

Postby kuroshivo » Mon Jul 11, 2016 3:14 pm

hi!
I am having the same issue...
were you able to solve it shoogen?

thanks!
ulrich1a
Posts: 1872
Joined: Sun Jul 07, 2013 12:08 pm

Re: Linker error "cannot find -lqt5::widgets"

Postby ulrich1a » Mon Jul 11, 2016 3:56 pm

kuroshivo wrote:hi!
I am having the same issue...
were you able to solve it
On Debian it seems to be caused by the dependency of the new Smesh-version, which needs VTK. The VTK shipped with Debian is linked against QT5. So there is the need to compile VTK without dependency to QT5.
Look up the following thread: viewtopic.php?f=4&t=16428


Ulrich
kuroshivo
Posts: 39
Joined: Mon Dec 22, 2014 3:16 pm
Contact:

Re: Linker error "cannot find -lqt5::widgets"

Postby kuroshivo » Tue Jul 12, 2016 1:55 pm

ulrich1a wrote: On Debian it seems to be caused by the dependency of the new Smesh-version, which needs VTK. The VTK shipped with Debian is linked against QT5. So there is the need to compile VTK without dependency to QT5.
Ulrich
I managed to get FreeCAD back running without manually re-compiling VTK by not building some workbenches:

Code: Select all

cmake -DBUILD_FEM=OFF -DBUILD_ARCH=OFF -DBUILD_COMPLETE=OFF -DBUILD_INSPECTION=OFF -DBUILD_OPENSCAD=OFF -DBUILD_REVERSEENGINEERING=OFF -DBUILD_MESH=OFF -DBUILD_MESH_PART=OFF ..
But I miss them :-(
Will be there any workaround for this issue?
ickby
Posts: 2914
Joined: Wed Oct 05, 2011 7:36 am

Re: Linker error "cannot find -lqt5::widgets"

Postby ickby » Tue Jul 12, 2016 2:50 pm

actually having vtk linked to qt5 is not an issue as long as one does not try to import the python bindings into freecad. The way we use vtk it is not of interest if it is linked to qt4 or qt5. Now if you install VTK in debian and it gives you such a linker error than it clearly is a packaging problem in debian, as the dev packages of VTK should pull in all dependencies. Did you try to install QT5 manually?
ulrich1a
Posts: 1872
Joined: Sun Jul 07, 2013 12:08 pm

Re: Linker error "cannot find -lqt5::widgets"

Postby ulrich1a » Tue Jul 12, 2016 2:58 pm

kuroshivo wrote:Will be there any workaround for this issue?
Compiling VTK was the fastest workaround for me. Here is the recipe given by vejmarie:

Code: Select all

wget http://www.vtk.org/files/release/7.0/VTK-7.0.0.tar.gz
tar xzf VTK-7.0.0.tar
rm VTK-7.0.0.tar
cd VTK-7.0.0
mkdir build
cd build
cmake .. -DVTK_Group_Rendering:BOOL=OFF -DVTK_Group_StandAlone:BOOL=ON -DVTK_RENDERING_BACKEND=None
make -j 2
sudo make install
Then do

Code: Select all

cmake-gui .
in the FreeCAD-build-folder and look up the row with the vtk-definitions. Change this setting, so that it links to the new VTK7 library in /usr/local/...

Ulrich
kuroshivo
Posts: 39
Joined: Mon Dec 22, 2014 3:16 pm
Contact:

Re: Linker error "cannot find -lqt5::widgets"

Postby kuroshivo » Tue Jul 12, 2016 3:47 pm

ickby wrote:Now if you install VTK in debian and it gives you such a linker error than it clearly is a packaging problem in debian, as the dev packages of VTK should pull in all dependencies. Did you try to install QT5 manually?
No, I did not try to install QT5 manually. I have these packages already installed:

Code: Select all

$ dpkg -l *qt5*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                              Version               Architecture          Description
+++-=================================-=====================-=====================-=======================================================================
ii  libqt5clucene5:amd64              5.3.2-3               amd64                 Qt 5 CLucene module
ii  libqt5concurrent5:amd64           5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 concurrent module
un  libqt5core5                       <none>                <none>                (no description available)
ii  libqt5core5a:amd64                5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 core module
ii  libqt5dbus5:amd64                 5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 D-Bus module
ii  libqt5designer5:amd64             5.3.2-3               amd64                 Qt 5 designer module
ii  libqt5designercomponents5:amd64   5.3.2-3               amd64                 Qt 5 Designer components module
ii  libqt5gui5:amd64                  5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 GUI module
ii  libqt5help5:amd64                 5.3.2-3               amd64                 Qt 5 help module
ii  libqt5multimedia5:amd64           5.3.2-5               amd64                 Qt 5 Multimedia module
ii  libqt5multimediawidgets5:amd64    5.3.2-5               amd64                 Qt 5 Multimedia Widgets module
ii  libqt5network5:amd64              5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 network module
ii  libqt5opengl5:amd64               5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 OpenGL module
ii  libqt5opengl5-dev:amd64           5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 OpenGL library development files
ii  libqt5printsupport5:amd64         5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 print support module
ii  libqt5qml5:amd64                  5.3.2-4               amd64                 Qt 5 QML module
ii  libqt5quick5:amd64                5.3.2-4               amd64                 Qt 5 Quick library
ii  libqt5sql5:amd64                  5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 SQL module
un  libqt5sql5-ibase                  <none>                <none>                (no description available)
un  libqt5sql5-mysql                  <none>                <none>                (no description available)
un  libqt5sql5-odbc                   <none>                <none>                (no description available)
un  libqt5sql5-psql                   <none>                <none>                (no description available)
ii  libqt5sql5-sqlite:amd64           5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 SQLite 3 database driver
ii  libqt5svg5:amd64                  5.3.2-2               amd64                 Qt 5 SVG module
ii  libqt5svg5-dev:amd64              5.3.2-2               amd64                 Qt 5 SVG module development files
ii  libqt5test5:amd64                 5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 test module
ii  libqt5webkit5:amd64               5.3.2+dfsg-4          amd64                 Web content engine library for Qt
ii  libqt5widgets5:amd64              5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 widgets module
un  libqt5x11extras-dev               <none>                <none>                (no description available)
ii  libqt5x11extras5:amd64            5.3.2-2               amd64                 Qt 5 X11 extras
ii  libqt5x11extras5-dev:amd64        5.3.2-2               amd64                 Qt 5 X11 extras development files
ii  libqt5xml5:amd64                  5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 XML module
ii  pyqt5-dev                         5.3.2+dfsg-3          all                   Development files for PyQt5
ii  python-pyqt5                      5.3.2+dfsg-3          amd64                 Python bindings for Qt5
un  python-pyqt5-dbg                  <none>                <none>                (no description available)
ii  qt5-default                       5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 development defaults package
ii  qt5-qmake:amd64                   5.3.2+dfsg-4+deb8u1   amd64                 Qt 5 qmake Makefile generator tool
And I still get

Code: Select all

$ make
[  0%] Built target Driver
Linking CXX shared library ../../../lib/libSMDS.so
/usr/bin/ld: cannot find -lQt5::Widgets
collect2: error: ld returned 1 exit status
src/3rdParty/salomesmesh/CMakeFiles/SMDS.dir/build.make:1353: recipe for target 'lib/libSMDS.so' failed
make[2]: *** [lib/libSMDS.so] Error 1
CMakeFiles/Makefile2:460: recipe for target 'src/3rdParty/salomesmesh/CMakeFiles/SMDS.dir/all' failed
make[1]: *** [src/3rdParty/salomesmesh/CMakeFiles/SMDS.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2
I will try to manually compile VTK7 (hoping it does not break my existing paraview).