解决Ubuntu中Qt5 Creator不能使用搜狗输入法输入汉字问题

我用的是Ubuntu17.04 32bit 和Qt Creator5.4.1 32bit

1、编译fcitx-qt需要cmake

sudo apt-get install cmake
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev

2、安装 fcitx-libs-dev

sudo apt-get install fcitx-libs-dev

3、设置qmake的环境变量(路径根据自己安装位置修改)

export PATH="/usr/local/QtCreator5.4.1/5.4/gcc/bin":$PATH

4、下载fcitx-libs源码(apt-get source fcitx-libs-qt5 这种方法下载不到)

git clone git://anonscm.debian.org/pkg-ime/fcitx-qt5.git

5、编译方法

cd fcitx-qt5
cmake .
make
sudo make install

最后把编译得到 libfcitxplatforminputcontextplugin.so 拷贝到
Qt安装目录/Tools/QtCreator/bin/plugins/platforminputcontexts
和 qt安装目录/5.4/gcc/plugins/platforminputcontexts

cd /usr/local/QtCreator-5.4.1/Tools/QtCreator/bin/plugins/platforminputcontexts

sudo cp ~/fcitx-qt5/platforminputcontext/libfcitxplatforminputcontextplugin.so .

cd /usr/local/QtCreator-5.4.1/5.4/gcc_64/plugins/platforminputcontexts

sudo cp ~/fcitx-qt5/platforminputcontext/libfcitxplatforminputcontextplugin.so .

编译fcitx-libs-dev中所遇到的问题
缺少 “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!

解决方法
可以使用apt-get安装

sudo apt-get install extra-cmake-modules

也可以下载软件包自己安装

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

cd extra-cmake-modules-1.4.0
cmake .
make
sudo make install

找不到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".

解决方法(根据自己安装的位置修改)

cmake -DQt5_DIR=/usr/local/QtCreator5.4.1/5.4/gcc/lib/cmake/Qt5 ..

找不到libxkbcommon

报错信息:

-- Could NOT find XKBCommon_XKBCommon (missing:  XKBCommon_XKBCommon_LIBRARY XKBCommon_XKBCommon_INCLUDE_DIR) 
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find XKBCommon (missing: XKBCommon_LIBRARIES XKBCommon) (Required
  is at least version "0.5.0")
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindXKBCommon.cmake:30 (find_package_handle_standard_args)
  CMakeLists.txt:31 (find_package)


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

解决方法(x86_64-linux-gnu 根据自己的版本修改)

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

找不到 yacc

报错信息:

YACC     src/xkbcomp/parser.c
./build-aux/ylwrap: line 176: yacc: command not found
make: *** [src/xkbcomp/parser.c] Error 127

解决方法

sudo apt-get install bison
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值