やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

Raspbianにターミナルkittyをインストールしようとしたができなかったログ

 数時間かけたがダメだった。4万字超。

情報源

 2019-03-24。kittyはTUIファイラrangerで画像表示できるターミナルのひとつ。

手順

  1. インストール

1. インストール

1-A. インストーラ(失敗)

curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  8249  100  8249    0     0  16329      0 --:--:-- --:--:-- --:--:-- 16664
Using python executable: /usr/bin/python3
You are running on an ARM system. The kitty binaries are only available for x86 systems. You will have to build from source.

 インストール失敗。上記の最終行をみると対象はx86環境のみらしい。Raspbianはarm32(arm7l)だから対象外。ソースコードからビルドしろと言われている。

 このインストーラは所定バイナリをインストールするものらしい。そして所定バイナリはx86, amd64しかない。

 RasperryPi3B+のCPUはarmv7l

$ uname -a
Linux raspberrypi 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux

1-B. ソースコード+ビルド

 ソースコードのダウンロードと圧縮の展開。

wget https://github.com/kovidgoyal/kitty/archive/v0.13.3.tar.gz
tar xf v0.13.3.tar.gz
cd kitty-0.13.3

 ソースコードのビルド。

 ビルドに必要なツールの確認。

  • python >= 3.5
  • harfbuzz >= 1.5.0
  • zlib
  • libpng
  • freetype (not needed on macOS)
  • fontconfig (not needed on macOS)
  • ImageMagick (optional, needed to use the kitty icat tool to display images in the terminal)
  • pygments (optional, need for syntax highlighting in kitty +kitten diff)

 harfbuzzが不足していた。インストールは後述。済んだとして以下に続く。

 さらにビルドには以下が必要。

sudo apt install -y libdbus-1-dev libxcursor-dev libxrandr-dev libxi-dev libxinerama-dev libgl1-mesa-dev libxkbcommon-x11-dev libfontconfig-dev libpython-dev

 kittyにconfigureはない。

$ ./configure --help
bash: ./configure: そのようなファイルやディレクトリはありません

 よってビルドする。

sudo make
wayland-protocols
wayland-protocols >= 1.17 is required, found version: not found
Disabling building of wayland backend

 waylandが無効。そもそもwaylandって何?

Waylandは、コンポジット型ウィンドウマネージャが、アプリケーションやグラフィクスハードウェアと直接通信できるようにするための方法を提供する。Waylandはグラフィクス周りのみに特化しており、入力ハードウェアとの通信には他のライブラリを使用することを想定している。

wayland-protocols

$ apt search wayland-protocols | grep 'wayland-protocols'
wayland-protocols/stable,stable,stable,stable,stable 1.7-1 all
  wayland compositor protocols
  reference implementation of a wayland compositor

 一部インストール済みのものもあった。

$ apt search wayland | grep 'wayland'
...
libva-wayland1/stable,stable,stable,stable,stable,now 1.7.3-2 armhf [インストール済み、自動]
libwayland-bin/stable,stable,stable,stable,stable 1.12.0-1+deb9u1 armhf
  wayland compositor infrastructure - binary utilities
libwayland-client0/stable,stable,stable,stable,stable,now 1.12.0-1+deb9u1 armhf [インストール済み、自動]
  wayland compositor infrastructure - client library
libwayland-cursor0/stable,stable,stable,stable,stable,now 1.12.0-1+deb9u1 armhf [インストール済み、自動]
  wayland compositor infrastructure - cursor library
libwayland-dev/stable,stable,stable,stable,stable 1.12.0-1+deb9u1 armhf
  wayland compositor infrastructure - development files
libwayland-doc/stable,stable,stable,stable,stable 1.12.0-1+deb9u1 all
  wayland compositor infrastructure - documentation files
libwayland-egl1-mesa/stable,stable,now 13.0.6-1+rpi2 armhf [インストール済み、自動]
libwayland-egl1-mesa-dbgsym/stable,stable 13.0.6-1+rpi2 armhf
  Debug symbols for libwayland-egl1-mesa
libwayland-server0/stable,stable,stable,stable,stable,now 1.12.0-1+deb9u1 armhf [インストール済み、自動]
  wayland compositor infrastructure - server library

 libwayland-devは要るのだろうか? 一応インストールしておく。

