qtcreator Qt_5 not found

11,646

Solution 1

Qtcreator and rviz don't work because they require qt libs from /usr/lib/x86_64-linux-gnu but links with /usr/lib/libQt* instead (you can double check it using ldd $(which qtcreator) and ldd $(which rviz)). This mess indeed has lot to do with your camera package installation.

I see few ways to address this problem:

1. It looks like your linker prioritize /usr/lib over /usr/lib/x86_64-linux-gnu. Check your LD_LIBRARY_PATH:

echo $LD_LIBRARY_PATH

and if it contains a /usr/lib - try to get rid of it (you must track where you update your LD_LIBRARY_PATH - is it in .bashrc or somewhere else? maybe /etc/ld.so.conf.d?)

2. Set your LD_LIBRARY_PATH in .bashrc to point a valid qt dir. Remember to not override the variable, but rather extend it (put that at the end of ~/.bashrc):

export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH

then reload the .bashrc:

. ~/.bashrc

In your experiments, you did an override when launching qtcreator and rviz so only one of these two apps was working depend on what LD_LIBRARY_PATH you set.

Alternatively, you can add /usr/lib/x86_64-linux-gnu/ path in /etc/ld.so.conf.d/ - just create a new .conf file with qt path and reload everything with

sudo ldconfig

Using this method will propably break your camera package because from now on it will link with libs from your new path.

3. Temporary move Qt libraries supplied with camera package (/usr/lib/libQt*) to another location and check if spinview works fine with other version of qt than 5.7. If yes - you are free to delete qt5.7 libs from /usr/lib/ as they are not needed - no sophisticated uninstall process is necessary here. You can always restore it with your camera .deb package anyway.

Solution 2

I had a similar issue, which was eventually solved by running "LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/ qtcreator" instead of just "qtcreator". So thank you for the answer first of all

Some steps I took to understand the problem more deeply:

  • Examine which libraries are linked to qtcreator by running "ldd -v /usr/local/Qt/5.7/gcc_64/lib/libQt5Widgets.so.5" (the absolute path of the libQt5Widgets.so.5 specified in the "required by" error message)
  • Find out which versions are installed in the system by running "sudo find / -name libQt5Widgets.so*". Turns out, that I had three versions installed (5.5.1, 5.7.1 and 5.11.1). Currently, qtcreator used the 5.7.1 one (compare result of ldd with result of find)
  • Often, it is advised to install qt5-default alongside qtcreator (both using sudo apt install). Running "dpkg -s qt5-default" shows that it has the version 5.5.1. So it is likely that qtcreator wants the 5.5.1 library versions (even though I would have expected it to have worked with higher versions as well).
  • Make qtcreator use the 5.5.1 libraries by specifying their path through the environment variable LD_LIBRARY_PATH, that is run "LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/ qtcreator"
Share:
11,646
Martin Herrmann
Author by

Martin Herrmann

Updated on June 12, 2022

