0. 环境

系统:ubuntu 16.04 LTS

机子:dell xps13

1. 步骤

1.1 编译 fcitx-qt5 源码

  1. 编译fcitx-qt需要cmake,安装cmake命令,如果已经安装,请略过;

    sudo apt-get install cmake
  2. 安装 fcitx-libs-dev;

    sudo apt-get install fcitx-libs-dev
  3. 设置qmake的环境变量,这一步很重要且环境变量的值因人而异

    3.1. 首先确定你的Qt的安装目录,我这里是~/software/Qt5.6.0/,你的或者可能在/home/<用户名>/Qt5.6.0/

    3.2. export PATH="<Qt安装目录>/5.6/gcc_64/bin":$PATH
  4. 下载fcitx-libs 源码

    4.1. 原文的 git clone git@github.com:fcitx/fcitx-qt5.git 不可行,需要修改为 https://github.com/fcitx/fcitx-qt5

    4.2. git clone https://github.com/fcitx/fcitx-qt5
  5. 编译 fcitx-qt5
cd fcitx-qt5
cmake .
make
sudo make install

1.2. 拷贝 so 文件

  1. 编译完成后,需要把编译得到的 libfcitxplatforminputcontextplugin.so 拷贝到 Qt5.5 安装目录的 Tools/QtCreator/bin/plugins/platforminputcontextsQt5.6 安装目录的 Tools/QtCreator/lib/Qt/plugins/platforminputcontexts,注意:两个目录根据你的Qt版本而定,Qt安装目录因人而异。
  2. 复制:

    Qt 5.5:cp platforminputcontext/libfcitxplatforminputcontextplugin.so <Qt安装目录>/Tools/QtCreator/bin/plugins/platforminputcontexts

    Qt 5.6:cp platforminputcontext/libfcitxplatforminputcontextplugin.so <Qt安装目录>/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts

    我这里是:cp platforminputcontext/libfcitxplatforminputcontextplugin.so ~/software/Qt5.6.0/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts

1.3 添加额外的环境变量

echo 'export XMODIFIERS=@im=fcitx' >> .bashrc
echo 'export QT_IM_MODULE=fcitx' >> .bashrc

大功告成!

2. 遇到的问题

说明:本人系统为 Ubuntu 16.04 LTS 英文版 ,遇到的问题基本和原文一样

2.1 安装CMake失败

  1. 问题描述:sudo apt-get install cmake 执行到 92 % 时提示下载失败,原因是找不到 IP 地址。
  2. 问题解决:觉得应该是安装包源的问题,于是修改了系统默认的源。

    System Settings -> Software & Updates -> Ubuntu Software -> Download from 从原来的 China 改为 Main server,最后再

    sudo apt-get update

    sudo apt-get install cmake

2.2 CMake 错误

  1. 问题描述:
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!
  1. 解决方法:

    2.1. 到这个页面 https://launchpad.net/ubuntu/+source/extra-cmake-modules/1.4.0-0ubuntu1 下载 extra-cmake-modules_1.4.0.orig.tar.xz

    2.2. 解压后编译安装
cd extra-cmake-modules-1.4.0
cmake .
make
sudo make install

2.3 安装 extra-cmake-modules-1.4.0 失败

  1. 问题描述:
