CentOS 5.9 に mu をインストールしようとしたら思いのほか大変だったという話
サーバに貯めているメールをWanderlustから全文検索する方法を調べていると mu というのを見つけた。 作者も元々Wanderlustで使うために作ったみたいで設定も簡単なので試そうとしたところ、yumの標準リポジトリはもちろん、RPMすら見つからない。(ググラビリティが低いので探しきれていない可能性はある)
じゃあソースから入れればいっかと軽い気持ちで始めたところ、スーパーmake祭りで結構手間がかかったので、同じようにニッチなプロダクト好きな人のために記録を残しておく。
(ソースからビルドしたもののインストール先については宗教によって違うと思うけど、僕は一ユーザでしか実行することのないものはそのユーザの $HOME/local/
下にそれぞれ入れて、必要なものだけ $HOME/bin
などにリンクを張る派なので全般的にめんどくさい感じになっていますがあしからず)
まず普通にconfigure
を叩いてみると
$ cd ~/src $ wget https://mu0.googlecode.com/files/mu-0.9.9.tar.gz $ tar zxf mu-0.9.9.tar.gz $ cd mu-0.9.9 $ ./configure --prefix=/home/nkwhr/local/mu-0.9.9 --disable-mu4e --disable-webkit --disable-guile -- snip -- checking for GLIB... no configure: error: Package requirements (glib-2.0 >= 2.24 gobject-2.0) were not met: Requested 'glib-2.0 >= 2.24' but version of GLib is 2.12.3 Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables GLIB_CFLAGS and GLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.
GLIBが古いとかレアなエラーが出た。(新しいバージョンでも.so
の名前が一緒で共存させるのが難しいからRPMがないのかも)
GLIBも新しく入れようとソースを持ってきて解凍しようとすると
$ cd ~/src $ wget http://ftp.acc.umu.se/pub/gnome/sources/glib/2.35/glib-2.35.9.tar.xz $ tar -Jxf glib-2.35.9.tar.xz tar: invalid option -- J Try `tar --help' or `tar --usage' for more information.
xzを解凍する-J
オプションがない・・・ググってみると
"GNU tar 1.22リリース gzipより圧縮効率が大きく向上した「xz」をサポート"
とのこと。インストールされているtarのバージョンを確認すると
$ tar --version tar (GNU tar) 1.15.1
というわけでtarも新しく入れる。
$ wget http://ftp.gnu.org/gnu/tar/tar-1.26.tar.gz $ tar zxf tar-1.26.tar.gz $ cd tar-1.26 $ ./configure --prefix=/home/nkwhr/local/tar-1.26 $ make && make install $ ln -s ~/local/tar-1.26/bin/tar ~/bin
これはすんなり入った。気を取り直してGLIBのインストールを再開。
$ cd ~/src $ tar -Jxf glib-2.35.9.tar.xz $ cd glib-2.35.9 $ ./configure --prefix=/home/nkwhr/local/glib-2.35.9 $ make -- snip -- ../gobject/glib-mkenums: line 3: use: command not found ../gobject/glib-mkenums: line 4: use: command not found ../gobject/glib-mkenums: line 5: use: command not found ../gobject/glib-mkenums: line 9: my: command not found ../gobject/glib-mkenums: line 10: my: command not found ../gobject/glib-mkenums: line 13: my: command not found ../gobject/glib-mkenums: line 18: my: command not found ../gobject/glib-mkenums: line 19: my: command not found ../gobject/glib-mkenums: line 20: my: command not found ../gobject/glib-mkenums: line 21: my: command not found ../gobject/glib-mkenums: line 22: my: command not found ../gobject/glib-mkenums: line 23: my: command not found ../gobject/glib-mkenums: line 24: my: command not found ../gobject/glib-mkenums: line 25: my: command not found ../gobject/glib-mkenums: line 26: my: command not found ../gobject/glib-mkenums: line 28: sub: command not found ../gobject/glib-mkenums: line 29: my: command not found ../gobject/glib-mkenums: line 30: my: command not found ../gobject/glib-mkenums: line 32: syntax error near unexpected token `(' ../gobject/glib-mkenums: line 32: ` for $opt (split /\s*,\s*/, $opts) {' make[2]: *** [gioenumtypes.h] Error 2 make[2]: Leaving directory `/home/nkwhr/src/glib-2.35.9/gio' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/nkwhr/src/glib-2.35.9' make: *** [all] Error 2
多分どこかでエスケープが入ってPerlのスクリプトが正常に実行されていないので対象のファイルを見てみる。
$ head -n1 ./gobject/glib-mkenums
#! /home/nkwhr/.plenv/shims/perl
plenvを使っているせいかshebangがおかしなことになっていたので書き換えてもう一度実行。
$ diff ./gobject/glib-mkenums{.org,} 1c1 < #! /home/nkwhr/.plenv/shims/perl --- > #!/usr/bin/env perl
$ make clean && make $ make install
これで問題なく通ったので改めてmu
のビルドへ(2回目)。GLIBをPATHが通っていないところに入れたのでpkgconfig
のPATHを追加する。
$ cd ~/src/mu-0.9.9 $ PKG_CONFIG_PATH=/home/nkwhr/local/glib-2.35.9/lib/pkgconfig \ ./configure --prefix=/home/nkwhr/local/mu-0.9.9 --disable-mu4e --disable-webkit --disable-guile -- snip -- checking for GMIME... no configure: error: *** neither gmime-2.4 nor gmime-2.6 could be found; please install it *** e.g., in debian/ubuntu the package would be 'libgmime-2.4-dev' *** If you compiled it yourself, you should ensure that the pkgconfig *** installation dir (e.g., /usr/local/lib/pkgconfig) is in your *** PKG_CONFIG_PATH.
次はgmimeというのが必要らしい。epelにあったのでさくっとyumで入れようと思ったら
#yum info gmime Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * epel: ftp.iij.ad.jp Excluding Packages in global exclude list Finished Available Packages Name : gmime Arch : x86_64 Version : 2.2.26 Release : 1.el5 Size : 224 k Repo : epel Summary : Library for creating and parsing MIME messages URL : http://spruce.sourceforge.net/gmime/ License : GPL Description: The GMime suite provides a core library and set of utilities which may be : used for the creation and parsing of messages using the Multipurpose : Internet Mail Extension (MIME).
案の定バージョンが古いのでソースから入れる。
これも新しめのGLIBが必要なので先ほど入れたGLIBのPATHを通す。あとlibgpg-error-devel
も必要だったのでyumから入れた。
$ cd ~/src $ wget http://ftp.acc.umu.se/pub/GNOME/sources/gmime/2.6/gmime-2.6.15.tar.xz $ tar -Jxf gmime-2.6.15.tar.xz $ cd gmime-2.6.15 $ LD_LIBRARY_PATH=/home/nkwhr/local/glib-2.35.9/lib \ PKG_CONFIG_PATH=/home/nkwhr/local/glib-2.35.9/lib/pkgconfig \ ./configure --prefix=/home/nkwhr/local/gmime-2.6.15 $ make -- snip -- test-pkcs7.c:36:23: error: gpg-error.h: No such file or directory -- snip -- $ sudo yum install libgpg-error-devel $ make clean && make && make install
インストール後、GLIBのpkgconfig
にsymlinkを張っておく。
$ ln -s ~/local/gmime-2.6.15/lib/pkgconfig/gmime-2.6.pc ~/local/glib-2.35.9/lib/pkgconfig/
改めてmu
のビルドへ(3回目)。
$ cd ~/src/mu-0.9.9 $ PKG_CONFIG_PATH=/home/nkwhr/local/glib-2.35.9/lib/pkgconfig \ ./configure --prefix=/home/nkwhr/local/mu-0.9.9 --disable-mu4e --disable-webkit --disable-guile -- snip -- checking for xapian-config... no configure: error: *** xapian could not be found; please install it *** e.g., in debian/ubuntu the package would be 'libxapian-dev' *** If you compiled it yourself, you should ensure that xapian-config *** is in your PATH.
はい、次はxapianというやつです。
$ cd ~/src $ wget http://oligarchy.co.uk/xapian/1.2.14/xapian-core-1.2.14.tar.gz $ tar zxf xapian-core-1.2.14.tar.gz $ cd xapian-core-1.2.14 $ ./configure --prefix=/home/nkwhr/local/xapian-core-1.2.14 $ make && make install
淡々と入れてmu
のビルドへ(4回目) 。今回はxapian-config
のPATHも追加。
$ cd ~/src/mu-0.9.9 $ PATH=$PATH:/home/nkwhr/local/xapian-core-1.2.14/bin \ PKG_CONFIG_PATH=/home/nkwhr/local/glib-2.35.9/lib/pkgconfig \ ./configure --prefix=/home/nkwhr/local/mu-0.9.9 --disable-mu4e --disable-webkit --disable-guile -- snip -- mu configuration is complete. ------------------------------------------------ mu version : 0.9.9 Xapian version : 1.2.14 GLib version : 2.35.9 GMime version : 2.6.15 GIO version : 2.35.9 Build mu4e emacs frontend : no Build crypto support (gmime >= 2.6) : yes Build 'mug' toy-ui (gtk+/webkit) : no McCabe's Cyclomatic Complexity tool : yes Have direntry->d_ino : yes Have direntry->d_type : yes ------------------------------------------------ Now, type 'make' to build mu. If unit tests are built (see above), you can run 'make check' for some basic testing of mu functionality.
ついにconfigure
が通った!
$ make && make install
make
でこけたら心が折れるところだったけど大丈夫だった。
ldd
で見たところちゃんと全てのライブラリにリンクされているし問題なさそう。
$ ldd ~/local/mu-0.9.9/bin/mu linux-vdso.so.1 => (0x00007fff7511a000) libxapian.so.22 => /home/nkwhr/local/xapian-core-1.2.14/lib/libxapian.so.22 (0x00002b14f6633000) libuuid.so.1 => /lib64/libuuid.so.1 (0x0000003f14800000) libgmime-2.6.so.0 => /home/nkwhr/local/gmime-2.6.15/lib/libgmime-2.6.so.0 (0x00002b14f6a77000) libgthread-2.0.so.0 => /home/nkwhr/local/glib-2.35.9/lib/libgthread-2.0.so.0 (0x00002b14f6ce0000) libnsl.so.1 => /lib64/libnsl.so.1 (0x0000003f13400000) libgio-2.0.so.0 => /home/nkwhr/local/glib-2.35.9/lib/libgio-2.0.so.0 (0x00002b14f6ee2000) libgmodule-2.0.so.0 => /home/nkwhr/local/glib-2.35.9/lib/libgmodule-2.0.so.0 (0x00002b14f7243000) libdl.so.2 => /lib64/libdl.so.2 (0x0000003f10000000) libz.so.1 => /lib64/libz.so.1 (0x0000003f10c00000) libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003bf2e00000) libresolv.so.2 => /lib64/libresolv.so.2 (0x00002b14f7447000) libffi.so.5 => /usr/lib64/libffi.so.5 (0x00002b14f765d000) libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003f10400000) librt.so.1 => /lib64/librt.so.1 (0x0000003f11800000) libgobject-2.0.so.0 => /home/nkwhr/local/glib-2.35.9/lib/libgobject-2.0.so.0 (0x00002b14f7865000) libglib-2.0.so.0 => /home/nkwhr/local/glib-2.35.9/lib/libglib-2.0.so.0 (0x00002b14f7ab2000) libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003f11000000) libm.so.6 => /lib64/libm.so.6 (0x0000003f10800000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003f11c00000) libc.so.6 => /lib64/libc.so.6 (0x0000003f0fc00000) /lib64/ld-linux-x86-64.so.2 (0x0000003f0f800000) libsepol.so.1 => /lib64/libsepol.so.1 (0x0000003bf2600000)
メールのインデックスを作成してみる。
$ ln -s ~/local/mu-0.9.9/bin/mu ~/bin $ mu index --maildir=~/Mail indexing messages under /home/nkwhr/Mail [/home/nkwhr/.mu/xapian] \ processing mail; processed: 18300; updated/new: 18300, cleaned-up: 0 cleaning up messages [/home/nkwhr/.mu/xapian] | processing mail; processed: 18348; updated/new: 0, cleaned-up: 0 elapsed: 0 second(s) / processing mail; processed: 18348; updated/new: 0, cleaned-up: 0 elapsed: 52 second(s), ~ 352 msg/
問題なく終了。HyperEstraierやNamazuと比較していないので早いのかは分からないけど実用に耐えられそう。
これでmu find
で全文検索が出来るようになった。yattane!
あとは.wl
に
(require 'elmo-search) (elmo-search-register-engine 'mu 'local-file :prog "mu" :args '("find" pattern "-o" "plain" "-f" "l") :charset 'utf-8) (setq elmo-search-default-engine 'mu)
と書いて g
-> [検索ワード]
と入力するとwanderlustからも検索が出来るようになって幸せ。