zfsonlinux ビルドエラー
概略
ZFS on Linux のバージョンアップを実行したところ、ビルドエラーが発生して、わけがわからない。(*.hとか*.cを探しても対象のオブジェクトは存在する)
No rule to make target `ChangeLog', needed by `distdir'. Stop. ※これはChangeLogがトップディレクトリにないので、エラーとなっています。 ※debianのメインストリームに乗せる場合でない限り、touch ChangeLogで解決します。
とか
$ cd zfs $ ./configure (snip) $ make -s (snip) Making all in module In file included from /storage/build/build/zfs/zfs/include/sys/dsl_deleg.h:30, from /storage/build/build/zfs/zfs/module/zcommon/../../module/zcommon/zfs_deleg.c:38: /storage/build/build/zfs/zfs/include/sys/dsl_pool.h:69: error: expected specifier-qualifier-list before 'kstat_txg_t' make[7]: *** [/storage/build/build/zfs/zfs/module/zcommon/../../module/zcommon/zfs_deleg.o] Error 1 make[6]: *** [/storage/build/build/zfs/zfs/module/zcommon] Error 2 make[5]: *** [_module_/storage/build/build/zfs/zfs/module] Error 2 make[4]: *** [sub-make] Error 2 make[3]: *** [all] Error 2 make[2]: *** [modules] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
とか
Module.symvers が見つからない
解決策1
configure前に、以下のコマンドを流しておく。
sudo aptitude remove spl-modules-devel zfs-devel zfs-modules-devel
原因として、configure時に依存関係の解決にシステム組み込みのパスを使用しているため。
$ ./configure (snip) checking spl source directory... /usr/src/spl-0.6.0-rc11/2.6.32-5-amd64 checking spl build directory... /usr/src/spl-0.6.0-rc11/2.6.32-5-amd64 checking spl source version... 0.6.0-rc11
解決策2(非推奨)
configure時にターゲットを指定する。
$ ./configure --with_spl=$(pwd)/../spl --with_spl_obj=$(pwd)/../spl (snip) checking spl source directory... /storage/build/build/zfs/zfs/../spl checking spl build directory... /storage/build/build/zfs/zfs/../spl checking spl source version... 0.6.0-rc13 checking spl file name for module symbols... Module.symvers checking whether modules can be built... yes
確認ポイント
configure時に流れる内容で重要なのが、「spl source version」。
今回は0.6.0-rc13なので、以下のようになっているべき。
$ ./configure (snip) checking kernel source directory... /usr/src/linux-headers-2.6.32-5-common checking kernel build directory... /usr/src/linux-headers-2.6.32-5-amd64 checking kernel source version... 2.6.32-5-amd64 checking kernel file name for module symbols... Module.symvers checking spl source directory... /storage/build/build/zfs/spl checking spl build directory... /storage/build/build/zfs/spl checking spl source version... 0.6.0-rc13 checking spl file name for module symbols... Module.symvers checking whether modules can be built... yes
バージョンがあっていないと、zfsのビルドに失敗したり、整合性が取れず、ZFSを論理崩壊させちゃうかもしれません(後者は誇大解釈・嘘・大げさ・J[A-Z]+にあたりますが、直し方によっては嘘ではないので守ることを強く推奨します、というかバージョンをあわせるのはあたりまえです)
今のところ、rc11->rc12 or rc13はビルドエラーとなっているのである程度ご安心ください(嘘)