[osg-users] osgQt versioning problem

Jan Ciger jan.ciger at gmail.com
Thu Jun 11 14:05:28 PDT 2015

Hash: SHA1

On 06/11/2015 10:19 PM, Jannik Heller wrote:
> Hi,
> Recently I have had my application tested on a wide range of linux 
> distributions. Some users are running into a problem with Qt
> version mismatch. My application gets built with Qt4, but osgQt
> might be built with Qt4 or Qt5. If you load Qt4 and Qt5 libraries
> in the same executable, a crash ensues.

This means you have built your application incorrectly. It is normally
not possible to start an application built with Qt4 using Qt5
libraries and vice versa - the APIs and ABIs are not compatible, the
library version numbers are different and the application will not start

> This forces users to rebuild the OSG with a particular version of
> Qt, just to run a certain application, which is bad.

It is unfortunately inevitable, because Qt4 and Qt5 are not
compatible. There were huge API changes, some libraries were removed
and many more added between Qt4 and 5.

> For a proper solution, the OSG could provide libosgQt4 and
> libosgQt5 libraries, along with find scripts that allow the
> application to request a particular osgQt version to be used. What
> do you think about the idea?

I don't think that is necessary - you need to ensure in your
application that it is built against the correct version of Qt which
is the *same as the version you use for osgQt*. Then you ship both OSG
libraries and your application.

The CMake scripts for Qt and OSG allow specifying the Qt version
already. And most Linux distributions ship both the older Qt4 and the
new Qt5 series, so if you build for one of them, it should work.

The only way you could have problems is if you rely on the OSG
libraries shipped by the distro, where you don't have control over how
it was compiled. However, that is a terrible idea, because that OSG
tends to be outdated and many distributions don't ship OSG at all.

In addition, if you are trying to distribute a binary-only package,
you are going to have major problems with library version and C++ ABI
incompatibilities between distributions. Qt will be the least of your
problems. You should always ship your shared libraries with the
application or recompile/package the software for the particular

Version: GnuPG v2.0.22 (GNU/Linux)


More information about the osg-users mailing list