Sunday, October 27, 2013

Qt4: Cannot mix incompatible Qt library

This problem occurs every now and then when using closed-source Qt4 binaries or libraries:

bash$ LD_LIBRARY_PATH=./lib bin/TestBench
Cannot mix incompatible Qt library (version 0x40801) with this library (version 0x40803)
Aborted (core dumped)

Setting LD_LIBRARY_PATH in order to override the Qt4 library never works, even though it should.

It turns out that this error has nothing to do with the proprietary software being linked to an incompatible Qt version. Instead, the user's Qt theme (often Oxygen) is incompatible with the Qt libraries shipped with the proprietary software.

This can be solved in two ways. The permanent way is to run qtconfig-qt4 and choose another theme (e.g. Cleanlooks, which always seems to work).

The second is to pass a compatible theme to the proprietary software using the -style command-line argument:

 LD_LIBRARY_PATH=./lib bin/TestBench -style=CleanLooks

This will override the theme only for this invocation of the application.