俺だけのために Ore! Tips!

expat と XML::Parser のインストール

2005年12月 8日 作業


XML::RSSLite すんなり CPAN でインストール出来たが、それより高機能の XML::RSS は XML::Parser が入ってないから駄目だとおっしゃる。

ということで、XML::Parser をインストールすることに。


serv3# perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.59_54)
ReadLine support available (try 'install Bundle::CPAN')

cpan> install XML::Parser
Going to read /root/.cpan/sources/authors/01mailrc.txt.gz
Going to read /root/.cpan/sources/modules/02packages.details.txt.gz
Database was generated on Thu, 08 Dec 2005 05:59:39 GMT
HTTP::Date not available
<略>
Note (probably harmless): No library found for -lexpat

Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. You can download expat from:

http://sourceforge.net/projects/expat/
<略>
Running make test
Make had some problems, maybe interrupted? Won't test
Running make install
Make had some problems, maybe interrupted? Won't install

cpan> exit
Lockfile removed.

CPAN でのインストール失敗。
どうも、expat というのが先にインストールされてないと駄目みたいね。「No library found」と怒ってらっしゃる。expat おというのは「高速XMLパーサライブラリ」なんだそうな。XML::Parser で、このライブラリを使うんじゃね。
そう言えば、他のソフトをインストールするのに、何度か pkg_add したことがあるなあ。
が、今回インストールしている OS のヴァージョンでは、もう正規の packages をインターネット上から入手することは出来ないので、手動 make する。


serv3# cd /usr/local/src
serv3# lynx http://sourceforge.net/projects/expat/

最新のソースをダウンロード。現在は、Expat 1.95.8 released が最新の様子。
(例)
Download Expat XML Parser → expat-1.95.8.tar.gz → Download → http://keihanna.dl.sourceforge.net/sourceforge/expat/expat-1.95.8.tar.gz

serv3# ls -la exp*
-rw-r--r-- 1 root wheel 318349 Dec 8 18:11 expat-1.95.8.tar.gz
serv3# tar xvfz expat-1.95.8.tar.gz
expat-1.95.8/
expat-1.95.8/bcb5/
expat-1.95.8/bcb5/README.txt
expat-1.95.8/bcb5/all_projects.bpg
<略>
expat-1.95.8/xmlwf/xmlwf.c
expat-1.95.8/xmlwf/xmlwf.dsp
expat-1.95.8/xmlwf/xmlwin32url.cxx
serv3# cd expat-1.95.8

README を読むと、UTF-16 を使うのなら configure の時に引数指定せえというようなことが書いてあるような・・・(英語なので雰囲気ね)
つーことで、今回は特に必要なかろうよ。

serv3# ./configure
checking build system type... i386-unknown-freebsd5.2.1
checking host system type... i386-unknown-freebsd5.2.1
checking for gcc... gcc
<略>
checking for check.h... (cached) no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating expat_config.h
serv3# make
/bin/sh ./libtool --silent --mode=compile gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -I./lib -I. -o lib/xmlparse.lo -c lib/xmlparse.c
<略>
/bin/sh ./libtool --silent --mode=link gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -I./lib -I. -o xmlwf/xmlwf xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/unixfilemap.o libexpat.la
serv3# make install
/bin/sh ./conftools/mkinstalldirs /usr/local/lib /usr/local/include
/bin/sh ./libtool --mode=install /usr/bin/install -c libexpat.la /usr/local/lib/libexpat.la
/usr/bin/install -c .libs/libexpat.so.5 /usr/local/lib/libexpat.so.5
(cd /usr/local/lib && rm -f libexpat.so && ln -s libexpat.so.5 libexpat.so)
(cd /usr/local/lib && rm -f libexpat.so && ln -s libexpat.so.5 libexpat.so)
/usr/bin/install -c .libs/libexpat.lai /usr/local/lib/libexpat.la
/usr/bin/install -c .libs/libexpat.a /usr/local/lib/libexpat.a
ranlib /usr/local/lib/libexpat.a
chmod 644 /usr/local/lib/libexpat.a
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
/usr/bin/install -c -m 644 ./lib/expat.h ./lib/expat_external.h /usr/local/include
/bin/sh ./conftools/mkinstalldirs /usr/local/bin /usr/local/man/man1
/bin/sh ./libtool --mode=install /usr/bin/install -c xmlwf/xmlwf /usr/local/bin/xmlwf
/usr/bin/install -c xmlwf/.libs/xmlwf /usr/local/bin/xmlwf
/usr/bin/install -c -m 644 ./doc/xmlwf.1 /usr/local/man/man1
serv3#

これで expat が入ったので、もう一度 XML::Parser のインストールにチャレンジ。(/usr/local/lib に入ったみたいなので、ldconfig -m はせんでもええよなあ???)


serv3# perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.59_54)
ReadLine support available (try 'install Bundle::CPAN')

cpan> install XML::Parser
Going to read /root/.cpan/sources/authors/01mailrc.txt.gz
Going to read /root/.cpan/sources/modules/02packages.details.txt.gz
  Database was generated on Thu, 08 Dec 2005 05:59:39 GMT
  HTTP::Date not available
<略>
Writing /usr/local/lib/perl5/site_perl/5.6.1/mach/auto/XML/Parser/.packlist
FreeBSD: Registering installation in the package database
Appending installation info to /usr/local/lib/perl5/5.6.1/mach/perllocal.pod
  /usr/bin/make install -- OK


はい。今回は OK になりましたで。じゃ、続けて XML::RSS を入れましょう。(無事入りました)

前ページに戻る


Copyright (C) 2005 S.Maaasamasa.