首页 > 系统相关 >国产化麒麟linux系统QtCreator和QtCreator编译的程序无法输入中文libfcitx最新版本编译1.2.7

国产化麒麟linux系统QtCreator和QtCreator编译的程序无法输入中文libfcitx最新版本编译1.2.7

时间:2023-06-03 10:44:22浏览次数:53  
标签:cmake Qt 1.2 package sudo 编译 QtCreator bison find

1.问题描述

麒麟linux系统QtCreator和QtCreator编译的程序无法输入中文,网上找了很多的libfcitxplatforminputcontextplugin.so库都无法使用正常输入;

Qt版本:5.9.6

麒麟系统版本:海光麒麟桌面版kylin V10 SP1  小版本号2203 XC-P923P_KOS_2203_AMD_HG_3250_220630_AUDIT_ACTIVE.iso 

2.原因分析

是因为缺少了libfcitxplatforminputcontextplugin.so库的原因,但是要编译这个库设置的Qt版本和你的Qt版本匹配才能正常输入,否则无法输入中文;

网上说将路径/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so

复制到程序路径的platforminputcontexts文件夹下,就可以,但是实际测试不行;网上也找了很多编译过的libfcitxplatforminputcontextplugin.so文件,但是都不行。原因是Qt版本不匹配,导致库不能正常加载,程序打开后,切换到中文输入法,没有响应;所以需要针对具体的Qt版本去重新边编译libfcitxplatforminputcontextplugin.so库;我的Qt版本是5.9.6,编译库的时候也需要指定Qt路径,这就是为什么版本不匹配无法正常加载的原因;

3.解决办法:

按照对应的Qt版本去编译这个库libfcitxplatforminputcontextplugin.so;

下面的连接包含成果物和源码,如果你的Qt版本是5.9.6,可以复制连接下载直接,如果不是可以下载下面的连接源码去设置指定QT版本去编译;

链接:https://pan.baidu.com/s/1zvXWSMHDQEvg5tuiIJYAEA
提取码:关注微信:QStockView,发送麒麟中文,立刻回复给你;

1)安装cmake

联网直接输入命令:sudo apt-get install cmake  来安装cmake

下载cmake

http://www.cmake.org/cmake/resources/software.html

将Linux版本软件包解压,tar –zxvf cmake-3.26.3-linux-x86_64.tar.gz

重命名解压文件夹未cmake mv cmake-3.26.3-linux-x86_64 cmake

添加系统路径,export PATH=$PATH:/home/hik/soft/cmake/bin

查看cmake是否安装成功,cmake --version

下载fcitx最新版本

https://download.fcitx-im.org/fcitx-qt5/

cd fcitx-qt5

cmake .

make

sudo make install

执行cmake会报如下错误

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!

遇到上述错误处里方法:

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

 https://launchpad.net/ubuntu/+source/extra-cmake-modules/5.18.0-0ubuntu1  extra-cmake-modules_5.18.0.orig.tar.xz

2)安装 extra-cmake-modules_1.4.0.orig.tar.xz

如果联网直接用命令:sudo apt-get install extra-cmake-modules

如果不能联网,则解压后执行下面的命令:

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

再次执行fcitx的cmake命令会报如下错误:

- Could NOT find XKBCommon_XKBCommon (missing: XKBCommon_XKBCommon_LIBRARY XKBCommon_XKBCommon_INCLUDE_DIR) (found version "")

CMake Error at /home/hik/soft/cmake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):

  Could NOT find XKBCommon (missing: XKBCommon_LIBRARIES XKBCommon) (Required

  is at least version "0.5.0")

Call Stack (most recent call first):

  /home/hik/soft/cmake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)

  cmake/FindXKBCommon.cmake:30 (find_package_handle_standard_args)

  CMakeLists.txt:43 (find_package)

 

 

-- Configuring incomplete, errors occurred!

解决办法

联网直接调用sudo apt-get install libxkbcommon-dev

(3)安装libxkbcommon-dev

联网直接调用sudo apt install libxkbcommon-dev

离线下载安装包

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

解压:tar xf libxkbcommon-0.5.0.tar.xz

进入目录:cd libxkbcommon-0.5.0

禁用高版本编译器并生成makefile文件:./configure --disable-x11

编译:make

安装:sudo make install

执行make的时候又报错

YACC     src/xkbcomp/parser.c

./build-aux/ylwrap:行176: yacc:未找到命令

make: *** [Makefile:1522:src/xkbcomp/parser.c] 错误 127

解决办法:安装bison

(4)安装Bison

需要​​yacc​​的支持。这个工具包含在软件包​​bison​​中,联网直接执行命令:sudo apt-get install bison

