QT5.6.0无法切换fcitx中文输入法问题记录

Posted flfihpv259

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了QT5.6.0无法切换fcitx中文输入法问题记录相关的知识,希望对你有一定的参考价值。

前言:参考了网上一堆的文章,还是出现了一堆的问题,一句话能用apt-get install安装的千万别自己下源码编译,没有新版本就GOOGLE 关键字+PPA找到新版本源,用add-apt-repository命令添加,然后update下,再apt-get install试试有没有,如果要学习另当别论。

一 原因分析:

根据网上和自己的编译经验分析觉得QT5.6之所以无法切换fcitx的输入法是因为qt5的库文件和插件都没有加入fcitx输入法管理工具的相关支持,可能能用ibus,因为我在platforminputcontexts目录中看到有,如此的话,那么要想使之支持fcitx就要自己添加这些库文件和插件了。这里是我编译好的文件,你可以直接下载用。我的云盘 访问密码 4dd1

使用方法如下两步

  • 1.先进入QT5.6的目录,寻找“platforminputcontexts”这个输入法插件目录(如下),

    anzyelay@ubuntu:Qt5.6.0$ find . -name platforminputcontexts
    ./Tools/QtCreator/lib/Qt/plugins/platforminputcontexts
    ./5.6/gcc_64/plugins/platforminputcontexts
    anzyelay@ubuntu:Qt5.6.0$ ls ./Tools/QtCreator/lib/Qt/plugins/platforminputcontexts
    libcomposeplatforminputcontextplugin.so  libibusplatforminputcontextplugin.so

    你可以看到两个目录里面现有的插件是不是都有IBUS呢,把我压缩包里的*libfcitxplatforminputcontextplugin.so拷到这两个目录下就行。

  • 2.再把压缩包中剩下的那6个库文件都放到“Qt5.6.0/Tools/QtCreator/lib/qtcreator”目录下或“Qt5.6.0/5.6/gcc_64/lib”目录下,我试过放一个就行,最好两个都放吧,可能有别的用处呢。。这两个目录都是库文件目录,其它版本的可参考找寻。

  • 3.重启qtcreator程序,切换下输入法试试,不行就重启下机子,可能输入法的快捷切换键跟QT有冲突,可以试着改下看看。
    这里写图片描述

二 获得插件的方法

1. 使用apt-get安装

首先寻找了下自己电脑,一般在/usr/lib/x86_64-linux-gnu/目录下,看看有没有qt5,可能只有qt4,于是只能安装fcitx-frontend-qt5,如果安装成功会在其下有个plugin目录,我们要的libfcitxplatforminputcontextplugin.so就有这里,你可以搜索下。
一般安装会出如下问题,没有可用包,这时就要自己去找源更新后在安装了。反正我是找到了也一堆的依赖包缺失,没办法版本是12.04的。怎么弄都不行,用方法二了。

anzyelay@ubuntu:build$ sudo apt-get install fcitx-frontend-qt5
[sudo] password for anzyelay: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package fcitx-frontend-qt5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'fcitx-frontend-qt5' has no installation candidate

2.自己编译fcitx-qt5安装

编译的前提条件:

首先说明,编译fcitx-qt5要用cmake来生成Makefile编译文件,所以要先安装cmake程序。
再来直接看cmake成功后的提示如下:

anzyelay@ubuntu:build$ cmake ..
-- checking for module 'fcitx-utils'
--   found fcitx-utils, version 4.2.0
-- checking for module 'fcitx-config'
--   found fcitx-config, version 4.2.0
-- 
-- The following OPTIONAL packages have been found:

 * PkgConfig

-- The following REQUIRED packages have been found:

 * ECM (required version >= 1.4.0)
 * Qt5DBus
 * Qt5Widgets
 * Qt5 (required version >= 5.1.0)
 * Qt5Gui (required version >= 5.1.0)
 * XKBCommon (required version >= 0.5.0) , Keyboard handling library using XKB data , <http://xkbcommon.org>
 * Qt5Core

