PallavBakshi
PallavBakshi

Reputation: 564

Make linker find qt5

I am new to computing world. I am trying to install iai kinect2 drivers but while executing the catkin_make -DCMAKE_BUILD_TYPE="Release" step I get the following error:

/usr/bin/ld: cannot find -lQt5::Core
/usr/bin/ld: cannot find -lQt5::Gui
/usr/bin/ld: cannot find -lQt5::Widgets
/usr/bin/ld: cannot find -lQt5::Test
/usr/bin/ld: cannot find -lQt5::Concurrent
/usr/bin/ld: cannot find -lQt5::OpenGL
collect2: error: ld returned 1 exit status
make[2]: *** [/home/pb/catkin_ws/devel/lib/libkinect2_registration.so] Error 1
make[1]: *** [iai_kinect2/kinect2_registration/CMakeFiles/kinect2_registration.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

After doing a lot of stackoverflowing I figured out that either the qt5 is not downloaded or downloaded in some other directory or conflicting with other version of qt4. Some of the pages on github also suggested a patch but that was for another package.

I have already installed qt5 but in my home directory since I followed the steps on the Qt5 webpage. Now how can I add the path of installed Qt5 libraries so that the linker (ld) can find the required files.

Useful links - Qt5 linker issue, Linker error cannot find lqt5::Widgets, similar error launchpad bug report

Note - I am using Ubuntu 14.04, in case you want me to update some $VAR then kindly suggest its name like $LIBRARY_DIR. And if you want me to add the -DVAR='path' to catkin_make then also suggest a proper variable name that I need to add.

Thank you so much!! :D

Upvotes: 2

Views: 2152

Answers (2)

Benyamin Jafari
Benyamin Jafari

Reputation: 34046

I had same problem.
You can follow the steps given below for fixing the problem:

Firstly download the necessary libraries:

sudo apt-get install libqt5concurrent5
sudo apt-get install libqt5test5
sudo apt-get install libqt5core5a
sudo apt-get install libqt5opengl5
sudo apt-get install qtdeclarative5-dev

Then add these lines to '<consider-package>/CMakeLists.txt':

find_package(Qt5Gui)
find_package(Qt5Core)
find_package(Qt5Widgets)
find_package(Qt5Test)
find_package(Qt5Concurrent)
find_package(Qt5OpenGL)

Finally do catkin_make.

Upvotes: 0

Fabius Wiesner
Fabius Wiesner

Reputation: 926

What about just installing qtbase5-dev package (should be Qt 5.2.1 for Ubuntu 14.04):

sudo apt-get install qtbase5-dev

instead of your installation of Qt5?

In case you prefer to just fix the library path you can add a file whatever.conf in /etc/ld.so.conf.d adding one or more rows with pathnames for the libraries. After that, run ldconfig in there.

Upvotes: 1

Related Questions