[Home]Memo/MeCab

Amatubu_Wiki | Memo | RecentChanges | Preferences

Difference (from prior major revision) (minor diff, author diff)

Added: 6a7,8
* nmake を [ここらあたり] からダウンロードしてインストールしておく。


Removed: 52d53


Removed: 54d54


MinGW で MeCab をビルドする

下準備

    perl Makefile.PL
    nmake
    nmake install

MeCab 0.96

MeCab 0.96 では、Perl バインディングをビルドするために一部ソースの変更が必要。

参考:

[MinGw における MeCab のシェアードライブラリの問題: ナマズのブログ]

あとは、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.97

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

関連の日記


Amatubu_Wiki | Memo | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited February 13, 2008 22:14 by Amatubu (diff)
Search:

Copyright (c) 1996-2019 naoki iimura e-mail