-- Configuring done
-- Generating done
-- Build files have been written to: /home/anzyelay/Downloads/fcitx-qt5/build
anzyelay@ubuntu:build$ 

上面说明了要编译fcitx-qt5需要的依赖包有:ECM,XKBCommon,Qt5DBus,Qt5Widgets,Qt5,Qt5Gui,Qt5Core以及fcitx-utils 模块,Qt5这几个应该安装Qt5后就会有不用担心,fcitx-utils ,ECM,XKBCommon可能要自己安装。
还有一点要说明,这个插件的编译要用到C++11的支持。如果你的GCC/G++版本低于4.8,那你必须先升级,以前的版本可能还可以屏蔽了C++11的支持,但这个版本的经我验证不行。


fcitx-qt5编译

假设你上述条件都有满足了,安装很容易,下载->配置->cmake->make->make intsall(这步可以不要,但有了新版不把QT4换了你忍得了)

1. 下载fcitx-qt5源码

anzyelay@ubuntu:Downloads$ git clone https://github.com/fcitx/fcitx-qt5.git
anzyelay@ubuntu:Downloads$ cd fcitx-qt5/

2. 设置qmake的环境变量

qmake在你安装的QT的bin目录下,也可以在cmake时指定:

anzyelay@ubuntu:Downloads$ export PATH=/home/anzyelay/Qt5.6.0/5.6/gcc_64/bin/:$PATH

如果不设置好像后面cmake时会出错如下:

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

3.cmake

生成Makefile等相关编译配置,类似于./configure,你可以新建一个目录,在里面cmake使生成的配置都在新建目录里,这要错了也好清除。如下:

anzyelay@ubuntu:build$ mkdir build
anzyelay@ubuntu:build$ cd build
anzyelay@ubuntu:build$ cmake ..

cmake后面的“..”是说要用上层目录中的CMakeLists.txt文件来配置,你只要指明目录,它会自行去寻找CMakeLists.txt文件的。
在这一步你会遇到很多问题,一般都是因为我上面说的几个编译前提条件造成的。我在下面罗列了些自己遇到的,还有别的自行百度之

4. make 和make install

5. copy编译好的插件和库到QT里面,具体参看我原因分析里说的方法。


cmake编译安装:

fcitx-qt5.需要的cmake版本必须是>2.8.12的,所以使用源码安装,你也可以试试直接安装,如果版本太低可以指定如下:

sudo apt-get instsll cmake=2.8.12

实在不行了就老实编译吧。

  • 下载地址
  • 参考安装说明有两种编译方法:
    先查看下cmake --version

    • 有旧版:

      anzyelay@ubuntu:Downloads$ cd cmake-2.8.12.2/
      anzyelay@ubuntu:cmake-2.8.12.2$ cmake . 
      anzyelay@ubuntu:cmake-2.8.12.2$  make      
      anzyelay@ubuntu:cmake-2.8.12.2$ make install
      anzyelay@ubuntu:cmake-2.8.12.2$ cmake --version
      cmake version 2.8.12.2
      
    • 没有旧版:

      ./bootstrap
      make      
      sudo make install

ECM编译安装:

安装它主要是为了获得ECMConfig.cmake这个东西。方法通用的编译安装如下:

  • 下载:

    anzyelay@ubuntu:build$ wget https://launchpadlibrarian.net/189487929/extra-cmake-modules_1.4.0.orig.tar.xz
    anzyelay@ubuntu:build$ ls
    extra-cmake-modules_1.4.0.orig.tar.xz
  • 配置:

    anzyelay@ubuntu:build$ tar -Jxf extra-cmake-modules_1.4.0.orig.tar.xz 
    anzyelay@ubuntu:build$ cd extra-cmake-modules-1.4.0
    anzyelay@ubuntu:extra-cmake-modules-1.4.0$ cmake .
  • 编译安装

    anzyelay@ubuntu:extra-cmake-modules-1.4.0$ make
    anzyelay@ubuntu:extra-cmake-modules-1.4.0$ sudo make install

    编译后就得到了我们要的文件ECMConfig.cmake如下:

    anzyelay@ubuntu:build$ find . -name ECMConfig.cmake
    ./extra-cmake-modules-1.4.0/ECMConfig.cmake

