YamChaを使ってみる

TinySVMが必要らしいので、それからインストールする作業。

wget http://chasen.org/~taku/software/TinySVM/src/TinySVM-0.09.tar.gz
./configure

で、makeしようとしたらこけた><。

/tmp/TinySVM-0.09% make
make  all-recursive
Making all in src
/bin/ksh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I..     -Wall -O9 -funroll-all-loops -finline -ffast-math -mieee-fp -c getopt.c
mkdir .libs
gcc -DHAVE_CONFIG_H -I. -I. -I.. -Wall -O9 -funroll-all-loops -finline -ffast-math -mieee-fp -c getopt.c  -fno-common -DPIC -o .libs/getopt.lo
getopt.c: In function '_getopt_internal':
getopt.c:577: warning: implicit declaration of function 'strcmp'
getopt.c:653: warning: implicit declaration of function 'strncmp'
getopt.c:656: warning: implicit declaration of function 'strlen'
getopt.c:656: warning: incompatible implicit declaration of built-in function 'strlen'
getopt.c:680: warning: incompatible implicit declaration of built-in function 'strlen'
getopt.c:698: warning: suggest explicit braces to avoid ambiguous 'else'
getopt.c:710: warning: incompatible implicit declaration of built-in function 'strlen'
getopt.c:726: warning: incompatible implicit declaration of built-in function 'strlen'
getopt.c:731: warning: incompatible implicit declaration of built-in function 'strlen'
getopt.c:842: warning: incompatible implicit declaration of built-in function 'strlen'
getopt.c:865: warning: incompatible implicit declaration of built-in function 'strlen'
getopt.c:885: warning: incompatible implicit declaration of built-in function 'strlen'
getopt.c:899: warning: incompatible implicit declaration of built-in function 'strlen'
getopt.c:903: warning: incompatible implicit declaration of built-in function 'strlen'
gcc -DHAVE_CONFIG_H -I. -I. -I.. -Wall -O9 -funroll-all-loops -finline -ffast-math -mieee-fp -c getopt.c -o getopt.o >/dev/null 2>&1
mv -f .libs/getopt.lo getopt.lo
/bin/ksh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I..     -Wall -O9 -funroll-all-loops -finline -ffast-math -mieee-fp -c getopt1.c
rm -f .libs/getopt1.lo
gcc -DHAVE_CONFIG_H -I. -I. -I.. -Wall -O9 -funroll-all-loops -finline -ffast-math -mieee-fp -c getopt1.c  -fno-common -DPIC -o .libs/getopt1.lo
gcc -DHAVE_CONFIG_H -I. -I. -I.. -Wall -O9 -funroll-all-loops -finline -ffast-math -mieee-fp -c getopt1.c -o getopt1.o >/dev/null 2>&1
mv -f .libs/getopt1.lo getopt1.lo
/bin/ksh ../libtool --mode=compile c++ -DHAVE_CONFIG_H -I. -I. -I..     -Wall -O9 -funroll-all-loops -finline -ffast-math -mieee-fp -c param.cpp
rm -f .libs/param.lo
c++ -DHAVE_CONFIG_H -I. -I. -I.. -Wall -O9 -funroll-all-loops -finline -ffast-math -mieee-fp -c param.cpp  -fno-common -DPIC -o .libs/param.lo
./getopt.h:131: error: declaration of C function 'int getopt()' conflicts with
/usr/include/unistd.h:454: error: previous declaration 'int getopt(int, char* const*, const char*)' here
make[2]: *** [param.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive-am] Error 2
/tmp/TinySVM-0.09% make check
Making check in src
/bin/ksh ../libtool --mode=compile c++ -DHAVE_CONFIG_H -I. -I. -I..     -Wall -O9 -funroll-all-loops -finline -ffast-math -mieee-fp -c param.cpp
rm -f .libs/param.lo
c++ -DHAVE_CONFIG_H -I. -I. -I.. -Wall -O9 -funroll-all-loops -finline -ffast-math -mieee-fp -c param.cpp  -fno-common -DPIC -o .libs/param.lo
./getopt.h:131: error: declaration of C function 'int getopt()' conflicts with
/usr/include/unistd.h:454: error: previous declaration 'int getopt(int, char* const*, const char*)' here
make[1]: *** [param.lo] Error 1
make: *** [check-recursive] Error 1

解決方法はこの辺に書いてあった。2箇所の変更をしたらmake通りました。

で、今度はyamcha。

wget http://www.chasen.org/~taku/software/yamcha/src/yamcha-0.33.tar.gz
tar zxvf yamcha-0.33.tar.gz

またふつーにやるとエラーが出たので、

./configure --with-svm-learn=/usr/local/bin
make
sudo make install

という感じで、TinySVMの場所を教えてあげた。

あとはなぜか南瓜のインストールもした。バージョンに注意。