离线下载

https://pkgs.org/download/bison

麒麟系统选择bison_3.5.1+dfsg-1_amd64.deb

将这个下载地址复制到浏览器后下载文件,复制到电脑上进行安装

http://archive.ubuntu.com/ubuntu/pool/main/b/bison/bison_3.5.1+dfsg-1_amd64.deb

安装命令:sudo dpkg -i bison_3.5.1+dfsg-1_amd64.deb

版本选3.8.2,太高会报如下错误

正在解压 bison (2:3.8.2+dfsg-1build1) ...

dpkg: 依赖关系问题使得 bison 的配置工作不能继续:

 bison 依赖于 libc6 (>= 2.34);然而:

系统中 libc6:amd64 的版本为 2.31-0kylin9.1k20.5。

也不能选太低的版本,否则会报错:

准备解压 bison_3.0.4.dfsg-1build1_amd64.deb  ...

正在解压 bison (2:3.0.4.dfsg-1build1) 并覆盖 (2:3.8.2+dfsg-1build1) ...

dpkg: 依赖关系问题使得 bison 的配置工作不能继续:

 bison 依赖于 libbison-dev (= 2:3.0.4.dfsg-1build1);然而:

  未安装软件包 libbison-dev。

(5)继续执行安装libxkbcommon-dev

进入目录:cd libxkbcommon-0.5.0/

编译:make

安装:sudo make install

(6)继续安装fcitx

cd fcitx-qt5-1.2.7/

mkdir build

cd build

cmake ..

报错如下

CMake Error at CMakeLists.txt:46 (find_package):

  By not providing "FindFcitx.cmake" in CMAKE_MODULE_PATH this project has

  asked CMake to find a package configuration file provided by "Fcitx", but

  CMake did not find one.

  Could not find a package configuration file provided by "Fcitx" (requested

  version 4.2.8) with any of the following names:

    FcitxConfig.cmake

    fcitx-config.cmake 

  Add the installation prefix of "Fcitx" to CMAKE_PREFIX_PATH or set

  "Fcitx_DIR" to a directory containing one of the above files.  If "Fcitx"

  provides a separate development package or SDK, be sure it has been

  installed.

解决办法增加编译参数

cmake -DENABLE_LIBRARY=false ..

出现如下报错:

CMake Error at qt5/CMakeLists.txt:1 (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.

解决方法:

添加qt环境变量,电脑要安装Qt,这里是Qt的安装路径,关键步骤,指定qt编译环境

export CMAKE_PREFIX_PATH=/home/hik/Qt5.9.6/5.9.6/gcc_64

再次执行cmake命令:

hik@hik-dsvt420rhb:~/soft/fcitx-qt5-1.2.7$ cmake -DENABLE_LIBRARY=false .

出现如下报错:

CMake Error at /home/hik/Qt5.9.6/5.9.6/gcc_64/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:9 (message):

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

Call Stack (most recent call first):

  /home/hik/Qt5.9.6/5.9.6/gcc_64/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:172 (include)

  /home/hik/Qt5.9.6/5.9.6/gcc_64/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake:89 (find_package)

  /home/hik/Qt5.9.6/5.9.6/gcc_64/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package)

  qt5/CMakeLists.txt:1 (find_package)

解决方法:

网上查询了一下发现时未安装opengl,于是安装便是了

sudo apt install mesa-common-dev

又出现如下报错: 

执行来更新缺少的软件包

sudo apt-get update

sudo apt-get update –fix-missing

然后再执行如下安装命令,就安装成功了;

sudo apt install mesa-common-dev

再次执行cmake -DENABLE_LIBRARY=false ..

在build文件夹会生成makefile文件,进入build目录执行make命令出现如下错误error: no matching function for call to ‘QMetaObject::invokeMethod(QFcitxPlatformInputContext*, QFcitxPlatformInputContext::setFocusObject(QObject*)::<lambda()>, Qt::ConnectionType)

从这里下载替换的qfcitxplatforminputcontext.cpp 和qfcitxplatforminputcontext.h文件,替换到路径/soft/fcitx-qt5-1.2.7/qt5/platforminputcontext

https://url25.ctfile.com/f/34628125-616663558-6a6901?p=3005 (访问密码: 3005)

最后执行make就会生成so文件

已经编译好的库文件下载链接如下,包含源码,如果使用Qt版本不匹配,需要重新用源码编译,

链接:https://pan.baidu.com/s/1zvXWSMHDQEvg5tuiIJYAEA
提取码:关注微信:QStockView,发送麒麟中文,立刻回复给你;

