Can't run Qt apps: version `Qt_5' not foun

2019-07-07 17:25发布

问题:

I run Ubuntu 16.04 LTS. My problem is that I am not able to run a Qt5 app, which I can compile.

This is what I get when I try to run it:

/home/user/Desktop/sconfig/dist/Release/GNU-Linux/SCongif: /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5: version `Qt_5' not found (required by /home/user/Desktop/sconfig/dist/Release/GNU-Linux/SCongif)
/home/user/Desktop/sconfig/dist/Release/GNU-Linux/SCongif: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /home/user/Desktop/sconfig/dist/Release/GNU-Linux/SCongif)
/home/user/Desktop/sconfig/dist/Release/GNU-Linux/SCongif: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.6' not found (required by /home/user/Desktop/sconfig/dist/Release/GNU-Linux/SCongif)
/home/user/Desktop/sconfig/dist/Release/GNU-Linux/SCongif: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by /home/user/Desktop/sconfig/dist/Release/GNU-Linux/SCongif)
/home/user/Desktop/sconfig/dist/Release/GNU-Linux/SCongif: /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5: version `Qt_5' not found (required by /home/user/Desktop/sconfig/dist/Release/GNU-Linux/SCongif)

I then removed Qt5 and purged all the remnants. Then I installed again Qt5.

user@user-P64V7:~$ which qmake
/home/user/Qt5.8.0/5.8/gcc_64/bin/qmake
user@user-P64V7:~$ qmake --version
QMake version 3.1
Using Qt version 5.8.0 in /home/user/Qt5.8.0/5.8/gcc_64/lib
user@user-P64V7:~$ echo $PATH
/home/user/Qt5.8.0/5.8/gcc_64/bin:/home/user/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

It could also be worth noting that I use Netbeans 8.2 and the QMake command is

/home/user/Qt5.8.0/5.8/gcc_64/bin/qmake

Any idea what I could be doing wrong?

Thanks a lot!

回答1:

So I figured out an answer according to these two previous questions:

  • Error on execution -version `Qt_5' not found required by
  • How to set the environmental variable LD_LIBRARY_PATH in linux

To summarize, to add the libraries the right way, one should add a custom .conf file to the folder /etc/ld.so.conf.d containing all the absolute paths to library folders and then run sudo ldconfig. :)



回答2:

cpu: armv8 os: Linux kylin.5.desktop-generic upgrade from 5.6 to 5.9

Similar situations will appear after the program is released.

solution:

  1. copy /usr/local/Qt-5.9.2 to /usr/local/ in target pc.

  2. qtchooser -install qt5.9 /usr/local/Qt5.9.1/5.9.1/gcc_64/bin/qmake

  3. sudo bash -c "echo export QT_SELECT=qt5.9 >> /etc/profile"

  4. sudo ldconfig -v



标签: qt qt5 qmake