本文档2017年6月1日修正,Ubuntu16.04,Qt5.9.0测试通过
2016年6月8日修正,ubuntu 16.04 Qt5.7.0 以及 Qt5.6.1均测试通过
在Qt5.3之前,我发布过解决办法 解决Qt5 Creator无法切换输入法(fcitx),不能录入汉字问题,Qt5.4以及Qt5.5,旧办法失效,原因是Qt5.4后对之前Qt5版本不再二进制兼容,libfcitxplatforminputcontextplugin.so 需要编译最新的fcitx-qt5。如果你懒得自己编译,可以下载我编译的 libfcitxplatforminputcontextplugin.so
看fcitx-qt5项目的更新日志,是在1.0.3版本时解决的这个问题,写本篇博客时,我git clone到的是1.0.4版本。
编译fcitx-qt需要cmake,安装cmake命令,如果已经安装,请略过。
sudo apt-get install cmake
-
安装 fcitx-libs-dev
sudo apt-get install fcitx-libs-dev
-
设置qmake的环境变量:
export PATH="/home/lieefu/Qt5.9.0/5.9/gcc_64/bin":$PATH
-
下载fcitx-libs源码:
git clone git@github.com:fcitx/fcitx-qt5.git
-
编译方法:
cd fcitx-qt5
cmake .
make
sudo make install
最后把编译得到 libfcitxplatforminputcontextplugin.so 拷贝到 Qt5.5安装目录的 Tools/QtCreator/bin/plugins/platforminputcontexts
Qt5.6的目录是 Tools/QtCreator/lib/Qt/plugins/platforminputcontexts
大功告成!
CMake Error at CMakeLists.txt:8 (find_package):
Could not find a package configuration file provided by "ECM" (requested
version 1.4.0) with any of the following names:
ECMConfig.cmake
ecm-config.cmake
Add the installation prefix of "ECM" to CMAKE_PREFIX_PATH or set "ECM_DIR"
to a directory containing one of the above files. If "ECM" provides a
separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
遇到上述错误处里方法:
这个页面 https://launchpad.net/ubuntu/+source/extra-cmake-modules/1.4.0-0ubuntu1 下载 extra-cmake-modules_1.4.0.orig.tar.xz
https://launchpad.net/ubuntu/+source/extra-cmake-modules/5.18.0-0ubuntu1 extra-cmake-modules_5.18.0.orig.tar.xz
解压后:
cd extra-cmake-modules-1.4.0
cmake .
make
sudo make install
CMake Error at /home/lieefu/Qt5.5.0/5.5/gcc_64/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:9 (message):
Failed to find "GL/gl.h" in "/usr/include/libdrm".
处里方法:
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- Could NOT find XKBCommon_XKBCommon (missing: XKBCommon_XKBCommon_LIBRARY XKBCommon_XKBCommon_INCLUDE_DIR)
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
Could NOT find XKBCommon (missing: XKBCommon_LIBRARIES XKBCommon) (Required
is at least version "0.5.0")
处里方法:
Ubuntu 16.04中可以执行 sudo apt install libxkbcommon-dev 安装
wget http://xkbcommon.org/download/libxkbcommon-0.5.0.tar.xz
tar xf libxkbcommon-0.5.0.tar.xz
./configure —prefix=/usr —libdir=/usr/lib/x86_64-linux-gnu —disable-x11
make
sudo make install
编译libxkbcommon用到yacc,如果没有这个命令,会遇到下面的错误,yacc在 bison软件包中
sudo apt-get install bison
YACC src/xkbcomp/parser.c
./build-aux/ylwrap: line 176: yacc: command not found
make: *** [src/xkbcomp/parser.c] Error 127


引用来自“winner911”的评论
我很早之前试过无效,所有就没用了。没想到现在更新了,回头试一下啊引用来自“winner911”的评论
我很早之前试过无效,所有就没用了。没想到现在更新了,回头试一下啊引用来自“lieefu”的评论
我刚把我编译的libfcitxplatforminputcontextplugin.so 百度云空间了,你下载测试下,能用否。我要libfcitxplatforminputcontextplugin.a(静态库)。请发到943010759@qq.com
引用来自“winner911”的评论
我很早之前试过无效,所有就没用了。没想到现在更新了,回头试一下啊引用来自“lieefu”的评论
我刚把我编译的libfcitxplatforminputcontextplugin.so 百度云空间了,你下载测试下,能用否。引用来自“loaden”的评论
引用来自“winner911”的评论
我很早之前试过无效,所有就没用了。没想到现在更新了,回头试一下啊引用来自“lieefu”的评论
我刚把我编译的libfcitxplatforminputcontextplugin.so 百度云空间了,你下载测试下,能用否。引用来自“winner911”的评论
我试了,没有效果,我自己编译的也不行,我是linux mint
引用来自“lieefu”的评论
引用来自“winner911”的评论
我试了,没有效果,我自己编译的也不行,我是linux mint
引用来自“lieefu”的评论
引用来自“loaden”的评论
引用来自“winner911”的评论
我很早之前试过无效,所有就没用了。没想到现在更新了,回头试一下啊引用来自“lieefu”的评论
我刚把我编译的libfcitxplatforminputcontextplugin.so 百度云空间了,你下载测试下,能用否。git clone git@github.com:fcitx/fcitx-qt5.git 下不下来,提示
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
引用来自“一朝回首”的评论
楼主我下载你的libfcitxplatforminputcontextplugin.so,不起作用啊,我想自己编译来的但是git clone git@github.com:fcitx/fcitx-qt5.git 下不下来,提示
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
引用来自“一朝回首”的评论
楼主我下载你的libfcitxplatforminputcontextplugin.so,不起作用啊,我想自己编译来的但是git clone git@github.com:fcitx/fcitx-qt5.git 下不下来,提示
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
引用来自“lieefu”的评论
可能是你没有github账号导致的。请用这个链接下载:https://github.com/fcitx/fcitx-qt5/archive/master.zip引用来自“shizhao”的评论
很详细的教程。我用的是Qt5.5 ,按照教程解决了问题,但没过多久就失效了。从git上得到最新的源码,按照步骤 cmake make makeinstall 就解决了问题。在cmake之前,需要set一下QT5_DIR路径引用来自“shizhao”的评论
很详细的教程。我用的是Qt5.5 ,按照教程解决了问题,但没过多久就失效了。从git上得到最新的源码,按照步骤 cmake make makeinstall 就解决了问题。在cmake之前,需要set一下QT5_DIR路径引用来自“ruanxinyu”的评论
我试了一下,但是只要把编译之后的源码文件夹删掉之后就不好用了,不知道你的是不是这样