1

I want to run an application based on Qt5 shared objects. Although I have apt installed qt5-default, qttools5-dev and qttools5-dev-tools I get the error bellow:

/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.7' not found
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found
/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found
/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5: version `Qt_5' not found

I have also tried to change some environment variables as LD_LIBRARY_PATH and DYLD_LIBRARY_PATH, resulted in no success!

What do you suggest?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241

1 Answers1

0

When you built your application, which version of Qt5 did you build against? You can see this in QtCreator by looking at the currently selected kit:

enter image description here

If you just installed QtCreator from binary, it is shipped with it's own set of Qt5 shared libraries that your application is linked against, however your OS' version of those libraries (those installed from apt-get and similar) may not match.

When you try to run the application on it's own outside QtCreator, it may try to link against the OS version of the libs which are usually much older.

There are many ways to resolve this. One way, which would be preferred if you don't care for the newest version of Qt, is simply building towards the Qt libs supploed by the OS. You can do this by creating a new kit that specifies to build against the OS' libraries following this procedure.

Another way is shipping the shared libraries that you used from QtCreator together with the application so that those will override the OS ones. Usually just chucking them into the same folder as the executable will do the trick, as they will be found before the ones under /usr/lib/whatever etc.

Yet another way is to build your own static version of Qt and link with that. This has some benefits and some drawbacks. This is an advanced topic, so I won't go into detail (you can see here). But in this case the Qt libs are built into your app and will not depend on any external Qt libs version.

Mr. Developerdude
  • 9,118
  • 10
  • 57
  • 95