
最近1.0.0がリリースされ話題になっているGhosttyというターミナルエミュレータがあります.最近Debian sid amd64環境のAlacrittyの上でNeovim+iBus Mozcで日本語入力時に遅延して?日本語が入力されて使い物にならないのもあり試してみようと思いました.(mltermだと大丈夫)
Debianで次回に動くバイナリは提供されていません.Ubuntuについては第三者がパッケージを提供されています.(apt sourcesは無い)
恐らくUbuntu版はDebianでも動作すると思いますがsourceからBuildしてみました.少し嵌ったのでメモしておきます.
手順は以下に書かれています.
$ sudo apt install libgtk-4-dev libadwaita-1-dev git
$ wget2 -c -v https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz \
https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz.minisig
zig-linux-x86_64-0.1 100% [============================================================================================================================================>] 325 --.-KB/s
zig-linux-x86_64-0.1 100% [============================================================================================================================================>] 44.90M 761.78KB/s
[Files: 2 Bytes: 44.90M [553.07KB/s] Redirects: 0 Todo: 0 Errors: 0
$ minisign -Vm ./zig-linux-x86_64-0.13.0.tar.xz -P 'RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U'
Signature and comment signature verified
Trusted comment: timestamp:1717729444 file:zig-linux-x86_64-0.13.0.tar.xz hashed$ fuse-archive ./zig-linux-x86_64-0.13.0.tar.xz
$ git clone https://github.com/ghostty-org/ghostty $ cd ghostty
Note | fontなんかも同梱されていて結構サイズが大きく |
$ PATH=~/Downloads/zig-linux-x86_64-0.13.0/zig-linux-x86_64-0.13.0/:$PATH \ zig build -Doptimize=ReleaseFast $ ls zig-out/bin/ghostty zig-out/bin/ghostty
Note | build時に以下のメッセージで数時間経っても進まなくなりました.Ctrl+cで中断して再度実行することで進みました.恐らく回線の問題. Compile Build Script └─ [53/46] Fetch Packages ├─ wuffs └─ iterm2_themes |
Segmentation fault$ zig-out/bin/ghostty
info: ghostty version=1.0.2-main+60611b8
info: ghostty build optimize=ReleaseFast
info: runtime=apprt.Runtime.gtk
info: font_backend=font.main.Backend.fontconfig_freetype
info: dependency harfbuzz=8.4.0
info: dependency fontconfig=21402
info: renderer=renderer.OpenGL
info: libxev backend=main.Backend.io_uring
info(os): setlocale from env result=ja_JP.UTF-8
info(gtk): GTK version build=4.16.7 runtime=4.16.7
info(config): creating template config file: path=/home/matoken/.config/ghostty/config
warning(config): error creating template config file err=error.FileNotFound
info(config): default shell source=env value=/bin/bash
warning(sentry): crash report written to disk path=/home/matoken/.local/state/ghostty/crash/68ce5038-f588-4d61-ef88-4217099bbfc4.ghosttycrash
EGL API version 1.5 found
- Vendor: Mesa Project
- Version: 1.5
- Device: /dev/dri/renderD128, 226 128
- Client APIs: OpenGL OpenGL_ES
- Extensions:
EGL_ANDROID_blob_cache
EGL_ANDROID_native_fence_sync
EGL_ANGLE_sync_control_rate
EGL_CHROMIUM_sync_control
EGL_EXT_buffer_age
EGL_EXT_config_select_group
EGL_EXT_create_context_robustness
EGL_EXT_image_dma_buf_import
EGL_EXT_image_dma_buf_import_modifiers
EGL_EXT_pixel_format_float
EGL_EXT_query_reset_notification_strategy
EGL_EXT_surface_compression
EGL_EXT_swap_buffers_with_damage
EGL_IMG_context_priority
EGL_KHR_cl_event2
EGL_KHR_config_attribs
EGL_KHR_context_flush_control
EGL_KHR_create_context
EGL_KHR_create_context_no_error
EGL_KHR_fence_sync
EGL_KHR_get_all_proc_addresses
EGL_KHR_gl_colorspace
EGL_KHR_gl_renderbuffer_image
EGL_KHR_gl_texture_2D_image
EGL_KHR_gl_texture_3D_image
EGL_KHR_gl_texture_cubemap_image
EGL_KHR_image
EGL_KHR_image_base
EGL_KHR_image_pixmap
EGL_KHR_no_config_context
EGL_KHR_reusable_sync
EGL_KHR_surfaceless_context
EGL_KHR_swap_buffers_with_damage
EGL_KHR_wait_sync
EGL_MESA_configless_context
EGL_MESA_drm_image
EGL_MESA_gl_interop
EGL_MESA_image_dma_buf_export
EGL_MESA_query_driver
EGL_MESA_x11_native_visual_id
EGL_NOK_texture_from_pixmap
EGL_WL_bind_wayland_display
- Selected fbconfig: R8G8B8A8, depth 0, stencil 0
high depth: none
Creating EGL context version 3.2 (debug:no, forward:no, legacy:no, es:no)
Using OpenGL backend EGL
info(gtk): libadwaita version build=1.6.2 runtime=1.6.2
error(gtk): Read method failed: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop
Creating EGL context version 3.2 (debug:no, forward:no, legacy:no, es:no)
OpenGL version: 4.6 (core)
GLSL version: 4.60
Max texture size: 16384
Enabled features (use GDK_GL_DISABLE env var to disable):
debug: ✓
unpack-subimage: ✓
half-float: ✓
sync: ✓
base-instance: ✓
buffer-storage: ✓
OpenGL version: 4.6 (core)
GLSL version: 4.60
Max texture size: 16384
Enabled features (use GDK_GL_DISABLE env var to disable):
debug: ✓
unpack-subimage: ✓
half-float: ✓
sync: ✓
base-instance: ✓
buffer-storage: ✓
(ghostty:3475525): Gtk-WARNING **: 02:44:03.441: GtkImage 0x31a0b830 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.441: GtkImage 0x31a09b60 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.441: GtkImage 0x319c7740 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.442: GtkImage 0x31a79170 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.442: GtkImage 0x31a754f0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.442: GtkImage 0x31a7b370 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.443: GtkImage 0x318aed70 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.443: GtkImage 0x31a812a0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.443: GtkImage 0x31a80400 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.444: GtkImage 0x31a83150 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.444: GtkImage 0x319bb340 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.455: GtkImage 0x33e3da10 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
Creating EGL context version 3.3 (debug:no, forward:no, legacy:no, es:no)
OpenGL version: 4.6 (core)
GLSL version: 4.60
Max texture size: 16384
Enabled features (use GDK_GL_DISABLE env var to disable):
debug: ✓
unpack-subimage: ✓
half-float: ✓
sync: ✓
base-instance: ✓
buffer-storage: ✓
info(grid): loaded OpenGL 4.6
info(io_exec): found Ghostty resources dir: /home/matoken/src/ghostty/zig-out/share/ghostty
info(io_exec): shell integration automatically injected shell=termio.shell_integration.Shell.bash
warning(gtk): unimplemented action=apprt.action.Action.Key.cell_size
warning(gtk): unimplemented action=apprt.action.Action.Key.size_limit
info(io_exec): started subcommand path=/bin/sh pid=3475569
info(io_exec): subcommand cgroup=-
error(gtk): Read method failed: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop
(ghostty:3475525): Gtk-WARNING **: 02:44:03.490: GtkImage 0x33e52760 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.498: GtkImage 0x31a7b370 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.498: GtkImage 0x342b77c0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.498: GtkImage 0x342b84c0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.498: GtkImage 0x31a7f490 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.498: GtkImage 0x31a80400 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.499: GtkImage 0x31a821f0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x31a7b370 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x342b77c0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x342b84c0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x33e52760 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x31a7f490 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x31a80400 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x31a821f0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x33e3da10 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
(ghostty:3475525): Gtk-WARNING **: 02:44:03.509: fb setup not supported (8cd6)
(ghostty:3475525): Gtk-WARNING **: 02:44:03.524: fb setup not supported (8cd6)
(ghostty:3475525): Gtk-WARNING **: 02:44:03.550: fb setup not supported (8cd6)
(ghostty:3475525): GLib-GObject-CRITICAL **: 02:44:03.634: g_object_ref: assertion 'G_IS_OBJECT (object)' failed
(ghostty:3475525): GLib-GObject-CRITICAL **: 02:44:03.634: g_object_ref: assertion 'G_IS_OBJECT (object)' failed
Segmentation faultSegmentation faultになってしまいます.エラーメッセージで検索して以下のIssueを見つけました.
Dupe, best guess currently is a GTK bug. Please search to find similar discussions (not issues).
GTKのbugではとのことですがUbuntu版があるのでそちらではどうなってるのだろうと.debを入手して試してみます.
$ wget2 -c -v https://github.com/mkasberg/ghostty-ubuntu/releases/download/1.0.1-0-ppa1/ghostty_1.0.1-0.ppa1_amd64_24.10.deb (1)
0 files 0% [<=> ] 0 B/s
[Files: 0 Bytes: 0 [0 B/s] Redirects: 1 Todo: 0 Errors: 1
$ fuse-archive ghostty_1.0.1-0.ppa1_amd64_24.10.deb (2)
fuse-archive: Created mount point 'ghostty_1.0.1-0.ppa1_amd64_24.10'
$ fuse-archive ghostty_1.0.1-0.ppa1_amd64_24.10/data.tar.zst ~/fuse/tmp (3)
fuse-archive: Using existing mount point '/home/matoken/fuse/tmp'
$ /home/matoken/fuse/tmp/usr/bin/ghostty (4)一番環境の近そうなUbuntu 22.10 amd64版を入手
fuse-archiveでmount(もしくはunarコマンドなどで展開)
fuse-archiveで適当な場所にdata.tarをmount(もしくはtar xfなどで展開)
Ghosttyを実行
Ubuntu向けGhosttyは起動しました.
debian/patchesを覗くと1つpatchがありますが関係が無さそう.試しに 000-libbz2.patch を適用してみましたがやはり起動できません.
https://github.com/mkasberg/ghostty-ubuntu/tree/main/debian/patches
resetしてもとに戻して今度は debian/rules を参考に zig build を試しましたがこれも動作変わらず.
https://github.com/mkasberg/ghostty-ubuntu/blob/main/debian/rules
GhosttyのIssueを探すとまさにDebian sid amd64での回答がありました.
最近のpangoの更新で引っかかるようになったようです.以下のbuild optionを指定することで回避できるようです.
Upd: just build with -fsys=fontconfig parameter
-fsys=fontconfig を付与してbuildし直し$ PATH=~/Downloads/zig-linux-x86_64-0.13.0/zig-linux-x86_64-0.13.0/:$PATH \ zig build -Doptimize=ReleaseFast -fsys=fontconfig $ zig-out/bin/ghostty
動作するようになりました :)

$ rsync -av zig-out/* ~/usr/ $ which ghostty /home/matoken/usr/bin/ghostty
ということで最近のDebian sid amd64環境などではしばらくはbuildオプションに -fsys=fontconfig を付けてあげる必要がありそうです.
$ zig build -Doptimize=ReleaseFast
↓
$ zig build -Doptimize=ReleaseFast -fsys=fontconfig
$ zig-out/bin/ghostty --version
Ghostty 1.0.2-main+60611b8
Version
- version: 1.0.2-main+60611b8
- channel: tip
Build Config
- Zig version: 0.13.0
- build mode : builtin.OptimizeMode.ReleaseFast
- app runtime: apprt.Runtime.gtk
- font engine: font.main.Backend.fontconfig_freetype
- renderer : renderer.OpenGL
- libxev : main.Backend.io_uring
- GTK version:
build : 4.16.7
runtime : 4.16.7
- libadwaita : enabled
build : 1.6.2
runtime : 1.6.2
- libX11 : enabled
$ dpkg-query -W libgtk-4-dev libadwaita-1-dev git
git 1:2.45.2-1.3
libadwaita-1-dev:amd64 1.6.2-1
libgtk-4-dev:amd64 4.16.7+ds-1
$ dpkg-query -W libpango* gir1.2-pango-1.0 | grep -v i386
gir1.2-pango-1.0:amd64 1.55.0+ds-3
libpango-1.0-0:amd64 1.55.0+ds-3
libpango1.0-dev:amd64 1.55.0+ds-3
libpango1.0-doc
libpangocairo-1.0-0:amd64 1.55.0+ds-3
libpangoft2-1.0-0:amd64 1.55.0+ds-3
libpangomm-1.4-1
libpangomm-1.4-1v5:amd64 2.46.4-1+b2
libpangomm-1.4-dev:amd64 2.46.4-1+b2
libpangomm-2.48-1
libpangomm-2.48-1t64:amd64 2.54.0-1
libpangoxft-1.0-0:amd64 1.55.0+ds-3
$ lsb_release -dr
Description: Debian GNU/Linux trixie/sid
Release: n/a
$ arch
x86_64