编译libfcitxplatforminputcontextplugin.so解决Qt5在Linux上无法输入中文的问题

2020-11-18 10:26:00  阅读 3640 次 评论 0 条

以下是我测试成功的, 

环境

deepin 15.11

Qt 5.12.9

文中涉及到的Qt路径需要根据自己安装的版本自行更改


sudo apt-get install cmake

sudo apt-get install fcitx-libs-dev


安装Git,获取fcitx-qt5源码


sudo apt install git

git clone http://github.com/fcitx/fcitx-qt5.git

进入名为fcitx-qt5文件夹


cd fcitx-qt5/

在该文件夹下配置qmake环境变量


export PATH=/home/jinesc/Qt5.12.9/5.12.9/gcc_64/bin/:$PATH

如果不知道qmake路径,可以使用


lc@deepin:~$ qmake -v

QMake version 3.1

Using Qt version 5.12.4 in /home/jinesc/Qt5.12.9/5.12.9/gcc_64/lib

最后一行in之后的就是路径了


执行cmake


lc@deepin:~/fcitx-qt5$ cmake .

成功后再执行make


lc@deepin:~/fcitx-qt5$ make

lc@deepin:~/fcitx-qt5$ sudo make install

完成之后会生成名为platforminputcontext的文件夹


进入文件夹后会有已经编译完成的libfcitxplatforminputcontextplugin.so文件


给这个文件赋予权限


lc@deepin:~/fcitx-qt5/platforminputcontext$ chmod 777 libfcitxplatforminputcontextplugin.so

最后把这个文件,复制到Qt安装路径下的这两个位置


/Qt5.12.9/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts


/Qt5.12.9/5.12.9/gcc_64/plugins/platforminputcontexts


重启Qt就可以输入中文了



简单总结一下

sudo apt-get install cmake
sudo apt-get install fcitx-libs-dev
sudo apt install git

git clone https://github.com/fcitx/fcitx-qt5.git

cd fcitx-qt5/

sudo apt-get install cmake

sudo apt-get install fcitx-libs-dev

export PATH="/home/jinesc/Qt5.12.9/5.12.9/gcc_64/bin/":$PATH

camke .

make

sudo make install

cmake错误处理:


1.Could not find a package configuration file provided by "Qt5"


export PATH="/home/user/Qtxxx/xxx/gcc_64/bin":$PATH


cmake .


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


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


tar -xvf extra-cmake-modules_1.4.0.orig.tar.xz


cd extra-cmake-modules-1.4.0


cmake .


make


sudo make install


3.Failed to find "GL/gl.h" in "/usr/include/libdrm".


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


4.Could NOT find XKBCommon_XKBCommon (missing:  XKBCommon_XKBCommon_LIBRARY XKBCommon_XKBCommon_INCLUDE_DIR) 


sudo apt install libxkbcommon-dev


5:解决CMake错误No CMAKE_CXX_COMPILER could be found.

在 WSL 中用了



make .

命令,

出现问题:



No CMAKE_CXX_COMPILER could be found.Tell CMake where to find the compiler by setting either the environment

variable “CXX” or the CMake cache entry CMAKE_CXX_COMPILER to the full path

to the compiler, or to the compiler name if it is in the PATH.

解决办法:



sudo apt-get update

sudo apt-get install -y build-essential


本文地址:http://blog.jinesc.net/?id=221
版权声明:本文为原创文章,版权归 jinesc 所有,欢迎分享本文,转载请保留出处!

发表评论


表情

还没有留言,还不快点抢沙发?