* nmake を [ここらあたり] からダウンロードしてインストールしておく。 |
|
|
perl Makefile.PL nmake nmake install
MeCab 0.96 では、Perl バインディングをビルドするために一部ソースの変更が必要。
参考:
あとは、MeCab 本体。
./configure make make install
辞書。
./configure make make install
Perl バインディングは Makefile.PL を以下のように修正。
use ExtUtils::MakeMaker; WriteMakefile( 'NAME' => 'MeCab', 'CC' => 'g++', 'LD' => 'g++', 'INC' => '-Ie:\msys\1.0\local\include', 'LIBS' => '-Le:\msys\1.0\local\lib -lmecab', 'VERSION' => '0.96', 'OBJECT' => 'MeCab_wrap.o' );
その後は
perl -MConfig_m Makefile.PL nmake nmake install
MeCab 0.96 までの対応に加え、以下の変更が必要。
そのままでは、問題なくビルドできたように見えるが、実行すると
This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
というエラーがでてしまう。libmecab.cpp を以下のように変更する。
*** mecab-0.97-original/src/libmecab.cpp Mon Nov 26 02:27:12 2007 --- mecab-0.97/src/libmecab.cpp Wed Feb 13 22:11:35 2008 *************** *** 50,56 **** #if defined(_WIN32) && !defined(__CYGWIN__) HINSTANCE DllInstance = 0; ! #ifdef __cplusplus extern "C" { #endif BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID) { --- 50,56 ---- #if defined(_WIN32) && !defined(__CYGWIN__) HINSTANCE DllInstance = 0; ! #if defined(__cplusplus) && !defined(__MINGW32__) extern "C" { #endif BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID) { *************** *** 62,68 **** std::locale::global(loc); return TRUE; } ! #ifdef __cplusplus } #endif #endif --- 62,68 ---- std::locale::global(loc); return TRUE; } ! #if defined(__cplusplus) && !defined(__MINGW32__) } #endif #endif