fcitx5-mozc-utのビルドにこけて、インストールまでできた 2025/06

引用元画像:[Google Japanese Input - Wikipedia](https://en.wikipedia.org/wiki/Google_Japanese_Input)



2025-06-02 にアプデがあったfcitx5-mozc-utのビルドにつまづいた

  • ビルドしたいバージョン:fcitx5-mozc-ut-2.31.5851.102.20250602
  • アップデート到来日:2025-06-02

ビルドエラーログ
Starting local Bazel server (8.2.1) and connecting to it...
INFO: Analyzed 4 targets (200 packages loaded, 11004 targets configured).
ERROR: /home/USER/.cache/yay/fcitx5-mozc-ut/src/mozc/src/rewriter/BUILD.bazel:1569:15: Linking rewriter/gen_collocation_data_main [for tool] failed: (Exit 1): gcc failed: error executing CppLink command (from target //rewriter:gen_collocation_data_main) /usr/bin/gcc @bazel-out/k8-opt-exec-ST-d57f47055a04/bin/rewriter/gen_collocation_data_main-0.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
collect2: fatal error: cannot find 'ld'
compilation terminated.
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 20.487s, Critical Path: 3.31s
INFO: 4 processes: 1388 action cache hit, 4 internal.
ERROR: Build did NOT complete successfully
==> エラー: build() で問題が発生しました。
    中止...
 -> ビルド時にエラー: fcitx5-mozc-ut-exit status 4
 -> Failed to install the following packages. Manual intervention is required:
fcitx5-mozc-ut - exit status 4
mozc-utのビルドでエラーをする場合って、たいていソースとなっている辞書データの配布の入手先情報が変更があったり、ハッシュが合わないとかなんだけど今回の私のエラーを見ると、

collect2: fatal error: cannot find 'ld'
このエラーはおかしい。ldって、Linuxにプリインストール(?)されるような基本的なコマンだろう?これが見つけられないってどういうことよ?OSはManjaroLinux


ビルドに、bazelが使われているがどうやってこの問題を修正すればいいのかわからない。ってことでChatgptに聞いてみると、PKGBUILDファイルに以下を追記することで解決できた。
build() {
    cd mozc/src
### 独自挿入
	export CC=/usr/bin/gcc
	export CXX=/usr/bin/g++
### ここまで

    unset ANDROID_NDK_HOME
    unset ANDROID_HOME
    export JAVA_HOME='/usr/lib/jvm/java-21-openjdk/'

    bazel build server:mozc_server gui/tool:mozc_tool unix/fcitx5:fcitx5-mozc.so unix/icons --config oss_linux --compilation_mode opt  --verbose_failures --sandbox_debug
}      
/usr/bin/ld ちゃんと存在する。これをおそらく$PATHで参照するのがうまくいっていないんじゃね?ってのがChatGptの返答でした。



fcitx5-mozc-utのUTってなぁに?

   UT(University of Tokyo) Mozc。   
  • 東京大学・加藤研究室(加藤恒昭教授)が拡張した Mozc の派生版。
  • 文節区切りや候補の選択精度を改善した独自アルゴリズム。
  • より自然な日本語変換が可能。
  • 標準辞書使用(Neologd 非対応)。
utとは、University Tokyo のことなんですね。AURむけにパッケージング他、開発をしてくださっているのは  http://linuxplayers.g1.xrea.com/mozc-ut.html こちらのサイト主さまです。

簡単に使用感を向上させたといっても、開発者様、それからパッケージングをしてくださっているサイト主さまによる大変な努力によって成り立っております。感謝です。いつもアプリを使用させていただきありがとうございます。大変お世話になっております。



さいごまでお読みいただきありがとうございました

まとめ
  • fcixt5-mozc-ut のビルドに躓いた理由は、ldコマンドが参照できていなかったから
  • 10年前のPCでビルドにかかった時間は8分くらい。(主観)
  • AURの掲示板にすぐコメントするのではなくて、自環境でできそうなことをまずやってみる。
  • 解決法がわからなくても、原因を探ることはChatgptに聞かなくてもできる

コメント

item