俺だけのために Ore! Tips!

ChaSen のインストール

2004年03月14日 作業

検索サイト構築のため、形態素解析エンジン「茶筅」(奈良先端科学技術大学院大学情報科学研究科自然言語処理学講座(松本研究室)作)をセットアップ。

ChaSen http://chasen.aist-nara.ac.jp/stable/chasen/chasen-2.3.3.tar.gz
Darts http://cl.aist-nara.ac.jp/~taku-ku/software/darts/src/darts-0.2.tar.gz

最初に Darts(Double-Array を構築するための シンプルな C++ Template Library:taku-ku 氏作)を入れなきゃ。

mikan# tar xvfz darts-0.2.tar.gz
darts-0.2/
darts-0.2/README
darts-0.2/darts.h
<略>
darts-0.2/doc/
darts-0.2/doc/darts.css
darts-0.2/doc/index.html
mikan# cd darts-0.2
mikan# make
make all-recursive
Making all in tests
source='mkdarts.cpp' object='mkdarts.o' libtool=no depfile='.deps/mkdarts.Po' tmpdepfile='.deps/mkdarts.TPo' depmode=gcc /bin/sh ./depcomp g++ -DHAVE_CONFIG_H -I. -I. -I. -O3 -Wall -c -o mkdarts.o `test -f 'mkdarts.cpp' || echo './'`mkdarts.cpp
<略>
test -f 'darts.cpp' || echo './'`darts.cpp
g++ -O3 -Wall -o darts darts.o -lz
mikan# make check
Making check in tests
make check-TESTS
Making Double Array: 100% |*******************************************|
Done!, Compression Ratio: 94.5065 %
Checking ...
PASS: test1.sh
==================
All 1 tests passed
==================
mikan# make install
Making install in tests
/bin/sh ./mkinstalldirs /usr/local/libexec/darts
mkdir /usr/local/libexec/darts
/usr/bin/install -c mkdarts /usr/local/libexec/darts/mkdarts
/usr/bin/install -c darts /usr/local/libexec/darts/darts
/bin/sh ./mkinstalldirs /usr/local/include
/usr/bin/install -c -m 644 darts.h /usr/local/include/darts.h


そして茶筅を!

mikan# tar xvfz chasen-2.3.3.tar.gz
chasen-2.3.3/
chasen-2.3.3/README
chasen-2.3.3/AUTHORS
<略>
chasen-2.3.3/perl/MANIFEST
chasen-2.3.3/perl/Makefile.PL
chasen-2.3.3/perl/README
mikan# cd chasen-2.3.3/
mikan# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
<略>
checking for windows.h... no
checking for darts.h... configure: error: no header of Darts. You need to fetch Darts from http://cl.aist-nara.ac.jp/~taku-ku/software/darts/.


ありゃりゃ?
Darts 入れたのに。

mikan# ls -al /usr/local/include/darts.h
-rw-r--r-- 1 root wheel 12355 Mar 14 00:19 /usr/local/include/darts.h

--with-darts オプションをつけてみる

mikan# ./configure --with-darts=/usr/local/include/
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
<略>
checking for darts.h... yes
checking for iconv in -liconv... no
checking iconv.h usability... no
checking iconv.h presence... no
checking for iconv.h... no
configure: error: ChaSen needs iconv

darts.h は見つかったが、今度は iconv が無いと言うてはる。
libiconv は package で入れてるのに。
libiconv-1.8_2 A character set conversion library

--with-libiconv をつけないと駄目なのか?

mikan# ./configure --with-darts=/usr/local/include --with-libiconv=/usr/local
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
<略>
config.status: creating chasen.spec
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing default commands

おお、うまくいきました。
しかし、/usr/local/include とか、/usr/local ディレクトリを明示的に指定しないといけないというのは・・・

mikan# make
make all-recursive
Making all in doc
Making all in lib
<略>
creating makeda
Making all in tests
mikan# make install
Making install in doc
Making install in lib
/bin/sh ../mkinstalldirs /usr/local/lib
/bin/sh ../libtool --mode=install /usr/bin/install -c libchasen.la /usr/local/lib/libchasen.la
/usr/bin/install -c .libs/libchasen.so.0 /usr/local/lib/libchasen.so.0
(cd /usr/local/lib && rm -f libchasen.so && ln -s libchasen.so.0 libchasen.so)
(cd /usr/local/lib && rm -f libchasen.so && ln -s libchasen.so.0 libchasen.so)
/usr/bin/install -c .libs/libchasen.lai /usr/local/lib/libchasen.la
/usr/bin/install -c .libs/libchasen.a /usr/local/lib/libchasen.a
ranlib /usr/local/lib/libchasen.a
chmod 644 /usr/local/lib/libchasen.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 chasen-config /usr/local/bin/chasen-config

とりあえず、これで CahSen 本体はインストール出来た。


前ページに戻る


Copyright (C) 2003-2004 S.Maaasamasa.