libxkbcommon编译安装

libxkbcommon的编译要用到yacc这条命令,先yacc -v或其它命令查看有没有yacc,没有就安装

anzyelay@ubuntu:Qt5.6.0$ which yacc
anzyelay@ubuntu:Qt5.6.0$ sudo apt-get install bison
anzyelay@ubuntu:Qt5.6.0$ which yacc
/usr/bin/yacc

然后开始编译libxkbcommon,

anzyelay@ubuntu:libxkbcommon-0.5.0$ wget http://xkbcommon.org/download/libxkbcommon-0.5.0.tar.xz
anzyelay@ubuntu:libxkbcommon-0.5.0$ tar -Jxf libxkbcommon-0.5.0.tar.xz 
anzyelay@ubuntu:libxkbcommon-0.5.0$ cd libxkbcommon-0.5.0/
anzyelay@ubuntu:libxkbcommon-0.5.0$ ./configure
anzyelay@ubuntu:libxkbcommon-0.5.0$ ./configure --disable-x11
anzyelay@ubuntu:libxkbcommon-0.5.0$ make 
anzyelay@ubuntu:libxkbcommon-0.5.0$ sudo make install

三 ERROR

cmake 错误:

1. CMake 2.8.12 or higher is required. You are running version 2.8.7

我创建安装目录,进入后执行 cmake +上层目录(如果是在fcitx-qt5/目录下直接cmake . 就行)后出现版本低的错误如下

anzyelay@ubuntu:Downloads$ cd fcitx-qt5/
anzyelay@ubuntu:build$ cmake ..
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 2.8.12 or higher is required.  You are running version 2.8.7


-- Configuring incomplete, errors occurred!
anzyelay@ubuntu:build$ sudo apt-get install cmake=2.8.12
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '2.8.12' for 'cmake' was not found

安装高版本的cmake,具体见上面的cmake编译安装

2. Could not find a package configuration file provided by “ECM”

anzyelay@ubuntu:build$ cmake ..
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
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!
See also "/home/anzyelay/Downloads/fcitx-qt5/build/CMakeFiles/CMakeOutput.log".

出错提示大意是缺少ECM提供的ECMConfig.cmake,ecm-config.cmake两个文件中的任意一个,去下载获得ECM源码,然后解压出来编译安装就行(具体见上面的ECM编译安装),错误提示也说了只要有两个文件中的一个就行了.如果没安装可以用ECM_DIR指明文件路径

3. need c++ 11 compatible compiler to compile

anzyelay@ubuntu:build$ cmake ..
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Performing Test SUPPORT_CXX11
-- Performing Test SUPPORT_CXX11 - Failed
CMake Error at CMakeLists.txt:24 (message):
  need c++ 11 compatible compiler to compile


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

网上有的直接修改CMakeLists.txt文件,把检查CXX11的语句屏了,虽然CMAKE可行通过了,可后面make时会出问题,毕竟很多函数还是用到了C++11特性的.你也可以试试,或者把-std=c++11改为 -std=c++0x

21 #check_cxx_compiler_flag(“-std=c++11” SUPPORT_CXX11)
22
23 #if(NOT SUPPORT_CXX11)
24 # message(FATAL_ERROR “need c++ 11 compatible compiler to compile”)
25 #endif()
26
27 #set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -std=c++11 -Wall”)

如果出现未定义之类的错误还是升级GCC版本吧.参考博文1
有必要说明下,gcc升级到4.8之后,gdb也有必要升级到7.6之后,不然在调试时会出错(eclipse下出No source available,无法断点等错误)参考博文2,注意的是此文里有个重点没说,就是配置时要加上–with-python,不然无法正常调试

4.Could NOT find XKBCommon_XKBCommon:

anzyelay@ubuntu:build$ cmake ..
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- 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/local/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")
Call Stack (most recent call first):
  /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindXKBCommon.cmake:30 (find_package_handle_standard_args)
  CMakeLists.txt:31 (find_package)


