fcitx虛擬鍵盤 [論壇 - Ubuntu 與其它桌面系統]


正在瀏覽:   1 名遊客


 到底部   前一個主題   下一個主題  [無發表權] 請登錄或者註冊



fcitx虛擬鍵盤
會員一級
註冊日期:
2016/10/20 9:28
所屬群組:
已註冊使用者
等級: 2
HP : 0 / 34
MP : 4 / 649
EXP: 38
離線
請問在設定虛擬鍵盤出現fcitx-config-gtk3 crashed with SIGSEGV然後就閃退要怎麼解決?
@samwhelp

2016/10/21 23:18
應用擴展 工具箱
回覆: fcitx虛擬鍵盤
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 36
HP : 0 / 898
MP : 664 / 28677
EXP: 92
離線
suweiwilson 寫到:
請問在設定虛擬鍵盤出現fcitx-config-gtk3 crashed with SIGSEGV然後就閃退要怎麼解決?
@samwhelp


我測試的結果,如同樓主您說的,會有問題,
不過這個超出我目前會的範圍了,
所以建議可以到「GitHub / fcitx / fcitx-configtool / issues」或是「GitHub / fcitx / fcitx / issues」,
這兩個地方其中一個回報,尋求協助。

或是等待對除錯這方面有經驗的大德可以來補充說明,感恩先。

以下是我的測試紀錄,測試環境「Xubuntu 16.04 64位元 英文界面」

## 狀況測試

執行


$ fcitx-config-gtk3



會顯示


(fcitx-config-gtk3:6356): GLib-GIO-CRITICAL **: g_dbus_connection_call_internal: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(fcitx-config-gtk3:6356): GLib-GIO-CRITICAL **: g_dbus_connection_call_internal: assertion 'G_IS_DBUS_CONNECTION (connection)' failed




並且會跳出一個視窗「Input Method Configuration」,

總共分成四個頁籤「Input method」「Global Config」「Appearance」「Addon」,

選第四個頁籤「Addon」,

下拉到最下方,有一個「Virtual Key Board」,在該項目點兩下,或是選了之後,點選下方的「Configure」按鈕,

然後在「Terminal」就會在剛剛顯示的下面,多了下面的訊息。


Segmentation fault (core dumped)



並且出現一個對話框「Sorry, the applicaion fcitx-config-gtk3 has stopped unexpectedly.」,

按下左下方「Show Details」,就會看到一些資訊,

在「Title」那個欄位,顯示的是「fcitx-config-gtk3 crashed with SIGSEGV in g_closure_invoke()」。

另外也可以在「/var/crash/_usr_bin_fcitx-config-gtk3.1000.crash」找到相關的資訊(不過這個檔的資訊,感覺比UI呈現的少,暫時沒去探究)。

在「/var/log/apport.log」這個檔案的最下方,則是可以看到如下的訊息。


ERROR: apport (pid 7661) Mon Oct 24 12:37:27 2016: called for pid 7657, signal 11, core limit 0
ERROR: apport (pid 7661) Mon Oct 24 12:37:27 2016: executable: /usr/bin/fcitx-config-gtk3 (command line "fcitx-config-gtk3")
ERROR: apport (pid 7661) Mon Oct 24 12:37:27 2016: gdbus call error: Error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

ERROR: apport (pid 7661) Mon Oct 24 12:37:27 2016: debug: session gdbus call:
ERROR: apport (pid 7661) Mon Oct 24 12:37:27 2016: this executable already crashed 2 times, ignoring




## 套件探索

執行


$ whereis fcitx-config-gtk3



顯示


fcitx-config-gtk3: /usr/bin/fcitx-config-gtk3



執行


$ dpkg -S /usr/bin/fcitx-config-gtk3



顯示


fcitx-config-gtk: /usr/bin/fcitx-config-gtk3



表示「/usr/bin/fcitx-config-gtk3」是屬於「fcitx-config-gtk」這個套件。


執行


$ apt-cache showsrc fcitx-config-gtk



顯示


Package: fcitx-configtool
Binary: fcitx-config-common, fcitx-config-gtk, fcitx-config-gtk2
Version: 0.4.8-3
Priority: optional
Section: utils
...略...



表示「fcitx-config-gtk」這個套件的「Source Package」是「fcitx-configtool」。


執行下面指令,則是可以把「Source Package」下載下來。


$ apt-get source fcitx-config-gtk




更多的套件探索方法,可以參考這個「索引」,裡面有列一些案例和參考連結。

以上參考,報告完畢。


2016/10/24 12:58
應用擴展 工具箱
回覆: fcitx虛擬鍵盤
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 36
HP : 0 / 898
MP : 664 / 28677
EXP: 92
離線
我剛用土法煉鋼的方式來追程式,雖然還沒有完全了解,
但大概知道會讓上面回覆「#2」說的步驟,會產生「Segmentation fault (core dumped)」的關鍵點在那了。

所以先講結論,先來做個小實驗


