问题描述
本人在Manjaro下运行ROS机器人的仿真Gazebo,但是发现Gazebo无法启动GUI,而且有以下的报错:
[gzclient -2]
[gzclient -2] (process:9324): Gtk-CRITICAL **: 22:09:14.280: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
[gzclient -2]
[gzclient -2] (process:9324): Gtk-CRITICAL **: 22:09:14.280: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
[gzclient -2]
[gzclient -2] (process:9324): Gtk-CRITICAL **: 22:09:14.280: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
[ERROR] [gzclient -2]: process has died [pid 9324, exit code -11, cmd 'gzclient '].
Crash发生在gzclient线程下,这个问题一度卡了我好几个小时,差点就去调试Gazebo的代码了。
问题分析
首先,我们可以查看程序的调用栈:
journalctl
按shift+G
到最后,可以看到:
Stack trace of thread 10463:
#0 0x00007fab2161799b g_logv (libglib-2.0.so.0 + 0x5c99b)
#1 0x00007fab21617c70 g_log (libglib-2.0.so.0 + 0x5cc70)
#2 0x00007faae1cf9b53 n/a (libgtk-3.so.0 + 0x290b53)
#3 0x00007faae1b821e0 n/a (libgtk-3.so.0 + 0x1191e0)
#4 0x00007faae1b97074 n/a (libgtk-3.so.0 + 0x12e074)
#5 0x00007faae1b88f55 n/a (libgtk-3.so.0 + 0x11ff55)
#6 0x00007fab1e9f0833 g_type_create_instance (libgobject-2.0.so.0 + 0x39833)
#7 0x00007fab1e9d82f6 n/a (libgobject-2.0.so.0 + 0x212f6)
#8 0x00007fab1e9d932d g_object_new_with_properties (libgobject-2.0.so.0 + 0x2232d)
#9 0x00007fab1e9d9d12 g_object_new (libgobject-2.0.so.0 + 0x22d12)
#10 0x00007faae1d92eff n/a (libgtk-3.so.0 + 0x329eff)
#11 0x00007fab1e9f0833 g_type_create_instance (libgobject-2.0.so.0 + 0x39833)
#12 0x00007fab1e9d82f6 n/a (libgobject-2.0.so.0 + 0x212f6)
#13 0x00007fab1e9d978b g_object_new_valist (libgobject-2.0.so.0 + 0x2278b)
#14 0x00007fab1e9d9cea g_object_new (libgobject-2.0.so.0 + 0x22cea)
#15 0x00007faaf01c0f9c _ZN22QGtk3ColorDialogHelperC1Ev (libqgnomeplatformtheme.so + 0x18f9c)
#16 0x00007faaf01be9e7 _ZNK19QGnomePlatformTheme26createPlatformDialogHelperEN14QPlatformTheme10DialogTypeE (libqgnomeplatformtheme.so + 0x169e7)
#17 0x00007fab24fbc7a6 _ZNK14QDialogPrivate14platformHelperEv (libQt5Widgets.so.5 + 0x3567a6)
#18 0x00007fab24fc2b2c _ZN12QColorDialogC1ERK6QColorP7QWidget (libQt5Widgets.so.5 + 0x35cb2c)
#19 0x00007fab26953949 _ZN6gazebo3gui21BuildingEditorPaletteC2EP7QWidget (libgazebo_gui.so.11 + 0x2a5949)
#20 0x00007fab2694d32a _ZN6gazebo3gui14BuildingEditorC1EPNS0_10MainWindowE (libgazebo_gui.so.11 + 0x29f32a)
#21 0x00007fab268b2ca9 _ZN6gazebo3gui10MainWindow13CreateEditorsEv (libgazebo_gui.so.11 + 0x204ca9)
#22 0x00007fab268bed30 _ZN6gazebo3gui10MainWindowC1Ev (libgazebo_gui.so.11 + 0x210d30)
#23 0x00007fab2687ecab _ZN6gazebo3gui4loadEv (libgazebo_gui.so.11 + 0x1d0cab)
#24 0x00007fab2687ee6d _ZN6gazebo3gui3runEiPPc (libgazebo_gui.so.11 + 0x1d0e6d)
#25 0x000055b61493952c n/a (gzclient-11.9.1 + 0x552c)
#26 0x00007fab2565cb25 __libc_start_main (libc.so.6 + 0x27b25)
#27 0x000055b6149395ee n/a (gzclient-11.9.1 + 0x55ee)
我们可以看到,出现这个问题肯定不是Gazebo
的锅,错误发生在libQt5Widgets
向下调用gtk
过程中。
所以,我在Google上尝试搜索libQt5Widgets
和GTK_IS_STYLE_PROVIDER_PRIVATE
两个关键词,好家伙,这个时候发现很多Manjaro
用户在网上求助相同的问题。
问题解决
参考Manjaro
论坛中的帖子
删除.config
下的qt5ct
文件夹
rm -rf ~/.config/qt5ct
问题便解决了,我的Gazebo
也成功打开了:)