libprotobuf conflicts when building with official Qt 5.9.1 binaries on Ubuntu 16.04
Steps to reproduce
- Install Ubuntu 16.04
- Install Qt5.9.1 from official binaries at http://download.qt.io/official_releases/qt/5.9/5.9.1/qt-opensource-linux-x64-5.9.1.run and install them locally.
- Build ParaView against this Qt install.
When running ParaView you will get an error that indicates the
libprotobuf version being used is different from the
libprotobuf version that it was compiled against.
Now, configure ParaView with
VTK_USE_SYSTEM_PROTOBUF (you may have to
apt-get install libprotobuf first). Run ParaView. Everything works fine - until you close ParaView. It crashes. If you debug with
gdb, you'll see that there is an invalid
libprotobuf's finalization routine.
The problem is that this Qt5.9.1 includes
plugins/platformthemes/libqgtk3.so, which links to
libmirprotobuf. When this platform theme is loaded, the finalization routine in
libprotobuf-lite is called instead of the routine in
libprotobuf, which is causing the invalid free.
A workaround is to go into
Qt5.9.1/5.9.1/gcc_64/lib/cmake/Qt5Gui/Qt5Gui_QGtk3ThemePlugin.cmake and comment out the lines. This will avoid linking (or having ParaView load)
cmake and build again. You also need to move
libqvtk3.so out of the
platformthemes directory to avoid the libprotobuf mismatch error. ParaView will start and exit without error.
The official binaries on www.paraview.org run on Ubuntu 16.04 just fine. It is just when compiling your own version against the official Qt 5.9.1 that problems arise.