Skip to Content

RStudio marry 搜狗拼音输入法

From above 1.2.5001, one can just try the first method in Development, the only flaw is the square when you type Pinyin.

1 Begining

Ubuntu 不愧是 Linux 的亲儿子 1,连搜狗拼音输入法都有得用。

但一件很尴尬的事情是,我最喜欢的 IDE,RStudio,不支持搜狗拼音输入法。我曾在爆栈网 2 搜过一次,结果最好的结局方法貌似是 用 RStudio Server 来代替 3,真让人无语。

But today, I manage to use 搜狗拼音输入法 in RStudio, after exploring for half a day.

2 Development

Thanks to this post, I know the reason is that libfcitxplatforminputcontextplugin.so is missing. I use apt-file find and find fcitx-frontend-qt5 provides that .so. But 搜狗拼音输入法 still doesn’t work.

Then I found another post, which helped me build fcitx-qt5 from source:

sudo apt install cmake extra-cmake-modules fcitx-libs-dev
# the critical step, you have to install Qt
export PATH="/path/to/Qt/5.10.1/gcc_64/bin:$PATH"

After that, I get a libfcitxplatforminputcontextplugin.so, and this .so did help enabled 搜狗拼音输入法 in Qt Creator.

3 Climax

Motivated by aboving result, I figured out that RStudio 1.1.142 use Qt 5.4.2.

Finally, I built libfcitxplatforminputcontextplugin.so using Qt 5.4.2 and fixed the problem 4.

By the way, the Qt Maintenance Tool is really clumsy, you’d better uninstall & install if you want to add modules.

4 Epilogue

写于 2019-02-28:可惜我没有把详细过程记下来,后来我一直用着编译好的 .so,到目前为止都没什么问题。等到以后版本不兼容的时候,重新 build 估计又要花一些时间。


  1. 我瞎说的↩︎

  2. Stack Overflow↩︎

  3. 毕竟浏览器可以正常使用搜狗拼音输入法↩︎

  4. put it inside /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/↩︎