引子:陈年老e5的电脑,开始的时候sougou输入法占用了太多资源导致开机的时候打个字超级慢,最后决定放弃搜狗,用开源的输入法。安装过程中遇到太多坑随后整理个文档
环境
apt 装了rime之后发现没有输入法候选框,发现是Ubuntu自带的librime版本太低,而且没有lua支持
装CMake
直接编译最新版本的librime发现CMake版本太低cmake3.22
直接安装最新版的cmake
在这里下载对应版本的cmake
https://cmake.org/download/
解压就能用
tar -xzvf cmake-4.2.0-linux-x86_64.tar.gz
然后我为了兼容不同版本的cmake,做了个alternative
sudo update-alternatives --install /usr/bin/cmake cmake /home/yjh/My_App/cmake-4.2.0-linux-x86_64/bin/cmake 3
sudo update-alternatives --config cmake
这里配置了下
yjh@cnwfsx-172445:~/My_App$ sudo update-alternatives --config cmake
[sudo] yjh 的密码:
有 3 个候选项可用于替换 cmake (提供 /usr/bin/cmake)。
选择 路径 优先级 状态
------------------------------------------------------------
0 /home/yjh/My_App/cmake-4.2.0-linux-x86_64/bin/cmake 3 自动模式
1 /home/yjh/My_App/cmake-3.16.8-Linux-x86_64/bin/cmake 1 手动模式
* 2 /home/yjh/My_App/cmake-4.2.0-linux-x86_64/bin/cmake 3 手动模式
3 /usr/bin/cmake3.22 2 手动模式
我这里选上最新版本的,
cmake --version
cmake version 4.2.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
更新glog
在编译librime的时候发现glog的报错
/home/yjh/My_App/librime/src/rime/setup.cc:90:15: error: ‘IsGoogleLoggingInitialized’ is not a member of ‘google’
90 | if (google::IsGoogleLoggingInitialized()) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[3]: *** [src/CMakeFiles/rime.dir/build.make:345:src/CMakeFiles/rime.dir/rime/setup.cc.o] 错误 1
很好我的电脑glog版本又不对,我本地是0.4的***需要更新到0.6***
sudo apt install -y cmake build-essential
git clone https://jiashu.1win.eu.org/https://github.com/google/glog.git -b v0.6.0
cd glog
cmake -B build \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF
cmake --build build -j$(nproc)
sudo cmake --install build
sudo ldconfig
更新好了
pkg-config --modversion libglog
0.6.0
编译安装librime
下载librime
这里就不赘述了
cd librime
装插件,要下两个插件到librime的plugins目录
git clone https://jiashu.1win.eu.org/https://github.com/hchunhui/librime-lua.git plugins/lua
git clone https://jiashu.1win.eu.org/https://github.com/rime/librime-charcode.git plugins/charcode
开始编译就得了
~/My_App/librime$ cmake -B build -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_PREFIX_PATH="/usr/local" \
-DBUILD_TEST=OFF \
-DENABLE_LOGGING=ON
ninja -C build
sudo ninja -C build install
sudo ldconfig
重新安装下
sudo apt install fcitx5-rime
然后重启fcitx5
就OK了