もぐてっく

人は1つ歳をとるたび、1ビットづつ大きくなれると信じてた。

Ubuntu20.04でgem install gobject-introspectionが失敗する。

どうしたの?

久しぶりにUbuntu 20.04(て言うかZorin OS 15.3)にmikutterをインストールしようとしたら、gobject-introspection gemのインストールでこけた。

moguno@zorin:~$ sudo gem install gobject-introspection 
Building native extensions. This could take a while...
・・・
checking for gobject-introspection-1.0... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

すでにsudo apt-get install gobject-introspectionは実行済み。はて。

解決した

mkmf.logを見ると、have_package("gobject-intropection-1.0")が失敗している模様。
これは何だとググると、pkg-configからgobject-instrospenctionの情報が取れない時に起こる模様。

moguno@zorin:~$ pkg-config --list-all | grep gobject
cairo-gobject                  cairo-gobject - gobject functions for cairo graphics library
gobject-2.0                    GObject - GLib Type, Object, Parameter and Signal Library
harfbuzz-gobject               harfbuzz - HarfBuzz text shaping library GObject integration

確かに居ない。

pkg-config gobject-introspectionでググると、Pythonでおんなじハマり方をしている人を発見。

pyopyopyo.hatenablog.com

ここに書かれてるエラーメッセージに従い、libgirepository1.0-devと言う謎ライブラリをインストール

sudo apt install libgirepository1.0-dev

あ、増えた。

moguno@zorin:~$ pkg-config --list-all | grep gobject
gobject-introspection-no-export-1.0 gobject-introspection - GObject Introspection
cairo-gobject                       cairo-gobject - gobject functions for cairo graphics library
gobject-introspection-1.0           gobject-introspection - GObject Introspection
gobject-2.0                         GObject - GLib Type, Object, Parameter and Signal Library

無事にgemのコンパイルに成功しました。

moguno@zorin:~$ sudo gem install gobject-introspection 
Building native extensions. This could take a while...
Successfully installed gobject-introspection-3.4.3
Parsing documentation for gobject-introspection-3.4.3
Installing ri documentation for gobject-introspection-3.4.3
Done installing documentation for gobject-introspection after 0 seconds
1 gem installed