登録日: 2020-07-30 更新日: 2020-07-31
Fedora 32(GNOME Wayland)では、今のところ「Qt アプリ」で日本語入力できません。
CentOS 8.2 ではどうなのか確認しました。epel リポジトリ(Fedora アプリの一部流用)の追加でも、Qt アプリが見つからないので、よく使っているfeatherpad をソースからビルドしてみました。
-
-
使用環境:
「CentOS」の「CentOS-8.2.2004」をUSB メモリにインストール して、そこに「GNOME」デスクトップ環境をインストール しました。そして、「epel」リポジトリを追加しています。
-
featherpad をソースからビルド
-
公式サイト:
-
ビルドとインストール、翻訳の手順:
-
1. 作業用に、~/Git/ フォルダ作成(任意)
$ cd $ mkdir Git
-
2. git があるか確認:
$ git --version git version 2.18.4
-
3. ビルドの依存関係をインストール:
$ sudo dnf update
-
パッケージをまとめてインストールします:
$ sudo dnf install gcc-c++ libX11-devel libXext-devel qt5-qtx11extras-devel qt5-qtbase-devel qt5-qtsvg-devel hunspell-devel qt5-qttools-devel
-
参考: インストールの状態を確認したいので、ひとつずつインストール:
こちらは上記のインストールを行えば必要ありません。
完了時に表示される「インストール済み」は「インストール完了」のことです。
$ sudo dnf install gcc-c++ : インストール済み: cpp-8.3.1-5.el8.0.2.x86_64 gcc-8.3.1-5.el8.0.2.x86_64 gcc-c++-8.3.1-5.el8.0.2.x86_64 isl-0.16.1-6.el8.x86_64 libstdc++-devel-8.3.1-5.el8.0.2.x86_64 - $ sudo dnf install libX11-devel : インストール済み: libX11-devel-1.6.8-3.el8.x86_64 libXau-devel-1.0.8-13.el8.x86_64 libxcb-devel-1.13.1-1.el8.x86_64 xorg-x11-proto-devel-2018.4-1.el8.noarch - $ sudo dnf install libXext-devel : インストール済み: libXext-devel-1.3.3-9.el8.x86_64 - $ sudo dnf install qt5-qtx11extras-devel : インストール済み: cmake-3.11.4-7.el8.x86_64 cmake-data-3.11.4-7.el8.noarch cmake-filesystem-3.11.4-7.el8.x86_64 cmake-rpm-macros-3.11.4-7.el8.noarch libglvnd-core-devel-1:1.2.0-6.el8.x86_64 libglvnd-devel-1:1.2.0-6.el8.x86_64 libglvnd-opengl-1:1.2.0-6.el8.x86_64 libuv-1:1.23.1-1.el8.x86_64 qt5-qtbase-devel-5.12.5-4.el8.x86_64 qt5-qtx11extras-devel-5.12.5-1.el8.x86_64 qt5-rpm-macros-5.12.5-3.el8.noarch - $ sudo dnf install qt5-qtbase-devel : パッケージ qt5-qtbase-devel-5.12.5-4.el8.x86_64 はすでにインストールされています - $ sudo dnf install qt5-qtsvg-devel : インストール済み: qt5-qtsvg-devel-5.12.5-1.el8.x86_64 - $ sudo dnf install hunspell-devel : インストール済み: hunspell-devel-1.6.2-1.el8.x86_64 ←(qmake で問題が発生) - $ sudo dnf install qt5-qttools-devel : インストール済み: clang-libs-9.0.1-2.module_el8.2.0+309+0c7b6b03.x86_64 compiler-rt-9.0.1-2.module_el8.2.0+309+0c7b6b03.x86_64 libomp-9.0.1-1.module_el8.2.0+309+0c7b6b03.x86_64 qt5-designer-5.12.5-1.el8.0.1.x86_64 qt5-doctools-5.12.5-1.el8.0.1.x86_64 qt5-linguist-5.12.5-1.el8.0.1.x86_64 qt5-qttools-5.12.5-1.el8.0.1.x86_64 qt5-qttools-devel-5.12.5-1.el8.0.1.x86_64 qt5-qttools-libs-designercomponents-5.12.5-1.el8.0.1.x86_64 qt5-qttools-libs-help-5.12.5-1.el8.0.1.x86_64
→Qt アプリをいくつかインストールしたので、すでに入っているパッケージがありました。
-
4. ソースをダウンロード:
$ cd ~/Git/ [~/Git]$ git clone https://github.com/tsujan/FeatherPad.git [~/Git]$ cd ~/Git/FeatherPad/ [~/Git/FeatherPad]$ ls -a . .git COPYING INSTALL README.md featherpad screenshots .. CMakeLists.txt ChangeLog NEWS cmake fp.pro
→git を使う場合、「.git 」があるのがポイントです。今回は使いません。
-
ここからは、ビルドに使うツールで、手順が別れます
5. cmake を使ってビルドする場合
7. qmake を使ってビルドする場合 ←(参考)
-
5. cmake を使ってビルドする場合: ←(成功)
「7.qmake を使ってビルドする場合」を実行して完了していれば、ここの手順は要りません。
もし、ビルドに失敗したら、「~/Git/FeatherPad」にある「build」フォルダを削除して、5-2. cmake からやり直します。
-
5-1. ビルドのツールが準備できているか確認:
$ make --version GNU Make 4.2.1 $ cmake --version cmake version 3.11.4
-
5-2. cmake を実行:
$ cd ~/Git/FeatherPad/ [~/Git/FeatherPad]$ mkdir build && cd build
→「build」フォルダを作成、そこに出力して作業エリアを分離しています。汚れません。
-
[~/Git/FeatherPad/build]$ cmake .. -- The C compiler identification is GNU 8.3.1 -- The CXX compiler identification is GNU 8.3.1 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found PkgConfig: /usr/bin/pkg-config (found version "1.4.2") -- Found HUNSPELL: /usr/lib64/libhunspell-1.6.so (found suitable version "1.6.2", minimum required is "1.6") -- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so -- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so - found -- Looking for gethostbyname -- Looking for gethostbyname - found -- Looking for connect -- Looking for connect - found -- Looking for remove -- Looking for remove - found -- Looking for shmat -- Looking for shmat - found -- Found X11: /usr/lib64/libX11.so -- Configuring done -- Generating done -- Build files have been written to: /home/ubn/Git/FeatherPad/build
→これは使われるツール類がそろっているかのチェックです。エラーがないことを確認。 エラー表示されるなら依存パッケージが不足しています。
[~/Git/FeatherPad/build]$ ls CMakeCache.txt CMakeFiles Makefile cmake_install.cmake featherpad
→新しく作られた「build」フォルダは空でしたが、多くのファイルが作られました。
-
5-3. make を実行:
[~/Git/FeatherPad/build]$ make Scanning dependencies of target featherpad_autogen [ 1%] Automatic MOC and UIC for target featherpad [ 1%] Built target featherpad_autogen : [100%] Creating fpad as a symlink to featherpad [100%] Built target fpad_symlink
確認:
[~/Git/FeatherPad/build]$ ls CMakeCache.txt CMakeFiles Makefile cmake_install.cmake featherpad [~/Git/FeatherPad/build]$ ls featherpad/ CMakeFiles featherpad_da.qm featherpad_id.qm featherpad_pt_BR.qm Makefile featherpad_de.qm featherpad_it.qm featherpad_pt_PT.qm cmake_install.cmake featherpad_el.qm featherpad_ja.qm featherpad_ru.qm featherpad featherpad_eo.qm featherpad_ko.qm featherpad_sk_SK.qm featherpad_ar_DZ.qm featherpad_es.qm featherpad_lt.qm featherpad_tr.qm featherpad_autogen featherpad_fa.qm featherpad_nb_NO.qm featherpad_zh_CN.qm featherpad_cs.qm featherpad_fr.qm featherpad_nl.qm featherpad_zh_TW.qm featherpad_cy.qm featherpad_hu.qm featherpad_pl.qm fpad [~/Git/FeatherPad/build]$ ls featherpad/featherpad_autogen/ EWIEGA46WW QYFM2Z2WYQ include moc_predefs.h mocs_compilation.cpp
-
5-4. インストール
[~/Git/FeatherPad/build]$ sudo make install [sudo] パスワード: [ 1%] Automatic MOC and UIC for target featherpad [ 1%] Built target featherpad_autogen [ 98%] Built target featherpad [100%] Creating fpad as a symlink to featherpad [100%] Built target fpad_symlink Install the project... -- Install configuration: "Release" -- Installing: /usr/share/featherpad/translations/featherpad_ar_DZ.qm -- Installing: /usr/share/featherpad/translations/featherpad_cs.qm -- Installing: /usr/share/featherpad/translations/featherpad_cy.qm -- Installing: /usr/share/featherpad/translations/featherpad_da.qm -- Installing: /usr/share/featherpad/translations/featherpad_de.qm -- Installing: /usr/share/featherpad/translations/featherpad_el.qm -- Installing: /usr/share/featherpad/translations/featherpad_eo.qm -- Installing: /usr/share/featherpad/translations/featherpad_es.qm -- Installing: /usr/share/featherpad/translations/featherpad_fa.qm -- Installing: /usr/share/featherpad/translations/featherpad_fr.qm -- Installing: /usr/share/featherpad/translations/featherpad_hu.qm -- Installing: /usr/share/featherpad/translations/featherpad_id.qm -- Installing: /usr/share/featherpad/translations/featherpad_it.qm -- Installing: /usr/share/featherpad/translations/featherpad_ja.qm -- Installing: /usr/share/featherpad/translations/featherpad_ko.qm -- Installing: /usr/share/featherpad/translations/featherpad_lt.qm -- Installing: /usr/share/featherpad/translations/featherpad_nb_NO.qm -- Installing: /usr/share/featherpad/translations/featherpad_nl.qm -- Installing: /usr/share/featherpad/translations/featherpad_pl.qm -- Installing: /usr/share/featherpad/translations/featherpad_pt_BR.qm -- Installing: /usr/share/featherpad/translations/featherpad_pt_PT.qm -- Installing: /usr/share/featherpad/translations/featherpad_ru.qm -- Installing: /usr/share/featherpad/translations/featherpad_sk_SK.qm -- Installing: /usr/share/featherpad/translations/featherpad_tr.qm -- Installing: /usr/share/featherpad/translations/featherpad_zh_CN.qm -- Installing: /usr/share/featherpad/translations/featherpad_zh_TW.qm -- Installing: /usr/bin/featherpad -- Installing: /usr/share/applications/featherpad.desktop -- Installing: /usr/share/icons/hicolor/scalable/apps/featherpad.svg -- Installing: /usr/share/featherpad/help -- Installing: /usr/share/featherpad/help_ja -- Installing: /usr/bin/fpad
→インストールが完了しました。
どこにどのファイルが配置されたかが見えます。
-
5-5. 確認:
$ which featherpad /usr/bin/featherpad $ whereis featherpad featherpad: /usr/bin/featherpad /usr/share/featherpad
featherpad の設定ファイル:
$ ls ~/.config/featherpad fp.conf
-
5-6. 端末にて、バージョン表示:
$ featherpad --version FeatherPad 0.15.0
→端末にてバージョン表示させても、Wayland の警告が表示されません。 バージョンはすごく上がってます。
-
5-7. 端末から、featherpad を起動:
$ featherpad Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
→メッセージを確認するために、端末で featherpad を起動すると、Qt アプリで表示される、Wayland の警告が表示されました。
featherpad は起動され、日本語入力できました。
-
5-8. メニューから、featherpad を起動
Ctrl + Windows キー →FeatherPad
→メニューのfeatherpad アプリのアイコンが「未定義アイコン」です。
-
アプリが起動されました:
→日本語入力できました。
-
5-9. 画面を見やすく設定
行番号を表示して、背景を暗く変更しました:
→Markdown ファイルが、見やすい色で表示されるのが利点です。
-
6. メニューのfeatherpad の「未定義アイコン」を解消
featherpad をビルドしてインストールすると、メニューのアプリアイコンが「未定義アイコン」でした。
- アプリのアイコンのデータベースの更新が必要です。
コマンドを忘れました。 他のアプリをインストールすればインストーラがデータベースを更新して解消してくれるので、それで対処します。
インストールするアプリは何でもよいはずです。
IDLE は、通常、Python と一緒にインストールされていますが、こちらの CentOS のGNOME には入っていません。 インストール時のソフトウェア選択で違うのかな。よい機会なので入れてみました。
-
IDLE3 のインストール:
$ sudo dnf install python3-idle : インストール済み: python3-idle-3.6.8-23.el8.x86_64
-
IDLE3 をインストールした後、featherpad アプリのアイコンが正常になりました:
-
7. qmake を使ってビルドする場合: ←(参考です)
「5. cmake を使ってビルドする場合」を実行して完了していれば、ここの手順は要りません。
ビルドに失敗したら、「~/Git」フォルダにある「FeatherPad」フォルダを削除して、「4. ソースをダウンロード:」からやり直します。
-
7-1. ビルドのツールが準備できたか確認:
$ make --version GNU Make 4.2.1
-
$ qmake --version bash: qmake: コマンドが見つかりませんでした... $ ls /usr/lib64/qt5/bin/qmake /usr/lib64/qt5/bin/qmake $ /usr/lib64/qt5/bin/qmake --version QMake version 3.1 Using Qt version 5.12.5 in /usr/lib64
→パスが通っていません。使うときはパス指定が必要です。
-
7-2. qmake のための修正:
Qt5の「lrelease」バイナリのフルパスを調べます:
$ ls /usr/lib64/qt5/bin/lrelease /usr/lib64/qt5/bin/lrelease
-
「featherpad/featherpad.pro」を修正します:
$ cd ~/Git/FeatherPad/ [~/Git/FeatherPad]$ gedit featherpad/featherpad.pro
テキストエディタにて、「lrelease」で検索:
95 行目以降を 2つ修正します:
#TRANSLATIONS exists($$[QT_INSTALL_BINS]/lrelease) { TRANSLATIONS = $$system("find data/translations/ -name 'featherpad_*.ts'") updateqm.input = TRANSLATIONS updateqm.output = data/translations/translations/${QMAKE_FILE_BASE}.qm updateqm.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm data/translations/translations/${QMAKE_FILE_BASE}.qm
↓ $$[QT_INSTALL_BINS]/lrelease
を /usr/lib64/qt5/bin/lrelease
に修正:
#TRANSLATIONS exists(/usr/lib64/qt5/bin/lrelease) { TRANSLATIONS = $$system("find data/translations/ -name 'featherpad_*.ts'") updateqm.input = TRANSLATIONS updateqm.output = data/translations/translations/${QMAKE_FILE_BASE}.qm updateqm.commands = /usr/lib64/qt5/bin/lrelease ${QMAKE_FILE_IN} -qm data/translations/translations/${QMAKE_FILE_BASE}.qm
→ゴミが残らないように注意。
-
7-3. ビルド ←(実行にてエラー)
$ cd ~/Git/FeatherPad/ [~/Git/FeatherPad]$ /usr/lib64/qt5/bin/qmake && make : /usr/bin/ld: -lhunspell が見つかりません collect2: エラー: ld はステータス 1 で終了しました
→hunspell に関連するライブラリが足りないようです。
(ちなみに、切り分けのために qmake と make を分けようとしたら、実行できませんでした。)
-
確認:
$ dnf list hunspell* : インストール済みパッケージ hunspell.x86_64 1.6.2-1.el8 @AppStream hunspell-devel.x86_64 1.6.2-1.el8 @AppStream hunspell-en-US.noarch 0.20140811.1-12.el8 @AppStream 利用可能なパッケージ hunspell-af.noarch 0.20080825-16.el8 AppStream : hunspell-zu.noarch 0.20100126-16.el8 AppStream
→hunspell パッケージはインストールされていました。 「/usr/lib64/libhunspell-1.6.so」もあります。スペルチェックの機能なので日本には関係なく、利用可能なパッケージに hunspell-ja はありません。en-US が入っているのでこれで良さそう。
-
試しに、問題のhunspell を実行してみます:
スペルチェックの辞書管理ツールのようです。
$ hunspell --version @(#) International Ispell Version 3.2.06 (but really Hunspell 1.6.2) $ hunspell -D : AVAILABLE DICTIONARIES (path is not mandatory for -d option): /usr/share/myspell/en_US Can't open affix or dictionary files for dictionary named "ja_JP".
→en_US はあって、ja_JP はない、と言っています。
スペル辞書ファイル:
$ ls -1 /usr/share/myspell/ en_US.aff en_US.dic
-
バージョンの問題かもしれないので、cmake の出力メッセージを確認すると「適切なバージョン「1.6.2」が見つかりました。 最低限必要なのは「1.6」です」と表示されているので、バージョンは良さそうです。
→「INSTALL」のインストール説明には、「Fedora のようなRed Hat ベースの場合」と書かれていました。
Fedora で確認されていてもCentOS で動作確認されているかは微妙です。 もしかしたら、Fedora ならビルドがうまく行くかもしれません。
-
→CentOS だと「5. cmakeを使ってビルドする場合」の手順でビルドするのが良いみたい。
-
7-4. インストール: ←(未実施)
[~/Git/FeatherPad]$ sudo make install
→7-3. ビルドが失敗したので、こちらのインストールは未実施。
-
8. 翻訳(ローカリゼーション)についての注意書き
ファイル「featherpad/data/translations/featherpad.ts」は、翻訳するときの原本です。
翻訳した「featherpad_ja_JP.ts」ファイルは、「featherpad_LN.ts」と同じディレクトリに保存します。
FeatherPad を自分の国の言語に翻訳されたなら、 https://github.com/tsujan/FeatherPad で「プルリクエスト」(PR) してください。
-
9. ヘルプを表示してみます:
- オプションで、ヘルプファイル「/usr/share/featherpad/data/help」の代わりにロケール名を付けた「/usr/share/featherpad/data/help_ja」を置けます。これにより、英語のヘルプの代わりに表示されます。
ヘルプはタブとして開かれます:
→「help_ja」ファイルが、色違いの「タブ」として開きます。
- 単なるテキストファイルですが、書き込み保護されていて、Ctrl+H で起動できます。これが利点。
編集することで、貼り付けてよく使う文字列を書いておいたり、備忘録、手順書、よく使うコマンドなど、個人的な別の目的に利用できます。ヘルプの内容は残しておいて、先頭部分に追記します。
ヘルプファイルの編集:
$ sudo nano /usr/share/featherpad/help_ja
→なぜかgedit だとsudo を付けると拒否されます。
nano の操作:
Ctrl+ O: 書き込み Ctrl+ X: 終了
-
参考: Manjaro GNOME でビルドする場合:
- featherpad を最新にビルドするにはAUR にある
*-git
を選びます:
→Arch Linux とかManjaro の場合、(ビルドが含まれていても)インストールはコマンド一発です。
注意点は、そのパッケージ名についたバージョン番号は気にしないことです。 それはインストールスクリプトに書かれた仮のバージョンです。 GitHub から最新がダウンロードされインストールされるので、アプリ自体は最新になります。
$ yay -S featherpad-git
AUR のアプリ名が git 付きの場合、ほとんどのものが自動で依存パッケージを解決してくれます。依存をインストールし、ソースのダウンロード後にビルドして、パッケージマネージャで管理できるようにわざわざ一度パッケージ化、そのパッケージでインストールしてくれます。
パッケージとしてインストールされるので、通常のアプリのインストールと同じです。 アプリの更新があれば通知され、更新ができます。よく考えられたしくみです。
-
- 通常行うビルド(下記の作業)では、こうは行きません。 更新したいときは同じ作業を再び行う必要があります。また、アプリのバージョンが上がれば、依存関係も変化します。
スムーズにビルドできるかは、開発者の方が、各ディストリビューションごとにちゃんと動作確認し、より詳しくインストール説明を書いてくれているかです。featherpad の説明は親切に書かれています。(感謝)
-
ビルドではその前段階の準備が重要です。まずは必要な「依存パッケージ」を調べます。 ディストリビューションごとにパッケージ名は異なりますし、機能の含まれ方も違います。 ディストリビューションによっては手順が書かれていない場合もあります。
ビルドしてみてわかる漏れもあるわけで、ビルドでエラーするごとにやり直します。ビルドを断念する場合もあります。
→コマンド一発でこの投稿の作業を自動で行ってくれます。
AUR の場合は、アプリの登録のとき登録者の手でその手順がインストールスクリプトとして書かれています。 だからビルドの成功率が高いわけですし、利用者も依存を気にする必要がありません。楽ができます。
セキュリティ上のリスクはあるけど、不安なら、スクリプトを確認してからインストールできます。
-
まとめ
Fedora 32 と違い、CentOS 8.2 のGNOME (Wayland) では、「Qt アプリ」のFetherPad で日本語入力できました。
他の「Qt アプリ」も日本語入力できる可能性があります。 CentOS では、リポジトリに「Qt アプリ」が少ないので、欲しいアプリがあれば flatpak にもないのなら、ビルドにトライしてもいいかも…。
-
-
目次
- 使用環境:
- featherpad をソースからビルド
- 1. 作業用に、~/Git/ フォルダ作成(任意)
- 2. git があるか確認:
- 3. ビルドの依存関係をインストール:
- 4. ソースをダウンロード:
- ここからは、ビルドに使うツールで、手順が別れます
- 5. cmake を使ってビルドする場合: ←(成功)
- 6. メニューのfeatherpad の「未定義アイコン」を解消
- 7. qmake を使ってビルドする場合: ←(参考です)
- 8. 翻訳(ローカリゼーション)についての注意書き
- 9. ヘルプを表示してみます:
- 参考: Manjaro GNOME でビルドする場合:
- まとめ
-
-