解决Qt5 Creator无法切换输入法(fcitx),Ubuntu中不能使用搜狗输入法录入汉字问题

解决Qt5 Creator无法切换输入法(fcitx),Ubuntu中不能使用搜狗输入法录入汉字问题

标签(空格分隔): 未分类


概述

你我当然不是第一个遇到这个问题的人,网上一搜一堆解决方案。不过注意环境,Qt版本等等。
我的是2016-04-09 下载的 Qt5.6.0, 我的安装根目录为 /opt/Qt5.6.0/, 下面我们将要用到
/opt/Qt5.6.0/5.6/gcc_64/plugins/platforminputcontexts/

/opt/Qt5.6.0/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts/(千万注意这个目录是 Qt5.6 的, 你找别的老教程的目录是错的,没有老的目录了,我还自己建了一个,真蠢)
这两个目录,

(我的计算机是Ubuntu14.10 64bit, gcc4.8)

$ sudo apt-get install fcitx-libs-dev
$ export PATH="/opt/Qt5.6.0/5.6/gcc_64/bin":$PATH
$ git clone git@github.com:fcitx/fcitx-qt5.git
cd fcitx-qt5
mkdir build && cd build
cmake ..
make && sudo make install

cp fcitx-qt5/build/下的 platforminputcontext/libfcitxplatforminputcontextplugin.so
/opt/Qt5.6.0/5.6/gcc_64/plugins/platforminputcontexts/

/opt/Qt5.6.0/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts/
这两个目录,

重启qtcreator即可。
Qt成功调用sougoupinyin

编译fcitx-qt5的问题

主要是缺少各种各样的依赖项

缺少 "ECM"

报错信息:

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!

solution:

wget https://launchpadlibrarian.net/189487929/extra-cmake-modules_1.4.0.orig.tar.xz
tar -xJf extra-cmake-modules_1.4.0.orig.tar.xz

找不到Qt5包配置文件的错误

报错信息:

CMake Error at CMakeLists.txt:29 (find_package):
  Could not find a package configuration file provided by "Qt5" (requested
  version 5.1.0) with any of the following names:

    Qt5Config.cmake
    qt5-config.cmake

  Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
  to a directory containing one of the above files.  If "Qt5" provides a
  separate development package or SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!
See also "/home/o/fcitx/fcitx-qt5/build/CMakeFiles/CMakeOutput.log".

solution:

cmake -DQt5_DIR=/home/o/program/qt_5.5/qt_5.5.1_x64/5.5/gcc_64/lib/cmake/Qt5 ..

找不到libxkbcommon

报错信息:


solution:

http://xkbcommon.org/download/libxkbcommon-0.5.0.tar.xz
tar -xJf libxkbcommon-0.5.0.tar.xz

这个使用./configure --disable-x11 来生成 Makefile(我的计算机是Ubuntu14.10 64bit, gcc4.8)

编译需要 yacc 的支持。这个工具包含在软件包 bison 中。

posted @ 2016-04-08 18:59  withChengChen  阅读(4199)  评论(0编辑  收藏  举报