sudo apt install -y wayland-protocols libwayland-dev
$ apt search wayland-protocols
wayland-protocols/stable,stable,stable,stable,stable,now 1.7-1 all [インストール済み]
  wayland compositor protocols
$ apt search libwayland-dev
libwayland-dev/stable,stable,stable,stable,stable,now 1.12.0-1+deb9u1 armhf [インストール済み]
  wayland compositor infrastructure - development files

 再びビルド。

wayland-protocols >= 1.17 is required, found version: 1.7
Disabling building of wayland backend

 あれ? not foundfoundになったのはいい。でもDisablingのまま……。./configureもないのでビルドオプションの設定もないはず。もうわからん。インストールする。

sudo make install

 sudoがないと権限がなくて怒られる。

PermissionError: [Errno 13] Permission denied: 'compile_commands.json'

 kittyコマンド確認。インストールされていない……。

$ kitty
bash: kitty: コマンドが見つかりません

 pythonでインストールしてみる。(公式サイト参照

sudo python3 setup.py linux-package
...
Linking kittens/diff/diff_speedup ...
make docs
make FAIL_WARN= -C docs man
make[1]: ディレクトリ '/tmp/work/kitty-0.13.3/docs' に入ります
python3 .. +launch :sphinx-build -M man "." "_build" -T  
sphinx-build not found in PATH
Makefile:20: ターゲット 'man' のレシピで失敗しました
make[1]: *** [man] エラー 1
make[1]: ディレクトリ '/tmp/work/kitty-0.13.3/docs' から出ます
Makefile:37: ターゲット 'man' のレシピで失敗しました
make: *** [man] エラー 2

 sphinx-buildがなくてman用ドキュメントが作れない。

sphinx-build not found in PATH
$ apt search sphinx-build
(見つからない)

 上記公式サイトの右に書いてあったのが以下。

pip3 install -U Sphinx

 改めてkittyをインストールしてみる。

sudo python3 setup.py linux-package
$ sudo python3 setup.py linux-package
CC: gcc (6, 3)
wayland-protocols >= 1.17 is required, found version: 1.7
Disabling building of wayland backend
make docs
make FAIL_WARN= -C docs man
make[1]: ディレクトリ '/tmp/work/kitty-0.13.3/docs' に入ります
python3 .. +launch :sphinx-build -M man "." "_build" -T  
sphinx-build not found in PATH
Makefile:20: ターゲット 'man' のレシピで失敗しました
make[1]: *** [man] エラー 1
make[1]: ディレクトリ '/tmp/work/kitty-0.13.3/docs' から出ます
Makefile:37: ターゲット 'man' のレシピで失敗しました
make: *** [man] エラー 2

 え、さっきと同じエラーなんですけど……。

$ apt search  python-sphinx | grep 'python-sphinx'
python-sphinx/stable,stable,stable,stable,stable 1.4.9-2 all
sudo apt install -y python-sphinx

 出た! 公式サイトに騙された。やれやれ。

$ sphinx-build --version
Sphinx (sphinx-build) 1.4.9

 kittyビルド。

sudo python3 setup.py linux-package
...
  File "/usr/bin/sphinx-build", line 14, in <module>
    from sphinx import main
ImportError: No module named 'sphinx'
Makefile:20: ターゲット 'man' のレシピで失敗しました
make[1]: *** [man] エラー 1
make[1]: ディレクトリ '/tmp/work/kitty-0.13.3/docs' から出ます
Makefile:37: ターゲット 'man' のレシピで失敗しました
make: *** [man] エラー 2

 ImportError: No module named 'sphinx'という文字をよく見てみると先頭が小文字。まさか……。

pip3 install sphinx

 Sphinx, sphinx。こいつら別物だってよ。これはひどい

 kittyビルド。

sudo python3 setup.py linux-package

 同上のエラー……。ImportError: No module named 'sphinx'

 以下でインタプリタでimportできることを確認。

$ python3 
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
>>> from sphinx import main
>>> 

 ということは、pip3(python3)でなくpip(python2)を使ってるのか? kittyのpythonは3.5以上って書いてあったはずだが。仕方なくpipにもsphinxを入れてみる。

pip install sphinx

 インタプリタでimportできることを確認。

$ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sphinx import main
>>> 

 kittyビルド。

sudo python3 setup.py linux-package

 同様のエラー……。これ以上はわからん。

 インストールが必要と思われるものは以下。何がダメなの?

sudo apt install -y automake
sudo apt install -y autoconf
sudo apt install -y libdbus-1-dev libxcursor-dev libxrandr-dev libxi-dev libxinerama-dev libgl1-mesa-dev libxkbcommon-x11-dev libfontconfig-dev libpython-dev
sudo apt install -y wayland-protocols libwayland-dev
sudo apt install -y python-sphinx
pip3 install sphinx

 エラーの全文。

$ sudo python3 setup.py linux-package
CC: gcc (6, 3)
wayland-protocols >= 1.17 is required, found version: 1.7
Disabling building of wayland backend
make docs
make FAIL_WARN= -C docs man
make[1]: ディレクトリ '/tmp/work/kitty-0.13.3/docs' に入ります
python3 .. +launch :sphinx-build -M man "." "_build" -T  
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "../__main__.py", line 117, in <module>
    main()
  File "../__main__.py", line 108, in main
    namespaced(['+', first_arg[1:]] + sys.argv[2:])
  File "../__main__.py", line 68, in namespaced
    func(args[1:])
  File "../__main__.py", line 51, in launch
    runpy.run_path(exe, run_name='__main__')
  File "/usr/lib/python3.5/runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/usr/lib/python3.5/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/bin/sphinx-build", line 14, in <module>
    from sphinx import main
ImportError: No module named 'sphinx'
Makefile:20: ターゲット 'man' のレシピで失敗しました
make[1]: *** [man] エラー 1
make[1]: ディレクトリ '/tmp/work/kitty-0.13.3/docs' から出ます
Makefile:37: ターゲット 'man' のレシピで失敗しました
make: *** [man] エラー 2

/usr/bin/sphinx-build

#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
    Sphinx - Python documentation toolchain
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

import sys

if __name__ == '__main__':
    from sphinx import main
    sys.exit(main(sys.argv))

 インタプリタで使ったpythonは上記ファイルのシェバンと同じ。ならインポートできるはずでは?

$ which python
/usr/bin/python
 $ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> 
>>> if __name__ == '__main__':
...     from sphinx import main
...     sys.exit(main(sys.argv))
... 
__main__:3: RemovedInSphinx20Warning: `sphinx.main()` has moved to `sphinx.cmd.build.main()`.
usage:  [OPTIONS] SOURCEDIR OUTPUTDIR [FILENAMES...]
: error: too few arguments
$ /usr/bin/sphinx-build
/usr/bin/sphinx-build:15: RemovedInSphinx20Warning: `sphinx.main()` has moved to `sphinx.cmd.build.main()`.
  sys.exit(main(sys.argv))
usage: sphinx-build [OPTIONS] SOURCEDIR OUTPUTDIR [FILENAMES...]
sphinx-build: error: too few arguments

 起動引数なしでやると同じエラー。インタプリタで起動すると正常にfrom sphinx import mainできているっぽい。

 もう一度Sphinxの公式コマンドを打つ。今度はpip3でなくpipで。

pip install -U Sphinx

 kittyビルド。

sudo python3 setup.py linux-package

 やはり同様のエラー。もう対処を思いつかない。残念だがkittyのインストールは諦めよう……。

kitty依存ツール

インストール済みの依存ツール

$ python3 -V
Python 3.5.3

 python >= 3.5であるのでOK。

 以下もインストール済みだった。バージョン指定はなかったのでOKなはず。

$ apt search zlib | grep 'libpng'
zlib1g/stable,stable,stable,stable,stable,now 1:1.2.8.dfsg-5 armhf [インストール済み]
zlib1g-dbg/stable,stable,stable,stable,stable 1:1.2.8.dfsg-5 armhf
zlib1g-dev/stable,stable,stable,stable,stable,now 1:1.2.8.dfsg-5 armhf [インストール済み、自動]
zlibc/stable,stable,stable,stable,stable 0.9k-4.3 armhf
  zlib (gzip, deflate) compatible compressor
$ apt search libpng | grep 'libpng'
libpng-dev/stable,stable,stable,stable,stable,now 1.6.28-1 armhf [インストール済み、自動]
libpng-sixlegs-java/stable,stable,stable,stable,stable 2.0-1 all
libpng-sixlegs-java-doc/stable,stable,stable,stable,stable 2.0-1 all
libpng-tools/stable,stable,stable,stable,stable,now 1.6.28-1 armhf [インストール済み、自動]
libpng12-0/stable,stable,stable,stable,stable,now 1.2.54-6 armhf [インストール済み、自動]
libpng12-dev/stable,stable,stable,stable,stable 1.2.54-6 armhf
libpng16-16/stable,stable,stable,stable,stable,now 1.6.28-1 armhf [インストール済み]
$ apt search freetype | grep 'freetype'
freetype2-demos/stable,stable,stable,stable,stable 2.6.3-3.2 armhf
libfont-freetype-perl/stable,stable,stable,stable,stable 0.07-1+b2 armhf
libfreetype6/stable,stable,stable,stable,stable,now 2.6.3-3.2 armhf [インストール済み、自動]
libfreetype6-dev/stable,stable,stable,stable,stable,now 2.6.3-3.2 armhf [インストール済み]
libisfreetype-java/stable,stable,stable,stable,stable 5.3.20100629-3 all
libisfreetype-java-doc/stable,stable,stable,stable,stable 5.3.20100629-3 all
$ apt search fontconfig
...
fontconfig/stable,stable,stable,stable,stable,now 2.11.0-6.7 armhf [インストール済み、自動]
  generic font configuration library - support binaries

fontconfig-config/stable,stable,stable,stable,stable,now 2.11.0-6.7 all [インストール済み、自動]
  generic font configuration library - configuration
...
$ apt search imagemagick | grep 'imagemagick'
graphicsmagick-imagemagick-compat/stable,stable,stable,stable,stable 1.3.30+hg15796-1~deb9u2 all
imagemagick/stable,stable,stable,stable,stable,now 8:6.9.7.4+dfsg-11+deb9u6 armhf [インストール済み]
imagemagick-6-common/stable,stable,stable,stable,stable,now 8:6.9.7.4+dfsg-11+deb9u6 all [インストール済み、自動]
imagemagick-6-doc/stable,stable,stable,stable,stable 8:6.9.7.4+dfsg-11+deb9u6 all
imagemagick-6.q16/stable,stable,stable,stable,stable,now 8:6.9.7.4+dfsg-11+deb9u6 armhf [インストール済み、自動]
imagemagick-6.q16hdri/stable,stable,stable,stable,stable 8:6.9.7.4+dfsg-11+deb9u6 armhf
imagemagick-common/stable,stable,stable,stable,stable 8:6.9.7.4+dfsg-11+deb9u6 all
imagemagick-doc/stable,stable,stable,stable,stable 8:6.9.7.4+dfsg-11+deb9u6 all

 pygmentsはaptにはないが、pip(pip3)にはある。

$ apt search pygments | grep 'pygments'
python-pygments/stable,stable,stable,stable,stable 2.2.0+dfsg-1 all
python-pygments-doc/stable,stable,stable,stable,stable 2.2.0+dfsg-1 all
python3-pygments/stable,stable,stable,stable,stable 2.2.0+dfsg-1 all
ruby-pygments.rb/stable,stable,stable,stable,stable 0.6.3-2+deb9u1 all
  pygments wrapper for Ruby
  pure-Ruby syntax highlighter compatible with pygments
  pure-ruby syntax highlighter replacement for pygments
$ pip list | grep '[p|P]ygments'

$ pip3 list | grep '[p|P]ygments'
Pygments (2.3.1)

 私の環境ではpipには無くpip3には有った。今回はpython3.5以上が対象のため、これでOK。

未インストールの依存ツール

harfbuzz

 harfbuzzOpenTypeレイアウト・エンジン。aptで検索してみる。

$ apt search harfbuzz
gir1.2-harfbuzz-0.0/stable,stable,stable,stable,stable 1.4.2-1 armhf
  OpenType text shaping engine (GObject introspection data)

libharfbuzz-bin/stable,stable,stable,stable,stable 1.4.2-1 armhf
  OpenType text shaping engine (utility)

libharfbuzz-dev/stable,stable,stable,stable,stable 1.4.2-1 armhf
  Development files for OpenType text shaping engine

libharfbuzz-doc/stable,stable,stable,stable,stable 1.4.2-1 all
  Documentation files for the HarfBuzz library

libharfbuzz-gobject0/stable,stable,stable,stable,stable 1.4.2-1 armhf
  OpenType text shaping engine ICU backend (GObject library)

libharfbuzz-icu0/stable,stable,stable,stable,stable,now 1.4.2-1 armhf [インストール済み、自動]
  OpenType text shaping engine ICU backend

libharfbuzz0b/stable,stable,stable,stable,stable,now 1.4.2-1 armhf [インストール済み、自動]
  OpenType text shaping engine (shared library)

 気になるのはバージョン。kittyの要求はharfbuzz >= 1.5.0とあるので、1.4.2-1では古いと思われる。以下を見ると最新は2.3.1だった。

 例によってaptでは古いものしか入手できない。よって最新ソースコードからビルドする。

ビルド harfbuzz

 ビルド手順。

 ビルドに必要なツールを入れる。

sudo apt install -y gcc g++ libfreetype6-dev libglib2.0-dev libcairo2-dev
sudo apt install -y autoconf automake libtool pkg-config ragel gtk-doc-tools

 ソースコードをダウンロードする。

cd /tmp/work
git clone https://github.com/harfbuzz/harfbuzz
cd harfbuzz

 configure.acからconfigureスクリプトを作成する。

$ autoconf
configure.ac:12: error: possibly undefined macro: AM_INIT_AUTOMAKE
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:13: error: possibly undefined macro: AM_SILENT_RULES
configure.ac:24: error: possibly undefined macro: AM_PROG_CC_C_O
configure.ac:29: error: possibly undefined macro: AM_MISSING_PROG
configure.ac:66: error: possibly undefined macro: AM_CONDITIONAL

 なんか怒られたけど無事に作成されている。

$ ./configure --help
`configure' configures HarfBuzz 2.3.1 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/harfbuzz]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]
  --psdir=DIR             ps documentation [DOCDIR]

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --disable-largefile     omit support for large files

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-libstdc++=[yes/no]
                          Allow linking with libstdc++ [default=no]
  --with-glib=[yes/no/auto]
                          Use glib [default=auto]
  --with-gobject=[yes/no/auto]
                          Use gobject [default=no]
  --with-cairo=[yes/no/auto]
                          Use cairo [default=auto]
  --with-fontconfig=[yes/no/auto]
                          Use fontconfig [default=auto]
  --with-icu=[yes/no/builtin/auto]
                          Use ICU [default=auto]
  --with-ucdn=[yes/no]    Use builtin UCDN library [default=yes]
  --with-graphite2=[yes/no/auto]
                          Use the graphite2 library [default=no]
  --with-freetype=[yes/no/auto]
                          Use the FreeType library [default=auto]
  --with-uniscribe=[yes/no/auto]
                          Use the Uniscribe library [default=no]
  --with-directwrite=[yes/no/auto]
                          Use the DirectWrite library (experimental)
                          [default=no]
  --with-coretext=[yes/no/auto]
                          Use CoreText [default=no]

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags
  CPP         C preprocessor
  CXXCPP      C++ preprocessor

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to <https://github.com/harfbuzz/harfbuzz/issues/new>.
HarfBuzz home page: <http://harfbuzz.org/>.

 オプションは以下。参考

sudo ./configure --with-gobject --with-graphite2
sudo make
sudo make install
$ sudo ./configure
./configure: line 2643: syntax error near unexpected token `1.13.0'
./configure: line 2643: `AM_INIT_AUTOMAKE(1.13.0 gnits tar-ustar dist-bzip2 no-dist-gzip -Wall no-define color-tests -Wno-portability)'

 シンタックスエラー。configureファイルの構文など知らん。どうしよう。

 automakeが古い? いや1.13より新しい。

$ automake --version
automake (GNU automake) 1.15
$ autoconf --version
autoconf (GNU Autoconf) 2.69

 autotoolsの使い方を調べる。

sudo apt install -y automake
sudo apt install -y autoconf
cd /tmp/work
git clone https://github.com/harfbuzz/harfbuzz
cd harfbuzz
./autogen.sh
autoconf
automake
./configure --help
sudo ./configure 任意オプション
sudo make
sudo make install
$ sudo ./configure --with-gobject --with-graphite2
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking for a sed that does not truncate output... /bin/sed
checking whether to build with code coverage support... no
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking build system type... armv7l-unknown-linux-gnueabihf
checking host system type... armv7l-unknown-linux-gnueabihf
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert armv7l-unknown-linux-gnueabihf file names to armv7l-unknown-linux-gnueabihf format... func_convert_file_noop
checking how to convert armv7l-unknown-linux-gnueabihf file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for gcc option to accept ISO C99... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.20... yes
checking for gtk-doc... yes
checking for gtkdoc-check... gtkdoc-check.test
checking for gtkdoc-check... /usr/bin/gtkdoc-check
checking for gtkdoc-rebase... /usr/bin/gtkdoc-rebase
checking for gtkdoc-mkpdf... /usr/bin/gtkdoc-mkpdf
checking whether to build gtk-doc documentation... no
checking for GTKDOC_DEPS... yes
checking for atexit... yes
checking for mprotect... yes
checking for sysconf... yes
checking for getpagesize... yes
checking for mmap... yes
checking for isatty... yes
checking for newlocale... yes
checking for strtod_l... yes
checking for posix_memalign... yes
checking for round... yes
checking for unistd.h... (cached) yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking xlocale.h usability... yes
checking xlocale.h presence... yes
checking for xlocale.h... yes
checking stdbool.h usability... yes
checking stdbool.h presence... yes
checking for stdbool.h... yes
checking alignment of struct{char;}... 1
checking whether the linker accepts -Bsymbolic-functions... yes
checking for native Win32... no
checking whether gcc is Clang... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking for GLIB... yes
checking for GOBJECT... yes
checking for CAIRO... yes
checking for CAIRO_FT... yes
checking for FONTCONFIG... yes
checking for ICU... no
checking for icu-config... no
checking for ICU by using icu-config fallback... no
checking for GRAPHITE2... no
checking graphite2/Segment.h usability... no
checking graphite2/Segment.h presence... no
checking for graphite2/Segment.h... no
configure: error: graphite2 support requested but libgraphite2 not found

 graphite2がないためエラー。aptで検索してみる。

$ apt search graphitegraphite2
libgraphite2-3/stable,stable,stable,stable,stable,now 1.3.10-1 armhf [インストール済み、自動]
  Font rendering engine for Complex Scripts -- library

libgraphite2-dev/stable,stable,stable,stable,stable 1.3.10-1 armhf
  Development files for libgraphite2

libgraphite2-doc/stable,stable,stable,stable,stable 1.3.10-1 all
  Documentation for libgraphite2

 ビルド工程ではlibgraphite2-devが必要と思われる。

sudo apt install -y libgraphite2-dev

 icu文字コード変換ライブラリ。これもあったほうが良さそう。

$ apt search icu | grep 'icu'
...
libharfbuzz-icu0/stable,stable,stable,stable,stable,now 1.4.2-1 armhf [インストール済み、自動]
...
libicu57/stable,stable,stable,stable,stable,now 57.1-6+deb9u2 armhf [インストール済み、自動]
...

 ビルド時なら開発版がないのだろう。

$ apt search icu | grep 'icu-dev'
...
libicu-dev/stable,stable,stable,stable,stable 57.1-6+deb9u2 armhf

 graphite2icuの開発版をインストールする。

sudo apt install -y libgraphite2-dev
sudo apt install -y libicu-dev
オプション機能 必須ツール
文字コード変換 libicu-dev
スマートフォント描画 libgraphite2-dev

 再びsudo ./configコマンドを実行する。

$ sudo ./configure --with-gobject --with-graphite2
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking for a sed that does not truncate output... /bin/sed
checking whether to build with code coverage support... no
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking build system type... armv7l-unknown-linux-gnueabihf
checking host system type... armv7l-unknown-linux-gnueabihf
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert armv7l-unknown-linux-gnueabihf file names to armv7l-unknown-linux-gnueabihf format... func_convert_file_noop
checking how to convert armv7l-unknown-linux-gnueabihf file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for gcc option to accept ISO C99... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.20... yes
checking for gtk-doc... yes
checking for gtkdoc-check... gtkdoc-check.test
checking for gtkdoc-check... /usr/bin/gtkdoc-check
checking for gtkdoc-rebase... /usr/bin/gtkdoc-rebase
checking for gtkdoc-mkpdf... /usr/bin/gtkdoc-mkpdf
checking whether to build gtk-doc documentation... no
checking for GTKDOC_DEPS... yes
checking for atexit... yes
checking for mprotect... yes
checking for sysconf... yes
checking for getpagesize... yes
checking for mmap... yes
checking for isatty... yes
checking for newlocale... yes
checking for strtod_l... yes
checking for posix_memalign... yes
checking for round... yes
checking for unistd.h... (cached) yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking xlocale.h usability... yes
checking xlocale.h presence... yes
checking for xlocale.h... yes
checking stdbool.h usability... yes
checking stdbool.h presence... yes
checking for stdbool.h... yes
checking alignment of struct{char;}... 1
checking whether the linker accepts -Bsymbolic-functions... yes
checking for native Win32... no
checking whether gcc is Clang... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking for GLIB... yes
checking for GOBJECT... yes
checking for CAIRO... yes
checking for CAIRO_FT... yes
checking for FONTCONFIG... yes
checking for ICU... yes
checking for GRAPHITE2... yes
checking for FREETYPE... yes
checking for FT_Get_Var_Blend_Coordinates... no
checking for FT_Set_Var_Blend_Coordinates... yes
checking for FT_Done_MM_Var... no
checking for Intel atomic primitives... true
checking for Solaris atomic operations... false
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/harfbuzz-config.cmake
config.status: creating src/hb-ucdn/Makefile
config.status: creating util/Makefile
config.status: creating test/Makefile
config.status: creating test/api/Makefile
config.status: creating test/fuzzing/Makefile
config.status: creating test/shaping/Makefile
config.status: creating test/shaping/data/Makefile
config.status: creating test/shaping/data/aots/Makefile
config.status: creating test/shaping/data/in-house/Makefile
config.status: creating test/shaping/data/text-rendering-tests/Makefile
config.status: creating test/subset/Makefile
config.status: creating test/subset/data/Makefile
config.status: creating docs/Makefile
config.status: creating docs/version.xml
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

C++ compiler version:
g++ (Raspbian 6.3.0-18+rpi1+deb9u1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


configure:

Build configuration:

Unicode callbacks (you want at least one):
    Builtin (UCDN):     true
    Glib:           true
    ICU:            true

Font callbacks (the more the merrier):
    FreeType:       true

Tools used for command-line utilities:
    Cairo:          true
    Fontconfig:     true

Additional shapers (the more the merrier):
    Graphite2:      true

Platform shapers (not normally needed):
    CoreText:       false
    DirectWrite:        false
    Uniscribe:      false

Other features:
    Documentation:      no
    GObject bindings:   true
    Introspection:      false

 成功したっぽい。次にビルドする。時間かかる。

$ sudo make
$ sudo make install

 エラーなし。成功したっぽい。確認してみる。

$ cd /usr/bin/lib
$ ls -l | grep 'harfbuzz'
-rwxr-xr-x 1 root staff     1121  324 11:40 libharfbuzz-gobject.la
lrwxrwxrwx 1 root staff       32  324 11:40 libharfbuzz-gobject.so -> libharfbuzz-gobject.so.0.20301.0
lrwxrwxrwx 1 root staff       32  324 11:40 libharfbuzz-gobject.so.0 -> libharfbuzz-gobject.so.0.20301.0
-rwxr-xr-x 1 root staff   149620  324 11:40 libharfbuzz-gobject.so.0.20301.0
-rwxr-xr-x 1 root staff     1097  324 11:40 libharfbuzz-icu.la
lrwxrwxrwx 1 root staff       28  324 11:40 libharfbuzz-icu.so -> libharfbuzz-icu.so.0.20301.0
lrwxrwxrwx 1 root staff       28  324 11:40 libharfbuzz-icu.so.0 -> libharfbuzz-icu.so.0.20301.0
-rwxr-xr-x 1 root staff    65772  324 11:40 libharfbuzz-icu.so.0.20301.0
-rwxr-xr-x 1 root staff     1097  324 11:40 libharfbuzz-subset.la
lrwxrwxrwx 1 root staff       31  324 11:40 libharfbuzz-subset.so -> libharfbuzz-subset.so.0.20301.0
lrwxrwxrwx 1 root staff       31  324 11:40 libharfbuzz-subset.so.0 -> libharfbuzz-subset.so.0.20301.0
-rwxr-xr-x 1 root staff  5442352  324 11:40 libharfbuzz-subset.so.0.20301.0
-rwxr-xr-x 1 root staff     1029  324 11:40 libharfbuzz.la
lrwxrwxrwx 1 root staff       24  324 11:40 libharfbuzz.so -> libharfbuzz.so.0.20301.0
lrwxrwxrwx 1 root staff       24  324 11:40 libharfbuzz.so.0 -> libharfbuzz.so.0.20301.0
-rwxr-xr-x 1 root staff 13513272  324 11:40 libharfbuzz.so.0.20301.0

 日時からみてビルドした時点なので成功したっぽい。

所感

 成果なし。疲れた。