Crash on Ubuntu reporting incorrect "Protocol Buffer runtime library" because of Qt5.10 PlatformTheme plugin

Compiler: gcc 5.2
Qt version: 5.10
Ubuntu 15.10

Error

./bin/paraview
libprotobuf FATAL /home/jcfr/Projects/ParaView/ThirdParty/protobuf/vtkprotobuf/src/google/protobuf/stubs/common.cc:62] This program requires version 2.6.0 of the Protocol Buffer runtime library, but the installed version is 2.3.0.  Please update your library.  If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library.  (Version verification failed in "/build/mir-n3hlNX/mir-0.17.0+15.10.20151008.2/src/protobuf/google_protobuf_guard.cpp".)
Aborted (core dumped)

Solution / Workaround

Part 1: Delete faulty plugin

Deleting the faulty platformtheme plugin workaround the issue

cd /home/jcfr/Software/Qt5.10.0/5.10.0/gcc_64/plugins
mkdir ./platformthemes_disabled
mv ./platformthemes/libqgtk3.so ./platformthemes_disabled/

Part 2: Rename Qt5Gui_QGtk3ThemePlugin.cmake

cd /home/jcfr/Software/Qt5.10.0/5.10.0/gcc_64
mv lib/cmake/Qt5Gui/Qt5Gui_QGtk3ThemePlugin.cmake lib/cmake/Qt5Gui/Qt5Gui_QGtk3ThemePlugin.cmake_disabled

This will prevent the following error from being reported:

CMake Error at /home/jcfr/Software/Qt5.10.0/5.10.0/gcc_64/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:15 (message):
  The imported target "Qt5::Gui" references the file

     "/home/jcfr/Software/Qt5.10.0/5.10.0/gcc_64/plugins/platformthemes/libqgtk3.so"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/home/jcfr/Software/Qt5.10.0/5.10.0/gcc_64/lib/cmake/Qt5Gui/Qt5Gui_QGtk3ThemePlugin.cmake"

  but not all the files it references.

Analysis

After analyzing the core dump (see details below), I found out that paraview was picking up the wrong library for protobuf.

The library /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3 was loaded instead of the one built by paraview.

In that case, the library incorrect protobuf runtime was indirectly loaded by Qt5 platformtheme plugin libqgtk3:

$ cd /home/jcfr/Software/Qt5.10.0/5.10.0/gcc_64/plugins

$ for f in $(find . | ack "so$"); do ldd $f | ack "libmirprotobuf" && echo "$f"; done
	libmirprotobuf.so.3 => /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3 (0x00007f3709f2f000)
./platformthemes/libqgtk3.so

Crash Backtrace

#0  0x00007fac1b1cc1c7 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1  0x00007fac1b1cde2a in __GI_abort () at abort.c:89
#2  0x00007fac13659b10 in google::protobuf::internal::LogMessage::Finish (this=0x7ffe73fad1b0) at /home/jcfr/Projects/ParaView/ThirdParty/protobuf/vtkprotobuf/src/google/protobuf/stubs/common.cc:195
#3  0x00007fac13659b18 in google::protobuf::internal::LogFinisher::operator= (this=this@entry=0x7ffe73fad16f, other=...) at /home/jcfr/Projects/ParaView/ThirdParty/protobuf/vtkprotobuf/src/google/protobuf/stubs/common.cc:200
#4  0x00007fac13659d1d in google::protobuf::internal::VerifyVersion (headerVersion=2006001, minLibraryVersion=<optimized out>, filename=0x7fabedf778c0 "/build/mir-n3hlNX/mir-0.17.0+15.10.20151008.2/src/protobuf/google_protobuf_guard.cpp") at /home/jcfr/Projects/ParaView/ThirdParty/protobuf/vtkprotobuf/src/google/protobuf/stubs/common.cc:69
#5  0x00007fabedf4e2ca in ?? () from /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3
#6  0x00007fac1f21b5ca in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7ffe73fae0d8, env=env@entry=0x7ffe73fae0e8) at dl-init.c:72
#7  0x00007fac1f21b6db in call_init (env=<optimized out>, argv=<optimized out>, argc=<optimized out>, l=<optimized out>) at dl-init.c:30
#8  _dl_init (main_map=main_map@entry=0x22b1a90, argc=1, argv=0x7ffe73fae0d8, env=0x7ffe73fae0e8) at dl-init.c:120
#9  0x00007fac1f220597 in dl_open_worker (a=a@entry=0x7ffe73fad608) at dl-open.c:579
[...]
#18 0x00007fac1bfaacae in QFactoryLoader::instance(int) const () from /home/jcfr/Software/Qt5.10.0/5.10.0/gcc_64/lib/libQt5Core.so.5
#19 0x00007fac1c5ae029 in QPlatformThemeFactory::create(QString const&, QString const&) () from /home/jcfr/Software/Qt5.10.0/5.10.0/gcc_64/lib/libQt5Gui.so.5
[...]
#24 0x00007fac1cdd2369 in QApplicationPrivate::init() () from /home/jcfr/Software/Qt5.10.0/5.10.0/gcc_64/lib/libQt5Widgets.so.5
#25 0x00000000004096e9 in main (argc=1, argv=0x7ffe73fae0d8) at /home/jcfr/Projects/ParaView-RelWithDebInfo/Applications/ParaView/paraview_main.cxx:104

Related issue

We have been seeing this on Ubuntu versions <= 17.something with Qt >= 5.9 for a while. The plugin thing is good to know about, I’ve just been telling people to build their own Qt to get around it.

Great. Thanks for the pointer.

To follow up, I also documented in my earlier post that Qt5Gui_QGtk3ThemePlugin.cmake also need to be renamed.

This has been addressed in the ParaView master with the new module system.