$ sudo touch /usr/share/fcitx/configdesc/fcitx-vk.desc



先產生「/usr/share/fcitx/configdesc/fcitx-vk.desc」這個檔案,檔案的內容是空的沒關係。

然後再照我上面回覆「#2」提到的步驟來執行,就不會再出現「Segmentation fault (core dumped)」了,而會跳出一個設定視窗。


================================================================================

以下簡單紀錄我追縱的步驟,提供參考,給有興趣的人,再自行去探究。

執行下面指令,下載「fcitx-config-gtk」的「Source Package」。


$ apt-get source fcitx-config-gtk



切換到資料夾「fcitx-configtool-0.4.8」


$ cd fcitx-configtool-0.4.8/



觀看「INSTALL」的內容,可以了解如何編譯。


$ cat INSTALL



先執行下面的指令,安裝編譯「fcitx-config-gtk(fcitx-configtool)」所需要的套件


$ sudo apt-get build-dep fcitx-config-gtk



產生「build」這個資料夾,並且切換到這個資料夾


$ mkdir build
$ cd build



執行下面指令


$ cmake ..



這時候就會產生一些檔案,包含「Makefile」檔

只要在「build」這個資料夾,執行「make」,就可以編譯成功了


$ make



編譯成功,會有一個檔「build/gtk3/fcitx-config-gtk3」,
只要直接執行下面的指令,就可以執行「gtk3/fcitx-config-gtk3」這個檔案來測試。(注意不需要make install)。


$ gtk3/fcitx-config-gtk3



然後照著上面回覆「#2」提到的步驟來測「Virtual Key Board」那段。

================================================================================

主要會追蹤的原始檔是下面幾個檔

* fcitx-configtool-0.4.8/gtk3/main_window.c
* fcitx-configtool-0.4.8/gtk3/config_widget.c
* fcitx-configtool-0.4.8/gtk3/dummy_config.c


先從「fcitx-configtool-0.4.8/gtk3/main_window.c」這個檔看起,

主要看兩個function

「_fcitx_main_window_addon_selection_changed」和「_fcitx_main_window_configure_button_clicked」


「_fcitx_main_window_addon_selection_changed」這個就是當你選擇不同的「Addon」會呼叫的「Callback function」。

「_fcitx_main_window_configure_button_clicked」則是你當你按下「Configure」這個按鈕,會呼叫的「Callback function」。


「_fcitx_main_window_addon_selection_changed」其中有一行很關鍵,

gboolean configurable = (gboolean)(cfdesc != NULL || strlen(addon->subconfig) != 0);



這個會決定「Configure」這個按鈕,是「enabled」還是「disabled」。

然後當沒有「/usr/share/fcitx/configdesc/fcitx-vk.desc」這個檔案,

用下面的指令來追蹤


printf("config_desc_name: %s\n",config_desc_name);
printf("cfdesc: %x\n", cfdesc);
printf("cfdesc: %p\n", (void*) cfdesc);
printf("addon->subconfig: %s\n", addon->subconfig);
printf("configurable: %d\n", configurable);



相關的值如下


config_desc_name: fcitx-vk.desc
cfdesc: 0
cfdesc: (nil)
addon->subconfig: Virtual Key Board:native:data/vk.conf,fcitx:domain
configurable: 1




對照上面的比對,configurable 會是 「1 (true)」,所以「Configure」這個按鈕,是「enabled」,也就是可以被按下。

但會有產生問題的是「cfdesc是NULL」的這個狀況,當你追蹤「_fcitx_main_window_configure_button_clicked」,

追到最後,會看到「fcitx-configtool-0.4.8/gtk3/dummy_config.c」這個檔有一個function,

名稱叫做「dummy_config_new」,預期是傳「cfdesc」的值進去,並且預期的應該是要傳一個位址,若傳入「NULL」,就會出錯。

也就是會產生這篇討論所出現的狀況。

以上參考。

2016/10/25 21:54
應用擴展 工具箱
回覆: fcitx虛擬鍵盤
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 36
HP : 0 / 898
MP : 664 / 28677
EXP: 92
離線
執行


$ apt-cache showsrc fcitx-config-gtk | grep Build-Depends:



顯示


Build-Depends: cmake, debhelper (>= 9), fcitx-bin, fcitx-libs-dev (>= 1:4.2.8), iso-codes, libdbus-glib-1-dev, libgtk-3-dev, libgtk2.0-dev (>= 2.22), libunique-dev, pkg-config




執行


$ apt-cache show fcitx-libs-dev | grep '^Description-en:' -A 11



顯示


Description-en: Flexible Input Method Framework - library development files
...略...
This package provides the library development files.



執行


$ apt-cache showsrc fcitx-libs-dev



顯示