$:~/Downloads/extra-cmake-modules-1.4.0$ cmake .
CMake Warning at tests/CMakeLists.txt:28 (find_package):
Could not find a package configuration file provided by "Qt5LinguistTools"
with any of the following names:
Qt5LinguistToolsConfig.cmake
qt5linguisttools-config.cmake
Add the installation prefix of "Qt5LinguistTools" to CMAKE_PREFIX_PATH or
set "Qt5LinguistTools_DIR" to a directory containing one of the above
files. If "Qt5LinguistTools" provides a separate development package or
SDK, be sure it has been installed.
-- Looking for Sphinx Documentation Builder...
-- Sphinx Documentation Builder not found - documentation will not be built (see http://sphinx-doc.org/)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cposture/Downloads/extra-cmake-modules-1.4.0
  1. 解决方法:

    设置 CMAKE_PREFIX_PATH 环境变量 为 qtbase 目录(<Qt安装目录>/5.6/Src/qtbase/),我这里为:
export CMAKE_PREFIX_PATH="~/software/Qt5.6.0/5.6/Src/qtbase/"

如果还是不行,则修改为

export CMAKE_PREFIX_PATH="/home/cposture/software/Qt5.6.0/5.6/gcc_64/lib/cmake/"

2.4 缺少 xkbcommon 包

  1. 问题描述:
 -- 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")
  1. 解决方法:

    2.1. 到 http://xkbcommon.org/ 下载最新版的 xkbcommon

    2.2. 解压后,
sudo apt-get install bison
./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --disable-x11
make
sudo make install

原文链接:http://www.cnblogs.com/cposture/p/5397694.html

参考:http://my.oschina.net/lieefu/blog/505363?p=1

[解决方案] Ubuntu 16.04 下 Qt 5.6 无法输入中文的问题的更多相关文章

  1. Ubuntu 16.04 下使用Xampp

    Ubuntu 16.04 下使用Xampp 什么是Xampp? XAMPP(Apache+MySQL+PHP+PERL) 是一个功能强大的建站集成软件包.这个软件包原来的名字是 LAMPP,但是为了避 ...

  2. Ubuntu 16.04下使用Eclipse:创建工程时卡死的解决方法

    问题如下: Ubuntu 16.04下使用Eclipse创建工程时出现卡顿和卡死,新建一个MapReduce项目卡了一下午,鼠标变成了圆圈进度条转了一下午,还关不掉. 当我直接去关闭新建项目的窗口时, ...

  3. Ubuntu 16.04 下简单安装使用golang之备忘

      刚开始学习Go语言,这里记录下我在Ubuntu 16.04下安装使用golang的过程,方便以后查询.   一.安装   1.添加源   如果使用默认的源安装golang的话,版本太低,只到1.6 ...

  4. Ubuntu 16.04下EasyOpenJTAG+OpenOCD的安装和使用【转】

    本文转载自:http://www.linuxdiyf.com/linux/24086.html Ubuntu 16.04下EasyOpenJTAG+OpenOCD的安装和使用 发布时间:2016-09 ...

  5. Ubuntu 16.04下编译安装Apache2.4和PHP7结合

    Ubuntu 16.04下编译安装Apache2.4和PHP7结合,并安装PDOmysql扩展. 1.编译安装apache2.4.20 1 第一步: ./configure --prefix=/usr ...

  6. Ubuntu 16.04下安装MacBuntu 16.04 TP 变身Mac OS X主题风格

    Ubuntu 16.04下安装MacBuntu 16.04 TP 变身Mac OS X主题风格 sudo add-apt-repository ppa:noobslab/macbuntu sudo a ...

  7. Ubuntu 16.04下的LAMP环境配置

    在学习开发过程中,每当遇到新的问题时,通常都能在网上搜到解决的方法,但是网上的方法千千万,有些是已经过时了的,有些是跟自己开发环境不同的,总是不能第一时间能找到答案. 而当时遇到的问题可能在今后的开发 ...

  8. Ubuntu 16.04下为Android编译OpenCV 3.2.0 Manager

    http://johnhany.net/2016/07/build-opencv-manager-for-android-on-ubuntu/ 最近想在Android上尝试一下SIFT和SURF匹配算 ...

  9. ubuntu 16.04下搜狗输入法不能输入中文解决

    之前一段时间正常使用的搜狗输入法突然无法输出中文(具体现象是,可以呼出搜狗输入法界面,但是候选词列表无显示),解决之后记录下来,希望能为同样遇到这个问题的人提供参考.同时附linux下常见软件崩溃问题 ...

随机推荐

  1. centos 桥接配置 设置网络代理 lnmp搭建

    一.桥接配置 centos设置  编辑->虚拟网络编辑器->桥接模式->还原默认设置 虚拟机->设置->网络适配器->桥接 cd /etc/sysconfig/ne ...

  2. 禁止字符串 [POJ3691缩减版]

    题意考虑只由'A','G','C','T'四种字符组成的DNA字符串给定一个长度为k的字符串S,计算长度恰好为n的且不包含S的字符串的个数输入结果对10009取膜1<=k<=100,1&l ...

  3. 用户注册之后,通过网易邮箱服务器(smtp.163.com)发送电子邮箱到注册者邮箱的的确认通知短信.(可根据需求自行调整)

    Member 是数据实体,穿过来的也就是当前注册用户的信息. 存储的数据一定要有邮箱信息 private void SendAuthCodeToMember(Member member)        ...

  4. VB中StdPicture尺寸(Width,Height)转像素单位

    首先获得一个图片对象 Dim spic As StdPicture Set spic = LoadPicture("d:\0.bmp") '从文件获得 Set spic = Cli ...

  5. NOIP-接水问题

    题目描述 学校里有一个水房,水房里一共装有m个龙头可供同学们打开水,每个龙头每秒钟的供水量相等,均为1. 现在有n名同学准备接水,他们的初始接水顺序已经确定.将这些同学按接水顺序从1到n编号,i号同学 ...

  6. 如何设置body高度为浏览器高度

    html{height:100%} body{min-height:100%} 有时我们的页面上内容不多,但设计师要求背景色必须铺满全屏,这时候只需在样式表中加上这行,body就以浏览器的高度显示,超 ...

  7. Qt5+MSVC2015编译器编译发布的Release程序运行崩溃,如何查找崩溃的原因??

    除了加log信息,还有什么方法?? ==================================2019/4/26============================= 1 常见的c++内 ...

  8. Qt5+MSVC2015环境将VS2015编写的控制台程序转化为GUI程序

    如题所述,如何将VS2015编写的控制台程序转化为Qt5+MSVC2015环境编译的GUI程序? 最近想到这个操作,类似于Linux下使用的命令行操作转到Windows下使用GUI操作,看了控制台的命 ...

  9. springboot整合mybatis和mybatis-plus

    问题 1 分页查询问题 2   mybatis的配置由mybatis变成mybatis-plus 3  Mybatis-plus中的Wrapper

  10. Java基础实训