-- Configuring incomplete, errors occurred!

见上面安装libxkbcommon

5.package ‘fcitx-utils’ not found, package ‘fcitx-config’ not found

  • 如下

    anzyelay@ubuntu:build$ cmake ..
    -- checking for module 'fcitx-utils'
    --   package 'fcitx-utils' not found
    CMake Error at /usr/local/share/cmake-2.8/Modules/FindPkgConfig.cmake:279 (message):
      A required package was not found
    Call Stack (most recent call first):
      /usr/local/share/cmake-2.8/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)
      CMakeLists.txt:32 (pkg_check_modules)
    
    
    -- checking for module 'fcitx-config'
    --   package 'fcitx-config' not found
    CMake Error at /usr/local/share/cmake-2.8/Modules/FindPkgConfig.cmake:279 (message):
      A required package was not found
    Call Stack (most recent call first):
      /usr/local/share/cmake-2.8/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)
      CMakeLists.txt:33 (pkg_check_modules)
    
    
    -- 
    -- The following OPTIONAL packages have been found:
    
     * PkgConfig
    
    -- The following REQUIRED packages have been found:
    
     * ECM (required version >= 1.4.0)
     * Qt5DBus
     * Qt5Widgets
     * Qt5 (required version >= 5.1.0)
     * Qt5Gui (required version >= 5.1.0)
     * XKBCommon (required version >= 0.5.0) , Keyboard handling library using XKB data , <http://xkbcommon.org>
     * Qt5Core
    
    -- Configuring incomplete, errors occurred!
    See also "/home/anzyelay/Downloads/fcitx-qt5/build/CMakeFiles/CMakeOutput.log".
    See also "/home/anzyelay/Downloads/fcitx-qt5/build/CMakeFiles/CMakeError.log".

    解决办法就是安装fcitx-libs-dev

    sudo apt-get install fcitx-libs-dev 

    如果安装了还是出这个错误,那看看PkgConfig是不是用的arm 里的版本,”Found PkgConfig: /usr/local/arm/4.9.3/usr/bin/pkg-config (found version “0.28”)”,你可能弄到arm版 的pkg-config里去了,先把PATH里的交叉编译器的路径去掉试试

6.Could not find a package configuration file provided by “Qt5”

anzyelay@ubuntu:build$ cmake ..
-- The C compiler identification is GNU 4.7.3
-- The CXX compiler identification is GNU 4.7.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Performing Test SUPPORT_CXX11
-- Performing Test SUPPORT_CXX11 - Success
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/anzyelay/Downloads/fcitx-qt5/build/CMakeFiles/CMakeOutput.log".

解决办法是指明路径,或export PATH下,不行就都试试吧

anzyelay@ubuntu:build$ cmake -DQt5_DIR=/home/anzyelay/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5 ..

make出错:

1.error: ‘fcitx_utils_get_fcitx_path’ was not declared in this scope

Generating moc_fcitxqtconfiguiwidget.cpp
Generating moc_fcitxqtkeysequencewidget_p.cpp
[ 45%] Built target FcitxQt5WidgetsAddons_automoc
Scanning dependencies of target FcitxQt5WidgetsAddons
[ 50%] Building CXX object widgetsaddons/CMakeFiles/FcitxQt5WidgetsAddons.dir/fcitxqtconfiguifactory.cpp.o
/home/anzyelay/Downloads/fcitx-qt5/widgetsaddons/fcitxqtconfiguifactory.cpp: In member function ‘FcitxQtConfigUIWidget* FcitxQtConfigUIFactory::create(const QString&)’:
/home/anzyelay/Downloads/fcitx-qt5/widgetsaddons/fcitxqtconfiguifactory.cpp:59:62: error: ‘fcitx_utils_get_fcitx_path’ was not declared in this scope
/home/anzyelay/Downloads/fcitx-qt5/widgetsaddons/fcitxqtconfiguifactory.cpp: In member function ‘void FcitxQtConfigUIFactoryPrivate::scan()’:
/home/anzyelay/Downloads/fcitx-qt5/widgetsaddons/fcitxqtconfiguifactory.cpp:77:42: error: ‘FcitxXDGGetLibPath’ was not declared in this scope
make[2]: *** [widgetsaddons/CMakeFiles/FcitxQt5WidgetsAddons.dir/fcitxqtconfiguifactory.cpp.o] Error 1
make[1]: *** [widgetsaddons/CMakeFiles/FcitxQt5WidgetsAddons.dir/all] Error 2
make: *** [all] Error 2