Package: fcitx
Binary: fcitx, fcitx-bin, fcitx-data, fcitx-libs, libfcitx-config4, libfcitx-core0, libfcitx-utils0, fcitx-libs-gclient, libfcitx-gclient0, fcitx-libs-qt, libfcitx-qt0, fcitx-libs-dev, gir1.2-fcitx-1.0, fcitx-dbg, fcitx-ui-classic, fcitx-frontend-all, fcitx-frontend-gtk2, fcitx-frontend-gtk3, fcitx-frontend-qt4, fcitx-pinyin, fcitx-qw, fcitx-table, fcitx-table-all, fcitx-table-bingchan, fcitx-table-cangjie, fcitx-table-dianbaoma, fcitx-table-erbi, fcitx-table-wanfeng, fcitx-table-wbpy, fcitx-table-wubi, fcitx-table-ziranma, fcitx-modules, fcitx-module-dbus, fcitx-module-x11, fcitx-module-lua, fcitx-module-kimpanel, fcitx-module-quickphrase-editor, fcitx-tools
Version: 1:4.2.9.1-1ubuntu1
...略...




可以知道「fcitx-libs-dev」這個套件的「Source Package」是「fcitx」。


若有安裝「fcitx-libs-dev」這個套件,執行下面指令


$ dpkg -L fcitx-libs-dev | grep fcitx-config



顯示


/usr/lib/x86_64-linux-gnu/pkgconfig/fcitx-config.pc
/usr/include/fcitx-config
/usr/include/fcitx-config/xdg.h
/usr/include/fcitx-config/fcitx-config.h
/usr/include/fcitx-config/hotkey.h
/usr/lib/x86_64-linux-gnu/libfcitx-config.so



執行下面指令


$ grep 'FcitxConfigFileDesc' /usr/include/fcitx-config/fcitx-config.h -n



顯示


...略...
177: typedef struct _FcitxConfigFileDesc FcitxConfigFileDesc; /**< FcitxConfigFileDesc */
...略...
284: struct _FcitxConfigFileDesc {
...略...




執行下面指令,則是可以下載「fcitx-libs-dev」這個套件的「Source Package」是「fcitx」。


$ apt-get source fcitx-libs-dev



或是執行


$ apt-get source fcitx



下載完成後。

就可以找到「fcitx-4.2.9.1/src/lib/fcitx-config/fcitx-config.h」。

================================================================================

執行下面指令觀看「/usr/lib/x86_64-linux-gnu/pkgconfig/fcitx-config.pc」這個檔案。


$ cat /usr/lib/x86_64-linux-gnu/pkgconfig/fcitx-config.pc



顯示


prefix=/usr
exec_prefix=/usr
libdir=/usr/lib/x86_64-linux-gnu
includedir=/usr/include

Name: fcitx-config
Description: Fcitx Config Library
Version: 4.2.9.1
Requires: fcitx-utils
Cflags: -I/usr/include
Libs: -L/usr/lib/x86_64-linux-gnu -lfcitx-config




執行 (相關參考)


$ pkg-config --cflags --libs fcitx-config




顯示


-lfcitx-config -lfcitx-utils




以上參考,報告完畢


2016/10/26 10:34
應用擴展 工具箱
回覆: fcitx虛擬鍵盤
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 36
HP : 0 / 898
MP : 664 / 28677
EXP: 92
離線
執行


$ strace -f -o log.txt fcitx-config-gtk3



然後一樣使用上面回覆「#2」提到的步驟,會顯示下面的訊息,然後程式就結束了。


(fcitx-config-gtk3:24088): GLib-GIO-CRITICAL **: g_dbus_connection_call_internal: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(fcitx-config-gtk3:24088): GLib-GIO-CRITICAL **: g_dbus_connection_call_internal: assertion 'G_IS_DBUS_CONNECTION (connection)' failed
Segmentation fault (core dumped)



然後可以觀看「log.txt」的最後幾行


$ tail log.txt



顯示


24088 recvmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"\1\2\240\10\0\0\0\0\10\0\0\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 32
24088 recvmsg(7, 0x7ffcb4210fd0, 0) = -1 EAGAIN (Resource temporarily unavailable)
24088 recvmsg(7, 0x7ffcb4210fd0, 0) = -1 EAGAIN (Resource temporarily unavailable)
24088 open("/home/user/.config/fcitx/configdesc/fcitx-vk.desc", O_RDONLY) = -1 ENOENT (No such file or directory)
24088 open("/usr/share/fcitx/configdesc/fcitx-vk.desc", O_RDONLY) = -1 ENOENT (No such file or directory)
24088 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
24092 +++ killed by SIGSEGV (core dumped) +++
24089 +++ killed by SIGSEGV (core dumped) +++
24090 +++ killed by SIGSEGV (core dumped) +++
24088 +++ killed by SIGSEGV (core dumped) +++



以上參考


## manpage


* man strace
* man ltrace
* man sotruss
* man ptrace
* man lsof

2016/10/29 14:52
應用擴展 工具箱


 [無發表權] 請登錄或者註冊


可以查看帖子.
不可發帖.
不可回覆.
不可編輯自己的帖子.
不可刪除自己的帖子.
不可發起投票調查.
不可在投票調查中投票.
不可上傳附件.
不可不經審核直接發帖.