2回目。やはり駄目だった。
前回
やり直し
sphinxを削除する
sudo apt --purge remove python-sphinx pip uninstall -y sphinx pip uninstall -y Sphinx pip3 uninstall -y sphinx pip3 uninstall -y Sphinx
事前にインストールする
sudo apt install gcc pkg-config libdbus-1-dev libxcursor-dev libxrandr-dev libxi-dev libxinerama-dev libgl1-mesa-dev libxkbcommon-x11-dev libfontconfig-dev libpython-dev
インストール状態の確認
$ ls -1 /usr/local/lib | grep 'harfbuzz' libharfbuzz-gobject.la libharfbuzz-gobject.so libharfbuzz-gobject.so.0 libharfbuzz-gobject.so.0.20301.0 libharfbuzz-icu.la libharfbuzz-icu.so libharfbuzz-icu.so.0 libharfbuzz-icu.so.0.20301.0 libharfbuzz-subset.la libharfbuzz-subset.so libharfbuzz-subset.so.0 libharfbuzz-subset.so.0.20301.0 libharfbuzz.la libharfbuzz.so libharfbuzz.so.0 libharfbuzz.so.0.20301.0
$ apt search zlib | grep 'zlib' | grep 'インストール済み' zlib1g/stable,stable,stable,stable,stable,now 1:1.2.8.dfsg-5 armhf [インストール済み] zlib1g-dev/stable,stable,stable,stable,stable,now 1:1.2.8.dfsg-5 armhf [インストール済み、自動]
$ apt search libpng | grep 'libpng' | grep 'インストール済み' libpng-dev/stable,stable,stable,stable,stable,now 1.6.28-1 armhf [インストール済み、自動] 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 [インストール済み、自動] libpng16-16/stable,stable,stable,stable,stable,now 1.6.28-1 armhf [インストール済み]
$ apt search freetype | grep 'freetype' 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 [インストール済み]
$ apt search fontconfig | grep 'fontconfig' | grep 'インストール済み' fontconfig/stable,stable,stable,stable,stable,now 2.11.0-6.7 armhf [インストール済み、自動] fontconfig-config/stable,stable,stable,stable,stable,now 2.11.0-6.7 all [インストール済み、自動] fontconfig-infinality/stable,stable,now 20130104-0ubuntu0ppa1+rpi1 all [インストール済み、自動] libfontconfig1/stable,stable,stable,stable,stable,now 2.11.0-6.7 armhf [インストール済み、自動] libfontconfig1-dev/stable,stable,stable,stable,stable,now 2.11.0-6.7 armhf [インストール済み]
$ apt search imagemagick | grep 'imagemagick' | grep 'インストール済み' 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.q16/stable,stable,stable,stable,stable,now 8:6.9.7.4+dfsg-11+deb9u6 armhf [インストール済み、自動]
$ apt search pygments | grep 'pygments' | grep 'インストール済み' python-pygments/stable,stable,stable,stable,stable,now 2.2.0+dfsg-1 all [インストール済み、自動削除可]
ソースからビルド
2種類の方法から。
A. アーカイブ
kittyのソースコードを入手する
wget https://github.com/kovidgoyal/kitty/archive/v0.13.3.tar.gz
tar xf v0.13.3.tar.gz
cd kitty-0.13.3
ビルドする。
sudo make
途中で終わった? kittyコマンドが生成されず……。
$ sudo make python3 setup.py CC: gcc (6, 3) Compiling kitty/history.c ... Compiling kitty/parser.c ... Compiling kitty/data-types.c ... Compiling kitty/state.c ... Compiling kitty/desktop.c ... Compiling kitty/screen.c ... Compiling kitty/unicode-data.c ... Compiling kitty/keys.c ... Compiling kitty/png-reader.c ... Compiling kitty/parser_dump.c ... Compiling kitty/fontconfig.c ... Compiling kitty/logging.c ... Compiling kitty/graphics.c ... Compiling kitty/line-buf.c ... Compiling kitty/fonts.c ... Compiling kitty/glfw-wrapper.c ... Compiling kitty/cursor.c ... Compiling kitty/line.c ... Compiling kitty/colors.c ... Compiling kitty/kittens.c ... Compiling kitty/mouse.c ... Compiling kitty/charsets.c ... Compiling kitty/child-monitor.c ... Compiling kitty/child.c ... Compiling kitty/freetype.c ... Compiling kitty/glfw.c ... Compiling kitty/shaders.c ... Compiling kitty/gl-wrapper.c ... Linking kitty/fast_data_types ... Compiling glfw/context.c ... Compiling glfw/x11_init.c ... Compiling glfw/osmesa_context.c ... Compiling glfw/glx_context.c ... Compiling glfw/x11_window.c ... Compiling glfw/linux_joystick.c ... Compiling glfw/posix_time.c ... Compiling glfw/input.c ... Compiling glfw/init.c ... Compiling glfw/ibus_glfw.c ... Compiling glfw/vulkan.c ... Compiling glfw/xkb_glfw.c ... Compiling glfw/x11_monitor.c ... Compiling glfw/dbus_glfw.c ... Compiling glfw/backend_utils.c ... Compiling glfw/monitor.c ... Compiling glfw/window.c ... Compiling glfw/egl_context.c ... Compiling glfw/posix_thread.c ... Linking kitty/glfw-x11 ... wayland-protocols >= 1.17 is required, found version: 1.7 Disabling building of wayland backend Compiling kittens/unicode_input/unicode_names.c ... Linking kittens/unicode_input/unicode_names ... Compiling kittens/diff/speedup.c ... Linking kittens/diff/diff_speedup ...
$ kitty bash: kitty: コマンドが見つかりません
これは前回と同じ。
懸念
- sphinx-buildがない?
- harfbuzz2.3.1のパス?
- ビルドした。
/usr/local/lib
に生成された。これをビルド時パスに含めてやる必要がある?
- ビルドした。
B. github最新
$ git clone https://github.com/kovidgoyal/kitty && cd kitty $ make python3 setup.py CC: gcc (6, 3) Compiling kitty/line.c ... Compiling kitty/history.c ... Compiling kitty/kittens.c ... Compiling kitty/screen.c ... Compiling kitty/colors.c ... Compiling kitty/data-types.c ... Compiling kitty/glfw.c ... Compiling kitty/graphics.c ... Compiling kitty/png-reader.c ... Compiling kitty/desktop.c ... Compiling kitty/fontconfig.c ... Compiling kitty/child.c ... Compiling kitty/parser.c ... Compiling kitty/shaders.c ... Compiling kitty/mouse.c ... Compiling kitty/unicode-data.c ... Compiling kitty/gl-wrapper.c ... Compiling kitty/fonts.c ... Compiling kitty/logging.c ... Compiling kitty/state.c ... Compiling kitty/glfw-wrapper.c ... Compiling kitty/parser_dump.c ... Compiling kitty/child-monitor.c ... Compiling kitty/charsets.c ... Compiling kitty/keys.c ... Compiling kitty/freetype.c ... Compiling kitty/line-buf.c ... Compiling kitty/cursor.c ... gcc -MMD -DNDEBUG -DPRIMARY_VERSION=4000 -DSECONDARY_VERSION=13 -Wextra -Wno-missing-field-initializers -Wall -std=c11 -pedantic-errors -Werror -O3 -fwrapv -fstack-protector-strong -pipe -march=native -fvisibility=hidden -fPIC -flto -pthread -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/local/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/python3.5m -I/usr/include/python3.5m -c /tmp/work/kitty/kitty/freetype.c -o /tmp/work/kitty/build/fast_data_types-freetype.c.o /tmp/work/kitty/kitty/freetype.c: In function ‘get_glyph_width’: /tmp/work/kitty/kitty/freetype.c:293:30: error: signed and unsigned type in conditional expression [-Werror=sign-compare] return B.width ? B.width : (M.width / 64); ^ cc1: all warnings being treated as errors Makefile:9: ターゲット 'all' のレシピで失敗しました make: *** [all] エラー 1
おや、違うエラーになった。
Google翻訳は以下。
signed and unsigned type in conditional expression 条件式の符号付きおよび符号なし型, 条件式における符号付きおよび符号なしタイプ all warnings being treated as errors すべての警告がエラーとして扱われる, すべての警告をエラーとして扱われています
ビルドオプション-Werror
のせい?
以下コードはkitty/kitty/freetype.c
ファイルの293行目30列目。
return B.width ? B.width : (M.width / 64);
C言語の三項演算子。つまりif文。条件式。次のif文と同じ意味のはず。
if (B.width) { return B.width; } else { return (M.width / 64); }
エラーを見てみる。B.width変数の型がsigned
かunsigned
かは知らないが、それで警告かエラーが出るってこと? よくわからん。戻り値の型と一致しないとかならありそうだけど。
get_glyph_width(PyObject *s, glyph_index g) { Face *self = (Face*)s; if (!load_glyph(self, g, FT_LOAD_DEFAULT)) { PyErr_Print(); return false; } #define M self->face->glyph->metrics #define B self->face->glyph->bitmap /* printf("glyph: %u bitmap.width: %d bitmap.rows: %d horiAdvance: %ld horiBearingX: %ld horiBearingY: %ld vertBearingX: %ld vertBearingY: %ld vertAdvance: %ld width: %ld height: %ld\n", */ /* g, B.width, B.rows, M.horiAdvance, M.horiBearingX, M.horiBearingY, M.vertBearingX, M.vertBearingY, M.vertAdvance, M.width, M.height); */ return B.width ? B.width : (M.width / 64); #undef M
#define |
値 |
---|---|
M |
self->face->glyph->metrics |
B |
self->face->glyph->bitmap |
self
->Face
のポインタ。Faceは構造体。以下のように定義されていた。メンバにface
はFT_Face
。こいつがglyph
メンバを持っている。
#include FT_FREETYPE_H #include FT_BITMAP_H typedef struct { PyObject_HEAD FT_Face face; unsigned int units_per_EM; int ascender, descender, height, max_advance_width, max_advance_height, underline_position, underline_thickness; int hinting, hintstyle, index; bool is_scalable, has_color; float size_in_pts; FT_F26Dot6 char_width, char_height; FT_UInt xdpi, ydpi; PyObject *path; hb_font_t *harfbuzz_font; void *extra_data; free_extra_data_func free_extra_data; float apple_leading; } Face; PyTypeObject Face_Type;
追えたのはここまで。FT_Face
の定義はこのファイル内にはなかった。たぶん#include FT_FREETYPE_H
の中なのだろうがFT_FREETYPE_H
の定義がない。このファイル内でここより前にinclude
してあるファイル内のうちのどこかに定義があるのだろう。面倒なのでやめる。