赞
踩
本文记录了在CentOS Stream 9 上源码编译安装Fcitx5中文输入法的流程以及相关依赖
参考资料:
安装C++系列编译环境
sudo dnf groupinstall "Development Tools"
以下是安装完之后通过history命令查看的所有安装依赖包, 编译需要相关的头文件,所以全部要安装带-devel后缀的包, 否则即使安装了依然找不到依赖
sudo dnf install libxcb-devel.x86_64 qt5-devel.noarch qt5-devel qt5-qtbase-devel qt5-qttools-devel make gcc-c++ xcb-util-keysyms-devel.x86_64 xcb-util-image-devel.x86_64 xcb-util-devel.x86_64 xcb-util-cursor-devel.x86_64 xcb-util-xrm-devel.x86_64 xcb-util-renderutil-devel.x86_64 \
libutempter-devel.x86_64 uthash-devel uthash-devel.noarch systemd-devel.x86_64 libuuid-devel.x86_64 fmt-devel.x86_64 xcb-util-wm-devel.x86_64 cairo-devel.x86_64 cairo-gobject-devel.x86_64 \
cairomm-devel.x86_64 libxkbfile-devel expat-devel.x86_64 libxkbcommon-devel.x86_64 libxkbcommon-x11-devel.x86_64 iso-codes-devel.noarch xkeyboard-config-devel.noarch json-c-devel.x86_64 enchant-devel.x86_64 enchant2-devel.x86_64 pango-devel.x86_64 \
gdk-pixbuf2-devel.x86_64 gdk-pixbuf2-xlib-devel.x86_64 doxygen qt5-qtbase-devel qt5-qtbase-private-devel gtk2-devel.x86_64 gtk2-immodules.x86_64 gtk2-immodule-xim.x86_64 gtk2-engines-devel.x86_64 gtk3-devel.x86_64 gtk3-immodule-xim.x86_64 gtk4-devel.x86_64 gtkmm30-devel.x86_64 gtkspell3-devel.x86_64 \
qt5-qtwebengine-devel.x86_64 qt5-qtwebkit-devel.x86_64 qt5-qtwebview-devel.x86_64 boost-devel.x86_64 libpinyin-devel.x86_64 gobject-introspection-devel.x86_64 libcurl-devel.x86_64 kf5-kitemviews-devel.x86_64 \
qt5-qtquickcontrols2-devel.x86_64 kf5-kcoreaddons-devel.x86_64 kf5-ki18n-devel.x86_64 kf5-kpackage-devel.x86_64 kf5-kdeclarative-devel.x86_64 kf5-kiconthemes-devel.x86_64 kf5-kirigami2-devel.x86_64 kf5-plasma-devel.x86_64 kf5-kwidgetsaddons-devel.x86_64
依赖不一定完整, 编译过程中 Cmake检查缺少依赖将缺少的依赖库名放网上查找相关的包, 找到包名后, 通过dnf list package_name *
查找带-devel后缀的包, 缺少的依赖大概率需要安装-devel包才能解决
所有模块编译后安装到默认位置,因为互相有依赖关系,不建议自定义安装位置,经过观察几乎都是/usr/local 目录下
以下模块需要按顺序安装,前后具有依赖关系
git clone https://github.com/fcitx/xcb-imdkit.git
cd xcb-imdkit
cd mkdir build && cd $_ && cmake .. && make && sudo make install
git clone https://github.com/fujiwarat/cldr-emoji-annotation.git
cd cldr-emoji-annotation
./autogen.sh
./configure
make && sudo make install
输入法核心库
查看当前使用的显示协议
echo $XDG_SESSION_TYPE
#输出x11,wayland,tty...
我这儿使用的是x11, 所以添加-DENABLE_WAYLAND=Off
禁用wayland
git clone https://github.com/fcitx/fcitx5.git
cd fcitx5
cmake -DENABLE_WAYLAND=Off .
make
sudo make install
IME依赖
git clone https://github.com/BYVoid/OpenCC.git
cd OpenCC
mkdir build
cd build
cmake ..
make && sudo make install
编译安装完成之后, 后续检查依赖时可能仍然找不到opencc库
检查OpenCC是否可用,如果输出版本号则一切正常,否则继续配置
pkg-config opencc --modversion
配置pkgconfig, Cmake才能找到依赖库
sudo cp OpenCC/build/rel/opencc.pc /usr/lib64/pkgconfig
IME依赖
git clone https://github.com/fcitx/libime.git
cd libime
#如果缺少该命令,则找不到kenlm相关的依赖
git submodule update --init
mkdir build && cd $_
cmake .. && make -j`nproc` && sudo make install
如果这儿在提示缺少LibIME相关的依赖,那么先安装libime
这儿使用的Qt5 所以禁用Qt4 -DENABLE_QT4=Off
git clone https://github.com/fcitx/fcitx5-qt.git
cd fcitx5-qt
cmake -DENABLE_QT4=Off .
make
sudo make install
安装完成之后,执行 fcitx5-diagnose
检查一下是否有明显错误,如果有参考开头的参考资料排错
git clone https://github.com/fcitx/fcitx5-gtk.git
cd fcitx5-gtk
cmake -DENABLE_GTK4_IM_MODULE=Off .
make
sudo make install
中文输入法, 依赖上面所有的模块
git clone https://github.com/fcitx/fcitx5-chinese-addons.git
cd fcitx5-chinese-addons
mkdir build
cd build
cmake ..
make
sudo make install
配置工具
git clone https://github.com/fcitx/fcitx5-configtool.git
cd fcitx5-configtool
cmake .
make && sudo make install
在 ~/.bashrc添加
export GTK_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
export QT_IM_MODULE=fcitx
source ~/.bashrc
注销用户重新登录
启动输入法 fcitx5
打开配置界面 fcitx5-configtool
, 配置偏好
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。