anzyelay@ubuntu:fcitx-qt5$ grep 'fcitx_utils_get_fcitx_path' . -R
./widgetsaddons/fcitxqtconfiguifactory.cpp:    char* localepath = fcitx_utils_get_fcitx_path("localedir");
anzyelay@ubuntu:fcitx-qt5$ 

查了下fcitx_utils_get_fcitx_path没有譔定义,网上找了下发现在fcitx-libs-dev库中.
fcitx-libs-dev包涵下面三个包,其中FcitxXDGGetLibPath在 fcitx-config/xdg.h中定义,低版本也没有该定义,安装个高版本的fcitx-libs-dev.
* libfcitx-core - core functions of Fcitx
* libfcitx-config - support library for Fcitx configurations
* libfcitx-utils - utility support library for Fcitx

在安装时可能出错,要删除fcitx-frontend-qt5才能安装,因为我前面试着安装过fcitx-frontend-qt5但当时包没找到没安装成功,我还以为没关系,结果影响大大的,今后安装软件时如果不成功最好还是remove –purge下它省得出乱七八槽的事.如下出现的错误,及解决方法

anzyelay@ubuntu:build$ sudo apt-get install fcitx-libs-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 fcitx-frontend-qt5 : Depends: fcitx-libs-qt5 but it is not installable
                      Depends: libqt5core5a (>= 5.2.0) but it is not installable
                      Depends: libqt5dbus5 (>= 5.0.2) but it is not installable
                      Depends: libqt5gui5 (>= 5.0.2) but it is not installable or
                               libqt5gui5-gles (>= 5.0.2) but it is not installable
                      Depends: qtbase-abi-5-3-0
 fcitx-libs-dev : Depends: fcitx-bin (= 1:4.2.8.5-2~precise2) but 1:4.2.0-1 is to be installed
                  Depends: fcitx-libs (= 1:4.2.8.5-2~precise2) but 1:4.2.0-1 is to be installed
                  Depends: fcitx-libs-gclient (= 1:4.2.8.5-2~precise2) but it is not going to be installed
                  Depends: fcitx-libs-qt (= 1:4.2.8.5-2~precise2) but it is not going to be installed
                  Breaks: fcitx (< 1:4.2.8.5) but 1:4.2.0-1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
anzyelay@ubuntu:build$ sudo apt-get remove fcitx-frontend-qt5 --purge
..省略..
anzyelay@ubuntu:build$ sudo apt-get install fcitx-libs-dev 

注:重新装了下QT,发现输入法插件被我删了,到自己网盘下下来居然少了libfcitxplatforminputcontextplugin.so这个插件 ,打算再重新编译一次,结果又死在这个地方了,这次安装了也不行.我看了下我电脑上的/usr/include/fcitx-config/xdg.h文件果然是不对,没有FcitxXDGGetLibPath的定义,但看网官是有的,应该是fcitx-libs-dev版本不对,自己编译fcitx吧也是烦得要死,放弃了,还好只是缺个插件,我直接到插件目录make下绕过widgetsaddons库是可行的,重新打包上传了下.自己编译超级麻烦.

2. /usr/include/c++/4.7/bits/stl_pair.h:126:45: error: use of deleted function ‘FcitxQtICData::FcitxQtICData(const FcitxQtICData&)