(7)将soft/fcitx-qt5-1.2.7/build/qt5/platforminputcontext路径下生成的库文件复制到你的程序目录platforminputcontexts下面,就可以输入中文了;

(8)将库文件复制到如下Qt安装路径,然后重新打开Qtcreator,使得Qtcreator能够输入中文

/home/hik/Qt5.9.6/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts

/home/hik/Qt5.9.6/5.9.6/gcc_64/plugins/platforminputcontexts

标签:cmake,Qt,1.2,package,sudo,编译,QtCreator,bison,find
From: https://www.cnblogs.com/bclshuai/p/17453433.html

相关文章

  • 查 101.201.62.30 IP信誉方法
    查101.201.62.30IP信誉方法https://www.virustotal.com/#/ip-address/101.201.62.30https://talosintelligence.com/reputation_center/lookup?search=101.201.62.30https://x.threatbook.cn/ip/101.201.62.30......
  • [Libjingle 0.4]编译Libjingle 0.4+Linphone Voice Engine的总结之一
    在Windows下编译Libjingle0.4+LinphoneVoiceEngine时候会遇到一些问题,下面整理了一下,当然并不是所有的patch都有用的.http://code.google.com/p/libjingle/issues/detail?id=16***64-bit.patch******ortp.patch******gcc4.patch******libjingle-fileshare.patc......
  • Java编译与反编译
    Java编译与反编译什么是编译利用编译程序从源语言编写的源程序产生目标程序的过程。用编译程序产生目标程序的动作。编译就是把高级语言变成计算机可以识别的2进制语言,计算机只认识1和0,编译程序把人们熟悉的语言换成2进制的。编译程序把一个源程序翻译成目标程序的工作过程......
  • apktool反编译及后续打包
    资料apktool下载地址androidstudio查看默认签名apktool重打包失败原因之一分析:微信使用apktool反编译后回编译出错如何使用apktool解码,打包,签名HowFixbrut.androlib.AndrolibException:brut.common.BrutException:couldnotexec(exitcode=-1073741515)Android反编译Apk......
  • MSYS&MINGW环境中编译mediastream2和ortp
    (1)安装intltool访问http://ftp.acc.umu.se/pub/GNOME/binaries/win32/intltool/0.40/并下载intltool_0.40.4-1_win32.zip,解压到c:\msys目录下;[color=blue][注:这一步可以不需要][/color](2)安装linphone-deps:访问http://download.savannah.gnu.org/releases-noredirect/linp......
  • Linux 编译安装 php 扩展 amqp
    这里最大的坑,就是  rabbitmq-c和amqp扩展版本不符,导致的各种bug。其他也没啥,这里简单记录下:我这里使用的环境:php7.4  、rabbitmq-c0.7.1、amqp1.9.4. 安装rabbitmq-c(注意记住你的安装位置,下一步要用)wgethttps://github.com/alanxz/rabbitmq-c/releases/download......
  • 要编译代码以控制其在Flash或SRAM中运行
    要编译代码以控制其在Flash或SRAM中运行,您需要在编译过程中进行一些配置。以下是一些建议:1.使用链接脚本链接脚本是在编译过程中使用的一种文件,用于控制程序代码和数据在内存中的布局。您可以在链接脚本中指定代码应存储在哪个内存区域(例如Flash或SRAM)。例如,在GNUGCC工具链中......
  • 2023安卓逆向 -- JNI学习(从开发到反编译)
    一、新建nativeC++项目,填写好项目信息,一路下一步即可二、创建好项目,直接点击运行,出现下面界面,说明我们的环境都没有问题三、Java层调用java层函数1、新建一个JavaClass,命名为JavaFun2、编写java函数packagecom.example.jnitest;publicclassJavaFun{publicstaticStr......
  • Python网页开发神器fac 0.2.9、fuc 0.1.29新版本更新内容介绍
    fac项目地址:https://github.com/CNFeffery/feffery-antd-componentsfuc项目地址:https://github.com/CNFeffery/feffery-utils-components欢迎star支持⭐大家好我是费老师,由我开源维护的Python网页开发相关组件库fac和fuc分别更新到了0.2.9版本和0.1.29版本,本文就将为大家......
  • 仙境传说RO:从零开始编译服务端开发环境搭建安装Pandas-rAthena
    仙境传说RO:从零开始编译服务端开发环境搭建安装Pandas-rAthena大家好,我是艾西今天跟大家分享下仙境传说RO开发脚本环境搭建。Pandas是RO的模拟器实际上是开源的一个叫做rAthenna的一个开源项目准备工具:Git2.25.0Setup建议放入D盘以免后期的麻烦(默认配置就好)TortoiseGit2.9.0.0......