Comments

  • Martin Herrmann
    Martin Herrmann about 2 years

    Hello I have a problem starting qtcreator under Ubuntu 16.04. The reported error is:

    qtcreator: /usr/bin/../lib/x86_64-linux-gnu/qtcreator/../libQt5Gui.so.5: version `Qt_5_PRIVATE_API' not found (required by /usr/lib/libQt5Widgets.so.5)
    qtcreator: /usr/bin/../lib/x86_64-linux-gnu/qtcreator/../libQt5Gui.so.5: version `Qt_5' not found (required by /usr/lib/libQt5Widgets.so.5)
    

    I tried different solutions from other threads but can't make it. Can anyone help or explain what exactly the problem is? A few days ago I was able to run qtcreator, but when I tried today I got this error. I think it may correspond to the installation of some application, unfortunately I can't say which one, I had to install a few.

    Some more information:

    qmake --version
    QMake version 3.0
    Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu
    

    I have only qt versions installed from the official repositories, there are following files installed:

    • /usr/lib/libQt5Core.so.5.7.0
    • /usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.7
    • /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.5.1

    Could there be a configuration problem? Is there a way to reconfigure the paths?

    Probably interesting, too, the same moment I can't run qtcreator I can't run rviz from the ros-kinetic-package.

    rviz
    This application failed to start because it could not find or load the Qt platform plugin "xcb"
    in "".
    
    Reinstalling the application may fix this problem.
    Aborted (core dumped)
    

    I tried to purge rviz, ros, qtcreator and installed it again, I installed qt5-default, but couldn't solve my problem. Thank you for your help.

    Edit: Okay I took some time and tried the solution from here again: Error on execution -version `Qt_5' not found required by and this partially solves the problem. With LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/ qtcreator I can start qtcreator again. But this of course doesn't solve the problem at all, how can I reconfigure it.

    Edit 2: The LD_LIBRARY_PATH solution doesn't help for the rviz problem, it tells me:

    LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/ rviz
    rviz: error while loading shared libraries: librviz.so: cannot open shared object file: No such file or directory
    

    I then tried

    LD_LIBRARY_PATH=/opt/ros/kinetic/lib rviz
    

    which interestingly brought rviz to live.

    So it seems that my paths are confused, the question is why and how to repair them (does it help to move the Qt5.7 libs and links to another directory)?

    (Last thing to note, the other ros tools as rqt_console, rqt_plot, ... fail, too, if I don't add the LIBRARY_PATH in advance of the call.

    EDIT 3: So I think I found out a little more inside. I have a camera from FLIR, which uses a library called spinnaker. To install, one has to install a bunch of .deb packages. One of these is spinview_qt-.deb. It contains the QT5.7 version and installs to /usr/lib.

    dpkg --contents spinview-qt-1.10.0.31_amd64.deb 
    drwxr-xr-x root/root         0 2017-12-21 23:31 ./
    drwxr-xr-x root/root         0 2017-12-21 23:31 ./usr/
    drwxr-xr-x root/root         0 2017-12-21 23:31 ./usr/share/
    drwxr-xr-x root/root         0 2017-12-21 23:31 ./usr/share/pixmaps/
    -rw-r--r-- root/root    129041 2017-12-21 23:31 ./usr/share/pixmaps/SpinnakerIcon.ico
    drwxr-xr-x root/root         0 2017-12-21 23:31 ./usr/share/applications/
    -rw-r--r-- root/root       154 2017-12-21 23:31 ./usr/share/applications/spinview.desktop
    drwxr-xr-x root/root         0 2017-12-21 23:31 ./usr/share/doc/
    drwxr-xr-x root/root         0 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/
    -rw-r--r-- root/root      9190 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/Apache_2.0.txt
    -rw-r--r-- root/root    623763 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/Spinnaker-Open-Source-Licenses.pdf
    -rw-r--r-- root/root      1485 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/FreeBSD.txt
    -rw-r--r-- root/root     27032 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/lgpl_2.1.txt
    -rw-r--r-- root/root      1337 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/boost_license.txt
    -rw-r--r-- root/root       981 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/FLIR_license.txt
    -rw-r--r-- root/root      1597 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/genicam_license.txt
    -rw-r--r-- root/root       251 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/changelog.gz
    -rw-r--r-- root/root      5387 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/OpenTK_license.txt
    -rw-r--r-- root/root     17577 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/freeimage_license.txt
    -rw-r--r-- root/root     20993 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/WPCC_BY_SA_license.txt
    -rw-r--r-- root/root      7816 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/lgpl_3.0.txt
    -rw-r--r-- root/root     25864 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/lgpl_2.0.txt
    -rw-r--r-- root/root      2232 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/CLALLSERIAL_license.txt
    -rw-r--r-- root/root     10439 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/CPOL_1.02.txt
    drwxr-xr-x root/root         0 2017-12-21 23:31 ./usr/lib/
    -rw-r--r-- root/root   5339752 2017-12-21 22:48 ./usr/lib/libQt5Core.so.5.7.0
    -rw-r--r-- root/root  25047100 2017-12-21 22:48 ./usr/lib/libicudata.so.56.1
    -rw-r--r-- root/root   1365560 2017-12-21 22:48 ./usr/lib/libQt5XcbQpa.so.5.7.0
    -rw-r--r-- root/root   1432320 2017-12-21 22:48 ./usr/lib/libQt5Network.so.5.7.0
    -rw-r--r-- root/root   5909528 2017-12-21 22:48 ./usr/lib/libQt5Gui.so.5.7.0
    -rw-r--r-- root/root    356208 2017-12-21 22:48 ./usr/lib/libQt5OpenGL.so.5.7.0
    -rw-r--r-- root/root   6614408 2017-12-21 22:48 ./usr/lib/libQt5Widgets.so.5.7.0
    -rw-r--r-- root/root   3374854 2017-12-21 22:48 ./usr/lib/libicui18n.so.56.1
    -rw-r--r-- root/root   2070162 2017-12-21 22:48 ./usr/lib/libicuuc.so.56.1
    -rw-r--r-- root/root    527104 2017-12-21 22:48 ./usr/lib/libQt5DBus.so.5.7.0
    drwxr-xr-x root/root         0 2017-12-21 23:31 ./usr/bin/
    -rwxr-xr-x root/root    852544 2017-12-21 23:07 ./usr/bin/SpinView_QT
    drwxr-xr-x root/root         0 2017-12-20 02:45 ./usr/bin/platforms/
    -rw-r--r-- root/root    303544 2017-12-20 02:45 ./usr/bin/platforms/libqlinuxfb.so
    -rw-r--r-- root/root     10192 2017-12-20 02:45 ./usr/bin/platforms/libqxcb.so
    -rw-r--r-- root/root    141072 2017-12-20 02:45 ./usr/bin/platforms/libqoffscreen.so
    -rw-r--r-- root/root    176720 2017-12-20 02:45 ./usr/bin/platforms/libqminimalegl.so
    -rw-r--r-- root/root    140592 2017-12-20 02:45 ./usr/bin/platforms/libqminimal.so
    -rw-r--r-- root/root      9968 2017-12-20 02:45 ./usr/bin/platforms/libqeglfs.so
    -rwxr-xr-x root/root        70 2017-12-20 02:47 ./usr/bin/spinview
    lrwxrwxrwx root/root         0 2017-12-21 23:31 ./usr/share/doc/spinview-qt1/LICENSE -> FLIR_license.txt
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5XcbQpa.so.5 -> libQt5XcbQpa.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5Gui.so.5.7 -> libQt5Gui.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5XcbQpa.so.5.7 -> libQt5XcbQpa.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5Network.so.5 -> libQt5Network.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5Gui.so -> libQt5Gui.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5XcbQpa.so -> libQt5XcbQpa.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5OpenGL.so.5.7 -> libQt5OpenGL.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5Network.so -> libQt5Network.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5Gui.so.5 -> libQt5Gui.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5DBus.so -> libQt5DBus.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5Core.so -> libQt5Core.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5Widgets.so.5 -> libQt5Widgets.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5OpenGL.so -> libQt5OpenGL.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libicuuc.so.56 -> libicuuc.so.56.1
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5Network.so.5.7 -> libQt5Network.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5Core.so.5.7 -> libQt5Core.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libicudata.so.56 -> libicudata.so.56.1
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5DBus.so.5 -> libQt5DBus.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5Widgets.so -> libQt5Widgets.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5Widgets.so.5.7 -> libQt5Widgets.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5DBus.so.5.7 -> libQt5DBus.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libicui18n.so.56 -> libicui18n.so.56.1
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5OpenGL.so.5 -> libQt5OpenGL.so.5.7.0
    lrwxrwxrwx root/root         0 2017-12-21 22:48 ./usr/lib/libQt5Core.so.5 -> libQt5Core.so.5.7.0
    

    I think the problem may be that Ubuntu tries to find QT5 in /usr/bin before it looks in /usr/lib/x86_64-linux-gnu. So my question is, how can I achieve Ubuntu using the QT5.5.1 version as default again? Can I configure it or do I have to add the LD_LIBRARY_PATH always now? How can I uninstall the QT5.7 lib? Just delete the files listed above?

    • BillyJoe
      BillyJoe about 6 years
      You need to use ldd <executable> to know the exact path of libraries that your executable is trying to load. Also, to change those paths you can add a <whatever>.conf file in /etc/ld.so.conf.d with a row for each library path, then run ldconfig . The order in which these files are processed is alphabetic and they should precede /lib and /usr/lib but follow LD_LIBRARY_PATH specified in the command line.
  • Martin Herrmann
    Martin Herrmann about 6 years
    Hi thank you very much for your elaborate answer, it helped me a lot, in the end, there was a link to /usr/lib in my .bashrc which I wasn't aware of. Deleting it helped. But can you add some information or informative link about the /etc/ld.so.conf.d/ How is it thought to work and what is the intention of this directory?