Scanning dependencies of target fcitxplatforminputcontextplugin
[ 81%] Building CXX object platforminputcontext/CMakeFiles/fcitxplatforminputcontextplugin.dir/qfcitxplatforminputcontext.cpp.o
In file included from /usr/include/c++/4.7/utility:72:0,
                 from /home/anzyelay/Qt5.6.0/5.6/gcc_64/include/QtCore/qcompilerdetection.h:928,
                 from /home/anzyelay/Qt5.6.0/5.6/gcc_64/include/QtCore/qglobal.h:74,
                 from /home/anzyelay/Qt5.6.0/5.6/gcc_64/include/QtGui/qwindowdefs.h:37,
                 from /home/anzyelay/Qt5.6.0/5.6/gcc_64/include/QtGui/qevent.h:37,
                 from /home/anzyelay/Qt5.6.0/5.6/gcc_64/include/QtGui/QKeyEvent:1,
                 from /home/anzyelay/Downloads/fcitx-qt5-1.0.5/platforminputcontext/qfcitxplatforminputcontext.cpp:20:
/usr/include/c++/4.7/bits/stl_pair.h: In instantiation of ‘constexpr std::pair<_T1, _T2>::pair(_U1&&, const _T2&) [with _U1 = long long unsigned int; <template-parameter-2-2> = void; _T1 = long long unsigned int; _T2 = FcitxQtICData]’:
/usr/include/c++/4.7/bits/stl_pair.h:273:72:   required from ‘constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = long long unsigned int; _T2 = FcitxQtICData; typename std::__decay_and_strip<_T2>::__type = FcitxQtICData; typename std::__decay_and_strip<_Tp>::__type = long long unsigned int]’
/usr/include/c++/4.7/bits/hashtable_policy.h:462:24:   required from ‘std::__detail::_Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::mapped_type& std::__detail::_Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::operator[](_Key&&) [with _Key = long long unsigned int; _Pair = std::pair<const long long unsigned int, FcitxQtICData>; _Hashtable = std::_Hashtable<long long unsigned int, std::pair<const long long unsigned int, FcitxQtICData>, std::allocator<std::pair<const long long unsigned int, FcitxQtICData> >, std::_Select1st<std::pair<const long long unsigned int, FcitxQtICData> >, std::equal_to<long long unsigned int>, std::hash<long long unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, false, false, true>; std::__detail::_Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::mapped_type = FcitxQtICData]’
/home/anzyelay/Downloads/fcitx-qt5-1.0.5/platforminputcontext/qfcitxplatforminputcontext.cpp:195:41:   required from here
/usr/include/c++/4.7/bits/stl_pair.h:126:45: error: use of deleted function ‘FcitxQtICData::FcitxQtICData(const FcitxQtICData&)’
In file included from /home/anzyelay/Downloads/fcitx-qt5-1.0.5/platforminputcontext/qfcitxplatforminputcontext.cpp:37:0:
/home/anzyelay/Downloads/fcitx-qt5-1.0.5/platforminputcontext/qfcitxplatforminputcontext.h:113:5: error: declared here

怀疑是GCC4.7版本不行.更新到4.9的版本,再次编译OK了,注意在编译前先把原来的配置和编译的清理下.

编译后拷贝出错

1.原来可以切换输入法了,但清理完编译后的文件后,又无法切换了

原因是相关的库没有COPY过去,解决方法:
把fcitx-qt5-1.0.5文件夹下的dbusaddons 与 widgetsaddons中的动态库全拷贝到
Qt5.6.0/Tools/QtCreator/lib/qtcreator或者Qt5.6.0/5.6/gcc_64/lib下。
两个选一个就行.

2.插件和库都移过去了还是不能切换,甚至于其它软件也不能切换了

重启机子 吧,检查下fcitx开启了没,配置下切换快捷键。

以上是关于QT5.6.0无法切换fcitx中文输入法问题记录的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu在wps-office等qt5程序下不能切换中文fcitx输入法的问题

Ubuntu20.04下使用基于fcitx的输入法时,Mendeley无法输入中文的解决方案

Ubuntu问题记录-解决Ubuntu16.04上WPS,intellij idea系列包括Android Studio无法使用fcitx的搜狗拼音的问题

树莓派3B/3B+ 清华镜像系统和安装中文输入法Fcitx及Google拼音输入法

JetBrains系列IDE无法输入中文

VSCodeVim的输入法自动切换