cpanでupdateすると以下のメッセージが出て、DB_Fileモジュールのアップデートに失敗する。"No library found for -ldb"と言われるし、"error: db.h: No such file or directory"といわれてインストールに失敗する。
CPAN.pm: Going to build P/PM/PMQS/DB_File-1.822.tar.gz Parsing config.in... Looks Good. Checking if your kit is complete... Looks good Note (probably harmless): No library found for -ldb Writing Makefile for DB_File Writing MYMETA.yml and MYMETA.json cp DB_File.pm blib/lib/DB_File.pm AutoSplitting blib/lib/DB_File.pm (blib/lib/auto/DB_File) cc -c -I/usr/local/BerkeleyDB/include -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_O FFSET_BITS=64 -O2 -g -DVERSION=\"1.822\" -DXS_VERSION=\"1.822\" -fPIC "-I/usr/lib/perl/5.10/CORE" -D_NOT_CORE -DmDB_Prefix_t=size_t -DmDB_Hash_t=u_int32_t version.c version.c:30:16: error: db.h: No such file or directory make: *** [version.o] Error 1 PMQS/DB_File-1.822.tar.gz /usr/bin/make -- NOT OK CPAN: YAML loaded ok (v0.73) Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible
まずは以下のように導入済みのパッケージからdb.hを検索してみる。存在しないことがわかる。つまり、ライブラリパスの設定が間違っているわけではないと思われる。
# dpkg --search db.h linux-libc-dev: /usr/include/linux/adb.h libc6-dev: /usr/include/netdb.h libssl-dev: /usr/include/openssl/txt_db.h libc6-dev: /usr/include/rpc/netdb.h libc6-dev: /usr/include/bits/netdb.h libc6-dev: /usr/include/thread_db.h
未導入のパッケージにdb.hが含まれる場合には、webの検索インターフェイスをつかう。複数のパッケージがdb.hというファイルを提供することがわかる。さらに絞り込みを行うために、libdb.aが含まれるパッケージを検索する。これにより、導入するべきパッケージはlibdb4.6-dev, libdb4.7-dev, libdb4.8-devの3つに絞られる。バージョン違いのパッケージのように思われるので、透過的に適当なパッケージを選択してインストールするダミーのパッケージが無いか検索すると以下のようになる。それっぽいパッケージの名前はlibdb-devだと判る。webから内容を確認すると、これをインストールすることで適当なバージョンが選択されることがわかる。
# aptitude search libdb | grep "libdb.*-dev" v libdb++-dev - p libdb-dev - Berkeley Database Libraries [development] v libdb-java-dev - p libdb4.6++-dev - Berkeley v4.6 Database Libraries for C++ [ p libdb4.6-dev - Berkeley v4.6 Database Libraries [developm p libdb4.6-java-dev - Berkeley v4.6 Database Libraries for Java p libdb4.7++-dev - Berkeley v4.7 Database Libraries for C++ [ p libdb4.7-dev - Berkeley v4.7 Database Libraries [developm p libdb4.7-java-dev - Berkeley v4.7 Database Libraries for Java p libdb4.8++-dev - Berkeley v4.8 Database Libraries for C++ [ p libdb4.8-dev - Berkeley v4.8 Database Libraries [developm p libdb4.8-java-dev - Berkeley v4.8 Database Libraries for Java p libdb4o-cil-dev - native OODBMS for CLI - development files p libdballe-dev - DB-All.e C development library for weather p libdballef-dev - DB-All.e Fortran development library for w p libdballepp-dev - DB-All.e C++ development library for weath v libdbaudiolib-dev - p libdbaudiolib0-dev - Communicate to the DBMix audio system (dev p libdbi0-dev - DB Independent Abstraction Layer for C -- p libdbus-1-dev - simple interprocess messaging system (deve p libdbus-c++-dev - C++ API for D-BUS (development package) p libdbus-glib-1-dev - simple interprocess messaging system (GLib p libdbus-ocaml-dev - OCaml bindings for the D-Bus API v libdbus-ocaml-dev-ci802 - p libdbusmenu-glib-dev - library for passing menus over DBus - deve p libdbusmenu-gtk-dev - library for passing menus over DBus - GTK+ p libdbusmenu-jsonloader-dev - library for passing menus over DBus - Test p libdbusmenu-qt-dev - Qt implementation of DBusMenu protocol (de
ということでlibdb-devをインストール。
# aptitude install libdb-dev The following NEW packages will be installed: libdb-dev libdb4.8-dev{a} 0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 766 kB of archives. After unpacking 2,060 kB will be used. Do you want to continue? [Y/n/?] Y Get:1 http://ftp.jp.debian.org/debian/ squeeze/main libdb4.8-dev i386 4.8.30-2 [765 kB] Get:2 http://ftp.jp.debian.org/debian/ squeeze/main libdb-dev i386 4.8 [1,630 B] Fetched 766 kB in 0s (2,333 kB/s) Selecting previously deselected package libdb4.8-dev. (Reading database ... 68706 files and directories currently installed.) Unpacking libdb4.8-dev (from .../libdb4.8-dev_4.8.30-2_i386.deb) ... Selecting previously deselected package libdb-dev. Unpacking libdb-dev (from .../libdb-dev_4.8_i386.deb) ... Setting up libdb4.8-dev (4.8.30-2) ... Setting up libdb-dev (4.8) ...
この後、再度cpanでupdateを行うと以下のように成功していることが確認できる。
CPAN.pm: Going to build P/PM/PMQS/DB_File-1.822.tar.gz Parsing config.in... Looks Good. Checking if your kit is complete... Looks good Writing Makefile for DB_File Writing MYMETA.yml and MYMETA.json cp DB_File.pm blib/lib/DB_File.pm AutoSplitting blib/lib/DB_File.pm (blib/lib/auto/DB_File) cc -c -I/usr/local/BerkeleyDB/include -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_O FFSET_BITS=64 -O2 -g -DVERSION=\"1.822\" -DXS_VERSION=\"1.822\" -fPIC "-I/usr/lib/perl/5.10/CORE" -D_NOT_CORE -DmDB_Prefix_t=size_t -DmDB_Hash_t=u_int32_t version.c /usr/bin/perl /usr/local/share/perl/5.10.1/ExtUtils/xsubpp -noprototypes -typemap /usr/share/perl/5.10/ExtUtils/typemap -typemap typemap DB_File.xs > DB_File.xsc && mv D B_File.xsc DB_File.c cc -c -I/usr/local/BerkeleyDB/include -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_O FFSET_BITS=64 -O2 -g -DVERSION=\"1.822\" -DXS_VERSION=\"1.822\" -fPIC "-I/usr/lib/perl/5.10/CORE" -D_NOT_CORE -DmDB_Prefix_t=size_t -DmDB_Hash_t=u_int32_t DB_File.c Running Mkbootstrap for DB_File () chmod 644 DB_File.bs rm -f blib/arch/auto/DB_File/DB_File.so LD_RUN_PATH="/usr/lib" cc -shared -O2 -g -L/usr/local/lib -fstack-protector version.o DB_File.o -o blib/arch/auto/DB_File/DB_File.so \ -ldb \ chmod 755 blib/arch/auto/DB_File/DB_File.so cp DB_File.bs blib/arch/auto/DB_File/DB_File.bs chmod 644 blib/arch/auto/DB_File/DB_File.bs Manifying blib/man3/DB_File.3pm PMQS/DB_File-1.822.tar.gz /usr/bin/make -- OK CPAN: YAML loaded ok (v0.73) Running make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/db-btree.t .. ok t/db-hash.t ... ok t/db-recno.t .. ok t/pod.t ....... ok All tests successful. Files=4, Tests=568, 11 wallclock secs ( 0.23 usr 0.02 sys + 4.36 cusr 3.52 csys = 8.13 CPU) Result: PASS PMQS/DB_File-1.822.tar.gz /usr/bin/make test -- OK Running make install Prepending /root/.cpan/build/DB_File-1.822-fer8BM/blib/arch /root/.cpan/build/DB_File-1.822-fer8BM/blib/lib to PERL5LIB for 'install' Files found in blib/arch: installing files in blib/lib into architecture dependent library tree Installing /usr/lib/perl/5.10/auto/DB_File/DB_File.so Installing /usr/lib/perl/5.10/auto/DB_File/DB_File.bs Installing /usr/lib/perl/5.10/DB_File.pm Installing /usr/lib/perl/5.10/auto/DB_File/autosplit.ix Installing /usr/share/man/man3/DB_File.3pm Appending installation info to /usr/lib/perl/5.10/perllocal.pod PMQS/DB_File-1.822.tar.gz /usr/bin/make install -- OK